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

ValueError: could not broadcast input array from shape (3,32,32) into shape (3,64,64) #25

Open
shreyaspalve opened this issue Apr 10, 2018 · 7 comments

Comments

@shreyaspalve
Copy link

C:\Users\Shreyas\Image-Super-Resolution\Image-Super-Resolution>python tests.py
Using TensorFlow backend.
2018-04-10 12:19:18.301435: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Training model : ImageSuperResolutionModel
Epoch 1/250
Found 364 images.
Traceback (most recent call last):
File "tests.py", line 48, in
sr.fit(nb_epochs=250)
File "C:\Users\Shreyas\Image-Super-Resolution\Image-Super-Resolution\models.py", line 516, in fit
return super(ImageSuperResolutionModel, self).fit(batch_size, nb_epochs, save_history, history_fn)
File "C:\Users\Shreyas\Image-Super-Resolution\Image-Super-Resolution\models.py", line 122, in fit
validation_steps=val_count // batch_size + 1)
File "C:\Users\Shreyas\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "C:\Users\Shreyas\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training.py", line 2192, in fit_generator
generator_output = next(output_generator)
File "C:\Users\Shreyas\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\utils\data_utils.py", line 793, in get
six.reraise(value.class, value, value.traceback)
File "C:\Users\Shreyas\AppData\Local\Programs\Python\Python36\lib\site-packages\six.py", line 693, in reraise
raise value
File "C:\Users\Shreyas\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\utils\data_utils.py", line 658, in _data_generator_task
generator_output = next(self._generator)
File "C:\Users\Shreyas\Image-Super-Resolution\Image-Super-Resolution\img_utils.py", line 300, in image_generator
batch_x[i] = img.transpose((2, 0, 1))
ValueError: could not broadcast input array from shape (3,32,32) into shape (3,64,64)
@titu1994 can you please help for solving this issue?

@Combo819
Copy link

It seems that I have solved this problem. I change the parameters of "def create_model(self, height=32, width=32, channels=3, load_weights=False, batch_size=128) " into "def create_model(self, height=64, width=64, channels=3, load_weights=False, batch_size=128)". @shreyaspalve

@hj950815
Copy link

l meet this problem.maybe this is about the type of input images,l use img = cv2.resize(img, (64,64,3)) like this. but actually no help. can you give me some help

@Combo819
Copy link

@hj950815 I am sorry. I haven't reviewed this project for almost 4 months, and I almost forget everything. Just try exactly what I said in the comment, and see whether it will work. I use the images provided in this repository, and everything goes well.

@Tapani-
Copy link

Tapani- commented Oct 26, 2018

@hj950815:
The fix suggested by @Combo819 worked for me.
(But instead of changing the default parameters I changed my create_model call to pass width=64 and height=64.)

@rafariva
Copy link

@Combo819 in what line? in what file? no lucky. i have the same error. no lucky yet

@mfatimah
Copy link

@hj950815:
The fix suggested by @Combo819 worked for me.
(But instead of changing the default parameters I changed my create_model call to pass width=64 and height=64.)

Neither of the suggestions worked for me. Did anyone find another solution?

@mfatimah
Copy link

I found the solution. Probably a dumb mistake. I hadn't set true_upscaling as False.

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

No branches or pull requests

6 participants