'How to split the dataframe having images path as input and label as output for Training the CNN model

I'm using CNN model for Image Classification. My dataset has a folder and 5 sub-folders that has images of flowers in it. I have created the data frame where feature column has the path of each image and output column has the label in the form of dummy variable. I want to split this data frame for training the CNN model. Here, the dataset is imbalance. So, I have to use Stratified K-fold. But, I'm not getting how to do it. Can anyone please help.? Here is the image of my code.

enter image description here enter image description here



Solution 1:[1]

You can use tf.image.decode_jpeg(tf.io.read_file(path),channels=3) even use tfDataset.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TFer