vlfeat / matconvnet

MatConvNet: CNNs for MATLAB
Other
1.4k stars 753 forks source link

Sliding Window Stride in MatConvNet #470

Open wajahat57 opened 8 years ago

wajahat57 commented 8 years ago

Hi I am new to ConvNets. If in MatConvNet, the FC layer is a large convolution, then for any input image of size larger than the training images, the network would apply a sliding window. My question is that how the stride of this slide can be controlled? Which parameter will decide that by how many pixels will the window slide between two consecutive positions on the large input image? Best Regards Wajahat

Youmna-Salah commented 8 years ago

By setting the parameter 'stride' to the required value e.g. vl_nnconv(X , W , 'stride' , 2 , 'padding' , 1) in that example you are applying a stride equal to 2 in both directions(i.e. x and y directions) you can also specify different strides in each direction vl_nnconv(X , W ,B, 'stride' , [1 2] , 'padding' , 1).Where X is your data input ,W is the filter and B is the bias . I hope that answers your question

wajahat57 commented 8 years ago

But that will be the stride of that particular conv layer, and not the stride of the entire network.

Youmna-Salah commented 8 years ago

Do you mean by "Stride for the entire network" that all layers have the same stride or that you want to apply a specific stride to the final output or accumulative stride from all layers ? For the former case you can use the stride option for all layers and set it manually---as I mentioned in the above example---to a same value for all layers in the net. For the latter case you can apply that stride to the final layer.