I am currently using Facenet to build a facial Detection and recognition application. The first part takes images from the webcam, detects the Face of the person from the webcam using the MTCNN model. After that it stores the images in a folder. Then I decided to use ImageDataGenerator in that folder to create more images for the dataset, but by datagen gives the resultant images in grayscale format. Here's the code for it:
datagen = ImageDataGenerator(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',rescale=False)
This is the flow function:
for train_img in train_images:
img = image.img_to_array(train_img) # convert image to numpy array
img = img.reshape((1,) + img.shape) # reshape image
i = 0
datagen.fit(img)
for batch in datagen.flow(img, save_format='png',save_to_dir=train_path): # this loops runs forever until we break, saving images to current directory with specified prefix
i += 1
if i > 10: # Make 10 Augmentation of every Images
break
Please help.