I have a CNN model, which input image size is (150, 150). I want to feed array-like data for predict function (tensorflow) like this:
fig = plt.figure(figsize=(1.5, 1.5))
plt.plot(time_values, signal_values, '-o', c='r')
plt.axis('off')
fig.canvas.draw()
data = np.frombuffer(fig.canvas.tostring_rgb(), dtype=np.uint8)
data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
And when I try:
CNN_model.predict(data)
I get an error:
WARNING:tensorflow:Model was constructed with shape (None, 150, 150, 3) for input Tensor("input_1:0", shape=(None, 150, 150, 3), dtype=float32), but it was called on an input with incompatible shape (None, 150, 3).
Traceback (most recent call last):
Why my shape is (None, 150, 3), but not (None, 150, 150, 3)?
data.reshape((1, 150, 150, 3))