Open jessika0991 opened 7 years ago
The batch size is set by the command line argument -batchSize
. With the -tenCrop
setting, your 30 images are actually 3 unique pictures with 10 crops each. (3x10x3x224x224). It's folded into a batch of 30 images (30x3x224x224) so that it works with the rest of the code.
Thanks for the fast reply. I still don't understand few things:
How do you set the number 3 in this instruction local indices = perm:narrow(1, idx, math.min(batchSize, size - idx + 1))
? When idx is 1 I should get indices:size(1) = 32 but I get 3 instead.
If I remove some instruction from TenCrop function in such a way that I can get 32 crops of 4 images, do I need to change some instruction regarding the batchSize?
The batch size is divided by 10 and rounded down when doing 10 crops. This is to avoid going out of memory: https://github.com/facebook/fb.resnet.torch/blob/master/dataloader.lua#L50. So [[32/10]] = 3.
You probably want to change this line in dataloader.lua: https://github.com/facebook/fb.resnet.torch/blob/master/dataloader.lua#L47
Thanks a lot. A last question, I am printing the confusion matrix at the end of the training but when the TenCrops option is enabled I get this error: Wrong size for view. Input size: 32. Output size: 4x1
. I tried to add target to each crop
I added 8 times the same sample.target value to target in dataloader.lua
https://github.com/facebook/fb.resnet.torch/blob/master/dataloader.lua#L90
I disabled this instruction https://github.com/facebook/fb.resnet.torch/blob/master/train.lua#L127
to not change the output size
However I get an memory access error: THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-6377/cutorch/lib/THC/generic/THCStorage.c line=32 error=77 : an illegal memory access was encountered
There is something else I should change? Or maybe a better way to do this?
Looking better at the generated error, there seems to be an error when the flag are set: https://github.com/torch/cutorch/blob/master/lib/THC/generic/THCStorage.c#L158 But I can't understand why this happens. Any hint?
Thanks
Hi,
I have some trouble understanding exactly what happens when tenCrop is applied to the input. When I don't use the TenCrop option I have an input of 32 images with dimensions 3x224x224. When I enable this option I get an input of 30 images with dimensions 3x224x224. Why is this happening? How is the batch size set?