CSAILVision / places365

The Places365-CNNs for Scene Classification
http://places2.csail.mit.edu/
MIT License
1.9k stars 534 forks source link

issue with black&white images #29

Closed xlxlcyRuSReXxlxl closed 6 years ago

xlxlcyRuSReXxlxl commented 7 years ago

Hi all! I am dealing with a very annoying issue and as I am new at Python I don't know how to go thought. Shortly I am running places365 over many images, and it looks that it can't handle with black and white images, since I got the following error: RuntimeError: Need input of dimension 4 and input.size[1] == 3 but got input to be of shape: [1 x 1 x 224 x 224] at /pytorch/torch/lib/THNN/generic/SpatialConvolutionMM.c:47 As I would not want to delete all the black and white images, could someone suggest me few lines of code that would solve the problem? Thanks!

xuzhentao commented 6 years ago

I meet the same problem. Did you solve it?

zhoubolei commented 6 years ago

you just add an if check, if it is black and white, you duplicate channel three times for RGB