I have a problem about number of images in my python code. I use splitfolders for splitting images data to folder. There is missing images between number of images in this folder to number of images found by flow_from_directory libs
Hi. First i want to split dataset to "train", test" and "val" folder with 0.7,0.1,0.2 this ratio. I used following code successfully
splitfolders.ratio("/kaggle/input/dangerous-insects-dataset/farm_insects", output="/kaggle/working/dangerous-insects-dataset", seed=1337, ratio=(0.7,0.1,0.2), group_prefix=None, move=False)
Copying files: 1591 files [00:02, 563.15 files/s]
This code process 1591 files and no problem.But after i use flow_from_directory lib like following code, it returns Found 948 images belonging to 15 classes. Found 15 images belonging to 15 classes. Found 332 images belonging to 15 classes. Total images 948 +15+332 = 1295
I can't understand why 1591-1295=296 images are missing.If you could help with this situation, I would greatly appreciate it
datagen = ImageDataGenerator(rotation_range=90,
brightness_range=[0.1, 0.7],
width_shift_range=0.5,
height_shift_range=0.5,
horizontal_flip=True,
vertical_flip=True,
validation_split=0.15,
preprocessing_function=preprocess_input) # VGG16 preprocessing
test_generator = ImageDataGenerator(preprocessing_function=preprocess_input) # VGG16 preprocessing
BATCH_SIZE = 14 #
traingen = datagen.flow_from_directory( directory="/kaggle/working/dangerous-insects-dataset/train",
target_size=(224, 224),
class_mode='categorical',
classes=class_names,
subset='training',
batch_size=BATCH_SIZE,
shuffle=False,
seed=42)
validgen = datagen.flow_from_directory( directory="/kaggle/working/dangerous-insects-dataset/val",
target_size=(224, 224),
class_mode='categorical',
classes=class_names,
subset='validation',
batch_size=BATCH_SIZE,
shuffle=False,
seed=42)
testgen = test_generator.flow_from_directory(directory="/kaggle/working/dangerous-insects-dataset/test",
target_size=(224, 224),
class_mode=None,
classes=class_names,
batch_size=1,
shuffle=False,
seed=42)
Found 948 images belonging to 15 classes. Found 15 images belonging to 15 classes. Found 332 images belonging to 15 classes.