text_plain_output_1.png
from sklearn.model_selection import train_test_split

import os

import pandas as pd

image_dir = '/kaggle/input/plant-pathology-2020-fgvc7/images'
image_files = os.listdir(image_dir)
image_paths = [os.path.join(image_dir, filename) for filename in image_files]

import pandas as pd
test_labels = pd.read_csv('/kaggle/input/plant-pathology-2020-fgvc7/test.csv')
test_image_ids = test_labels['image_id'].values

train_labels = pd.read_csv('/kaggle/input/plant-pathology-2020-fgvc7/train.csv')
train_labels = train_labels[['healthy', 'multiple_diseases', 'rust', 'scab']]
train_labels = train_labels.values

from sklearn.model_selection import train_test_split
train_image_paths = [path for path in image_paths if 'Train' in path]
test_image_paths = [path for path in image_paths if 'Test' in path]
train_image_paths, valid_image_paths, train_labels, valid_labels = train_test_split(train_image_paths, train_labels, test_size=0.2, random_state=123)
print('Train Samples:', len(train_image_paths))
print('Validation Samples:', len(valid_image_paths))
print('Test Samples:', len(test_image_paths))