I have a folder with 38000 images and I'm trying to create a dataset from them to use in a Convolutional LSTM, which supports input in the format of a 5d array (B,T,W,H,C) where B is the number of samples, T is the size of the samples and the rest of the array are the image properties. So far I've managed to create a numpy array using the following code: path = input("folder: ") training_data = [] 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,(64,64)) training_data.append([pic]) np.save(os.path.join(path,'dataset'),np.array(training_data)) With this code I can create an array with the shape (38000, 1, 64, 64, 3). Using as an example data from other datasets such as Moving MNIST I could see that it is an array with the shape (10000, 20, 64, 64, 1) which means that it contains 10000 sequences of images each of length 20. How can I create an array from my data that contains image sequences like Moving MNIST? To clarify, I need to create an array with my 38000 images divided into sequences of 10 resulting in an array with the shape (3800, 10, 64, 64, 3) - 3800 sequences each of length 10 - Continue reading...