Ask Your Question

Jaewoo's profile - activity

2018-12-30 20:55:21 -0600 edited question DNN module: switch Torch model between train() and evaluation() modes

DNN module: set Torch model to evaluation() mode Torch models can run in two different modes: train() and evaluation().

2018-12-21 00:59:10 -0600 commented answer DNN module: switch Torch model between train() and evaluation() modes

@dkurt Thanks for the pull request!

2018-12-21 00:56:05 -0600 received badge  Enthusiast
2018-12-20 23:52:08 -0600 commented answer DNN module: switch Torch model between train() and evaluation() modes

@dkurt If I could, I would give you 1000000 upvotes. Thank you so much for your kind feedback!

2018-12-20 23:21:17 -0600 commented answer DNN module: switch Torch model between train() and evaluation() modes

@dkurt I know that some layers, such as dropout or batch normalization are not deterministic during the training phase.

2018-12-20 21:04:43 -0600 marked best answer DNN module: switch Torch model between train() and evaluation() modes

Torch models can run in two different modes: train() and evaluation(). Results of some layers such as batch normalization will be affected by the modes.

Currently it seems (i.e., when I tested) that OpenCV's DNN module loads and runs torch models in train() mode. Is there a way to use torch models in evaluation() mode using OpenCV?

(ADDED) Below is the lua code for running the model with two different modes.

require 'torch'
require 'image'
require 'nn'

local net = torch.load('model.t7')
net:evaluate() -- you can turn this on or off

local image_input = image.load('input_image.jpg', 3, 'float')
image_input:resize(1, image_input:size()[1], image_input:size()[2], image_input:size()[3])

local result = net:forward(image_input)
image.save('result.jpg', result[1])
2018-12-20 21:04:43 -0600 received badge  Scholar (source)
2018-12-20 21:04:37 -0600 commented answer DNN module: switch Torch model between train() and evaluation() modes

Thanks for your answer! I also got same result by using OpenCV for Python. May I ask one more question? Then is there a

2018-12-20 20:56:02 -0600 commented answer DNN module: switch Torch model between train() and evaluation() modes

Thanks for your answer. I also got same result by using OpenCV for Python. But my code is on Android and the result from

2018-12-20 03:41:35 -0600 edited question DNN module: switch Torch model between train() and evaluation() modes

DNN module: set Torch model to evaluation() mode Torch models can run in two different modes: train() and evaluation().

2018-12-20 03:39:49 -0600 commented question DNN module: switch Torch model between train() and evaluation() modes

@dkurt The model is on https://github.com/chuanli11/MGANs/blob/master/model/Picasso.t7 . (ADDED) I added the my lua code

2018-12-20 03:35:46 -0600 commented question DNN module: switch Torch model between train() and evaluation() modes

@dkurt The model is on https://github.com/chuanli11/MGANs/blob/master/model/Picasso.t7 .

2018-12-20 03:31:26 -0600 commented question DNN module: switch Torch model between train() and evaluation() modes

@dkurt Oh, I used net:evaluate(), not net:evaluation(), in torch. Sorry for the typo. I am sure the inputs were exactly

2018-12-20 03:27:40 -0600 commented question DNN module: switch Torch model between train() and evaluation() modes

@dkurt Oh, I used net:evaluate(), not net:evaluation(), in torch. Sorry for the typo. I am sure the inputs were exactly

2018-12-20 03:19:16 -0600 commented question DNN module: switch Torch model between train() and evaluation() modes

@dkurt I have a deconvolution network. I ran it on my desktop with same input, once with model:train() and the other tim

2018-12-20 02:59:01 -0600 commented question DNN module: switch Torch model between train() and evaluation() modes

@dkurt Would you explain to me a bit in detail? I tried calling model:evaluation() and then using torch.save() to save t

2018-12-20 02:42:59 -0600 asked a question DNN module: switch Torch model between train() and evaluation() modes

DNN module: set Torch model to evaluation() mode Torch models can run in two different modes: train() and evaluation().

2018-11-08 02:31:40 -0600 commented question Is there implicit limit for DNN input size of OpenCV Android?

@berak Testing on a PC rather than Android seems a good idea. Thanks!

2018-11-07 20:19:55 -0600 commented question Is there implicit limit for DNN input size of OpenCV Android?

@berak I added the prototxt content to the post.

2018-11-07 20:19:27 -0600 received badge  Editor (source)
2018-11-07 20:19:27 -0600 edited question Is there implicit limit for DNN input size of OpenCV Android?

Is there implicit limit for DNN input size of OpenCV Android? I trained a Caffe model which does NOT specify input sizes

2018-11-07 03:15:40 -0600 commented question Is there implicit limit for DNN input size of OpenCV Android?

@berak It's OpenCV 3.4.2 for Android. The network is a caffe network without specific input size.

2018-11-07 03:01:49 -0600 received badge  Organizer (source)
2018-11-07 03:01:43 -0600 asked a question Is there implicit limit for DNN input size of OpenCV Android?

Is there implicit limit for DNN input size of OpenCV Android? I trained a Caffe model which does NOT specify input sizes