Skip to content
Advertisement

Keras CNN Model Typevalue errors when using predict method

I am have a keras model that is supposed to take a (150, 150, 1) grayscale image as it’s input and output an array of length 8.

Here is my model code:

JavaScript

When I try to use the .predict() method, I get this error:

JavaScript

I had an ANN (non-CNN) model running earlier that was working fine. When I did some research I could find anything about this error either.

Here is the code I am using to make the prediction:

JavaScript

Here are my version numbers:

tensorflow: 1.5.0

python: 3.69

numpy: 1.19.5

Ubuntu: 18.04

Let me know if theres any other info I can provide! Thanks!

Answer

Replacing tf.expand_dim() with np.expand_dim() fixed it!

Advertisement

Answer

This seems to run perfectly fine on TF 1.15:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement