text_plain_output_1.png
import os

import pandas as pd

root = '../input/104-flowers-garden-of-eden'
train_df = pd.DataFrame()
folder = os.listdir(root)
for f in folder:
    classes = os.listdir(os.path.join(root, f, 'train'))
    for c in classes:
        images = os.listdir(os.path.join(root, f, 'train', c))
        tmp_df = pd.DataFrame(images, columns=['image_name'])
        tmp_df['class'] = c
        tmp_df['folder'] = f
        tmp_df['type'] = 'train'
        train_df = train_df.append(tmp_df, ignore_index=True)
print('train:', train_df.shape)
val_df = pd.DataFrame()
folder = os.listdir(root)
for f in folder:
    classes = os.listdir(os.path.join(root, f, 'val'))
    for c in classes:
        images = os.listdir(os.path.join(root, f, 'val', c))
        tmp_df = pd.DataFrame(images, columns=['image_name'])
        tmp_df['class'] = c
        tmp_df['folder'] = f
        tmp_df['type'] = 'val'
        val_df = val_df.append(tmp_df, ignore_index=True)
print('val:', val_df.shape)