lmoroney / dlaicourse

Notebooks for learning deep learning
5.66k stars 5.36k forks source link

predict #34

Open HamidSayeed opened 5 years ago

HamidSayeed commented 5 years ago

why is it giving error when I'm trying to predict :

print(model.predict(x_test[5]))

ValueError: Error when checking input: expected flatten_3_input to have 3 dimensions, but got array with shape (28, 28)

JonathanSum commented 4 years ago

Hi, sorry that It is late. Could you show us which notebook? If you can, plz post the link here.

djthegr8 commented 4 years ago

The input takes (28,28,1) However, your model is 28,28 All you gotta do is turn your x_test[5] to a tf.tensor of shape (28,28,1) print(model.predict(tf.tensor(x_test[5],[28,28,1]))); Hope that helped