peiyunh/tiny

About the mode 'normal' in model

Closed this issue · 2 comments

Hello peiyun,
Your work is so amazing and i have read a part of the source code. But i didn't understand a detail that why you use the mode 'normal' rather than 'test' in the model, downloaded at https://www.cs.cmu.edu/~peiyunh/tiny/hr_res101.mat.
I found the code in file BatchNorm.m, line 13,

    function outputs = forward(obj, inputs, params)
      if strcmp(obj.net.mode, 'test')
        outputs{1} = vl_nnbnorm(inputs{1}, params{1}, params{2}, ...
                                'moments', params{3}, ...
                                'epsilon', obj.epsilon, ...
                                obj.opts{:}) ;
      else
        [outputs{1},obj.moments] = ...
            vl_nnbnorm(inputs{1}, params{1}, params{2}, ...
                       'epsilon', obj.epsilon, ...
                       obj.opts{:}) ;
      end
    end

Setting the mode to 'normal' will make the vl_nnbnorm return moments.
What i didn't understand is why don't you use the mode 'test' and the params 'bn_conv1_moments'?
Hope you will answer my question. Thank you very much.

Hello @MaxLingwei, I set the mode to 'test' when testing on WIDER FACE(https://github.com/peiyunh/tiny/blob/master/cnn_widerface_test_AB.m#L169), but I forgot to do the same for the demo script. It is now updated (https://github.com/peiyunh/tiny/blob/master/tiny_face_detector.m#L63). Good catch!

Aha, thank you for your answering. I have tried these two mode and got almost the same result.