Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in caffe.io.resize_image when applied to images with 2 or >3 channels #3070

Merged
merged 1 commit into from
Sep 16, 2015

Conversation

mohomran
Copy link
Contributor

When applying caffe.io.resize_image to an image that has neither 1 nor 3 channels, the scaling factor is incorrectly computed due to the use of integer division.

Code for reproducing the bug:

import sys
caffe_root = #<CAFFE_ROOT>
sys.path.insert(0, caffe_root + 'python')
import caffe
im = caffe.io.load_image(caffe_root + 'examples/images/cat.jpg')
print "original RGB image shape:", im.shape                                          # (360, 480, 3)
print "resized RGB image shape:", caffe.io.resize_image(im, [100,100]).shape         # (100, 100, 3)
print "original RG image shape:", im[:,:,:2].shape                                   # (360, 480, 2)
print "resized RG image shape:", caffe.io.resize_image(im[:,:,:2], (100,100)).shape  # (0, 0, 2)

@mohomran mohomran changed the title bug in caffe.io.resize_image when applied to images with 2 or >3 dimensions bug in caffe.io.resize_image when applied to images with 2 or >3 channels Sep 15, 2015
@jeffdonahue
Copy link
Contributor

Thanks @mohomran!

jeffdonahue added a commit that referenced this pull request Sep 16, 2015
bug in caffe.io.resize_image when applied to images with 2 or >3 channels
@jeffdonahue jeffdonahue merged commit 71e0587 into BVLC:master Sep 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants