I am trying to load some JPGs into a GAN and I’ve already imported train_test_split. I have a folder of training/testing data on my desktop called ‘input_data’. Inside the folder are two subfolders, Test and Train. Inside the Test and Train folders are Images1 and Images2.
I’m a Python beginner so I’d really appreciate some advice. What am I doing wrong here?
def loadImages(path): # return array of images imagesList = listdir(path) loadedImages =  for image in imagesList: img = PImage.open(path + image) loadedImages.append(img) return loadedImages path = "input_data" for filename in os.listdir(path): content = open(os.path.join(path, filename), mode='rb').read() with open(path, 'rb') as fh: # your images in an array imgs = loadImages(path) def loadImages(): (x_train, y_train), (x_test, y_test) = loadImages() x_train = (x_train.astype(np.float32) - 127.5)/127.5 x_train = x_train.reshape(60000, 784) return (x_train, y_train, x_test, y_test)
Traceback(most recent call last):File"gan3.py", line 31,in\<module\>with open(path,'rb')as fh:IsADirectoryError:[Errno21]Is a directory:'input\_data/Train'