SRGAN-tensorflow icon indicating copy to clipboard operation
SRGAN-tensorflow copied to clipboard

ValueError: too many values to unpack

Open ProGamerGov opened this issue 7 years ago • 5 comments
trafficstars

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?

ProGamerGov avatar Dec 05 '17 00:12 ProGamerGov

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?

brade31919 avatar Dec 06 '17 10:12 brade31919

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.

ProGamerGov avatar Dec 06 '17 22:12 ProGamerGov

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?

ProGamerGov avatar Dec 06 '17 22:12 ProGamerGov

Maybe I can add it into SRGAN later. Still busy now@@

brade31919 avatar Dec 19 '17 09:12 brade31919

Fix here #17

Martan404 avatar May 29 '18 15:05 Martan404