text_plain_output_1.png
from sklearn.model_selection import train_test_split

from tensorflow.keras.preprocessing.image import ImageDataGenerator

import glob

import pandas as pd

breast_img = glob.glob('/kaggle/input/breast-histopathology-images/IDC_regular_ps50_idx5/**/*.png', recursive=True)
data = pd.read_csv('/kaggle/input/selected-images/selected_images.csv')

train_data, val_data = train_test_split(data, test_size=0.3, random_state=42)
val_data, test_data = train_test_split(val_data, test_size=0.5, random_state=42)
datagen = ImageDataGenerator(rescale=1.0 / 255)
target_size = (50, 50)
batch_size = 32
train_generator = datagen.flow_from_dataframe(dataframe=train_data, x_col='path', y_col='label', target_size=target_size, batch_size=batch_size, class_mode='raw')
val_generator = datagen.flow_from_dataframe(dataframe=val_data, x_col='path', y_col='label', target_size=target_size, batch_size=batch_size, class_mode='raw')
test_generator = datagen.flow_from_dataframe(dataframe=test_data, x_col='path', y_col='label', target_size=target_size, batch_size=batch_size, class_mode='raw')