Disclaimer: I have very little experience with Tensorflow.
I have a custom dataset with 20 categories with 100+ images in each. I am doing 5-fold cross validation using InceptionV3 for transfer learning. The easiest way to load this dataset into Tensorflow that I was able to find was flow_from_directory
. The method works for one fold, but not for 5 folds since you can't set the folds. How would I go about dividing up the generators into 5 folds? Should I use an alternative method of importing data instead of flow_from_directory
? There was a similar question where the answer was seemingly just importing it in a different way.
from tensorflow.keras.preprocessing.image import ImageDataGenerator
datagen=ImageDataGenerator(preprocessing_function=preprocess_input,
validation_split=0.2)
train_generator=datagen.flow_from_directory('/content/dataset',
target_size=(299,299),
color_mode='rgb',
batch_size=32,
class_mode='categorical',
shuffle=True,
subset='training')
val_generator = datagen.flow_from_directory('/content/dataset',
target_size=(299,299),
color_mode='rgb',
batch_size=32,
class_mode='categorical',
shuffle=True,
subset='validation')