SRGAN-tensorflow
SRGAN-tensorflow copied to clipboard
ValueError: too many values to unpack
Traceback (most recent call last):
File "main.py", line 168, in <module>
inference_data = inference_data_loader(FLAGS)
File "/home/ubuntu/SRGAN-tensorflow/lib/model.py", line 210, in inference_data_loader
image_LR = [preprocess_test(_) for _ in image_list_LR]
File "/home/ubuntu/SRGAN-tensorflow/lib/model.py", line 202, in preprocess_test
h, w = im.shape
ValueError: too many values to unpack
What's this error caused by, and how do I resolve it?
I think the reason is that I assumed there would be only gray scale and color image. Therefore, I simply check whether the last dimension is 3 or not. Can you provide im.shape when the error message occurred so that I can take it into consideration?
Using ImageMagick I figured out that the input image I was trying to use, had an sRGB color space instead of an RGB color space.
To solve this issue in another project, I used code like this:
import scipy.ndimage as spi
spi.imread(org_content, mode="RGB").astype(float)/256
to make sure that every input image was read as an RGB image.
My fix used the scipy library:
sudo pip install scipy
Source: https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.misc.imread.html
Maybe something like my fix with scipy, could work for SRGAN-tensorflow?
Maybe I can add it into SRGAN later. Still busy now@@
Fix here #17