I am trying to create a custom dataset for a Deep Learning project using jpg images. I need to read them all in one batch. Doing so using the code below, but my array shape is (100, 1, 224, 224, 3) instead of (100,224, 224, 3). Any suggestions?
path = '/content/drive/My Drive/Dataset/Training'
X=[]
for img in os.listdir(path):
pic = cv2.imread(os.path.join(path,img))
pic = cv2.cvtColor(pic,cv2.COLOR_BGR2RGB)
pic = cv2.resize(pic,(224,224))
X.append([pic])
X=np.array(X)
print(X.shape)
(100, 1, 224, 224, 3)
X.append(pic)It's the [] that are adding the size 1 dimension.