Basically my issue is that im building an image classification model using AlexNet. I have this pre-split dataset thats already split into training, test, validation. However the issue is that these splits are in .txt files (e.g. trainingsplit.txt) and inside the .txt file is a list of image_001.png files etc. How do I extract this data and pass it through my preprocessor? This is what I would normally do for preprocessing:
train_dir = '/content/gdrive/My Drive/alexNet/Training' validation_dir = '/content/gdrive/My Drive/alexNet/Validation' train_datagen = ImageDataGenerator( rescale=1./255, rotation_range=40, width_shift_range=0.2, height_shift_range=0.2, shear_range=0.2, zoom_range=0.2, horizontal_flip=True, fill_mode='nearest', ) test_datagen = ImageDataGenerator(rescale=1./255) train_generator = train_datagen.flow_from_directory( train_dir, # This is the source directory for training images target_size=(224, 224), batch_size=20, class_mode='binary') validation_generator = test_datagen.flow_from_directory( validation_dir, target_size=(224, 224), batch_size=20, class_mode='binary')
Edit: Content of training.txt
image_001.jpg image_002.jpg image_014.jpg image_017.jpg etc.
The training data is a .txt file containing several rows of text, which are the names of different images. This txt file is inside the main directory Dataset, which contains class directories like Apples, Bananas, Oranges, etc.