I am trying to convert 100 images into a numpy array, which in turn will be fed into my neural network. My NN is training data was a 4D numpy array (No of Images, 32, 32, 3). When using below code to read images and feed into model.predict() i am getting following error.
"Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (100, )"
This is the code i have written:
'''new_data = []
files = glob.glob (r"load images")
for myFile in files:
#print(myFile)
image = cv2.imread(myFile)
new_data.append(np.asarray(image))
#new_data = np.array(new_data)
print('new_data shape:', np.array(new_data).shape)'''
Output is "new_data shape: (100,)"
I am expecting new_data dimention to be (100, 32, 32, 3). Please help on how to achieve this.
Thanks, Mrinal