I'm performing multiclass image classification using "xception" model and fine-tuning it. I don't have a large quantity of data so I am doing data augmentation thanks to flow_image_from_directory.
To make sure everything runs properly before applying it to my whole dataset with many augmentations, I have tried my code with no augmentation apart from a simple "rescale" and applied it to 20 pictures (5 for each of the 4 classes I have).
my_train_generator <- image_data_generator(rescale = 1/255,
validation_split = 1/5)
my_train_images <- flow_images_from_directory(directory = my_train_directory,
generator = my_train_generator,
target_size = c(width, height),
color_mode = "rgb",
batch_size = my_batch_size,
class_mode = "categorical",
shuffle = FALSE,
save_to_dir = my_augm_train_directory,
save_format = "jpeg",
subset = 'training')
my_validation_images <- flow_images_from_directory(directory = my_train_directory,
generator = my_train_generator,
target_size = c(width, height),
color_mode = "rgb",
class_mode = "categorical",
batch_size = my_batch_size,
shuffle = FALSE,
save_to_dir = my_augm_val_directory,
save_format = "jpeg",
subset = 'validation')
However, thanks to the "save_to_dir" option, I see that the number of pictures generated throughout the fitting isn't as expected :
- train & validation split is 1/5 --> train set is 16 images (4 per class) and validation set is 4 images (1 per class)
- batch = 1 and epoch = 1
Based on that, I should have 16 images in the file generated from augmentation of the train set, and 4 images in the one generated from validation. I actually have respectively 36 and 5... Additionally, there are no transformation apart from "rescale" applied to the images in the file based on train set, but some of the 5 augmented validation images are flipped.
I am lost here, so many thanks in advance for your help :)