caffe icon indicating copy to clipboard operation
caffe copied to clipboard

bug cropping in data layer

Open rosenfeldamir opened this issue 11 years ago • 3 comments

Cropping an image the same size of the original results in a crash: I have created a leveldb where all the images have been resized to 227. In the data layer, I have defined the crop_size to be 227 as well. This results in a crash upon starting the training process : "Floating point exception (core dumped) When I chage the crop_size to 226 it runs fine. As a sanity check, changing it to 228 also crashes, but more gracefully, with a message about the datum size being incompatible with the crop size. Thanks, -Amir

rosenfeldamir avatar Mar 03 '15 14:03 rosenfeldamir

I think the requirement is your crop size to be smaller than your image size. That is why when you have image size = 227, crop size >=227 it crashes. Try to resize the image to 256 and crop to 227. I think that is the standard AlexNet cropping.

n-zhang avatar Mar 12 '15 23:03 n-zhang

Sounds a bit odd, what If I am interested in the entire image? Why do I need to "waste" one pixel on the crop? Or is there a way to avoid the cropping altogether?

rosenfeldamir avatar Mar 13 '15 07:03 rosenfeldamir

If you don't want to crop, then don't set the crop field. https://github.com/BVLC/caffe/blob/master/src/caffe/proto/caffe.proto#L346-L347

On Fri, Mar 13, 2015 at 12:37 AM, Amir Rosenfeld [email protected] wrote:

Sounds a bit odd, what If I am interested in the entire image? Why do I need to "waste" one pixel on the crop? Or is there a way to avoid the cropping altogether?

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/2019#issuecomment-78850028.

shelhamer avatar Mar 13 '15 07:03 shelhamer