Eslam Muhammad
Eslam Muhammad

Reputation: 77

How to reshape image to specific dimentions

I'm trying to send images to my model but the images are in different shape than the model takes .

ValueError                                Traceback (most recent call 
last)
<ipython-input-5-d3bd0e2a98e0> in <module>()
257 
258 else:
--> 259     model.fit({'input': X_train}, {'targets': y_train}, 
n_epoch=10,snapshot_step=500)
260     model.save('modelvgg.tfl')
261 
ValueError: Cannot feed value of shape (64, 224, 224) for Tensor ' 
input/X:0', which has shape '(?, 224, 224, 3)'

all i want to know how to fit those dimensions but i have no idea how .

Upvotes: 0

Views: 106

Answers (1)

gerwin
gerwin

Reputation: 909

You are missing the last dimension in your input, this is the number of channels. The model expects 3 channels - most likely for RGB. The images you are feeding have only a single channel, they are most likely grayscale. If you simply do not have the RGB-images, try duplicating the channel dimension 3 times over using np.repeat.

Upvotes: 1

Related Questions