I'm using model.fit_generator() to predict images. i keep on receiving the following error:
ValueError: Error when checking input: expected conv2d_29_input to have 4 dimensions, but got array with shape (224, 224, 3) I'm trying to save the predicted images to a folder.
following is my code:
data_list = []
batch_index = 0
while batch_index <= train_generator.batch_index:
data = next(train_generator)
data_list.append(data[0])
batch_index = batch_index + 1
for i in range(batch_index):
for j in range(batch_size):
predicted[i][j]= model.predict(data_list[i] [j])
plt.imsave(os.path.join(path,'new_image'+ str(i)+ str(j)+ "_AE_.tiff"), predicted[i][j])
what is the problem with the shape?? thanks