1
I have a series of images (12500 in total) in rgb format and I want to create a dataset to work on Keras. I want to leave them in a format similar to the Mnist dataset...with Shape (12500,50,50).
Only when I do a reshape with the numpy it gets dimension (5,50,50,1). I believe it is getting an extra dimension due to the fact that my images are with 3 channels (r,g and b).
How I make my dataset stick to the dimensions (12500,50,50) with only one color channel?
Below, follow my code.
Grateful for the attention.
import cv2
import glob
import numpy as np
X_data = []
files = glob.glob ("C:/Teste_datasets/PetImages/Cat/*.jpg")
for myFile in files:
print(myFile)
image = cv2.imread (myFile)
X_data.append (image)
X_data = np.array(X_data).reshape(-1,50, 50,1 )