text_html_output_1.png
from sklearn.utils import shuffle

import os

import pandas as pd

covid_path = '/kaggle/input/covid19/COVID-19_Radiography_Dataset/COVID/images/'
normal_path = '/kaggle/input/covid19/COVID-19_Radiography_Dataset/Normal/images/'

base_dir = 'base_dir'
os.mkdir(base_dir)
train_dir = os.path.join(base_dir, 'train_dir')
os.mkdir(train_dir)
val_dir = os.path.join(base_dir, 'val_dir')
os.mkdir(val_dir)
test_dir = os.path.join(base_dir, 'test_dir')
os.mkdir(test_dir)
Normal = os.path.join(train_dir, 'Normal')
os.mkdir(Normal)
COVID = os.path.join(train_dir, 'COVID')
os.mkdir(COVID)
Normal = os.path.join(val_dir, 'Normal')
os.mkdir(Normal)
COVID = os.path.join(val_dir, 'COVID')
os.mkdir(COVID)
Normal = os.path.join(test_dir, 'Normal')
os.mkdir(Normal)
COVID = os.path.join(test_dir, 'COVID')
os.mkdir(COVID)

folder_1 = os.listdir(covid_path)
folder_1 = shuffle(folder_1)
folder_2 = os.listdir(normal_path)
folder_2 = shuffle(folder_2)

covid_data = pd.DataFrame(folder_1, columns=['FILE NAME'])
normal_data = pd.DataFrame(folder_2, columns=['FILE NAME'])
covid_data['Target'] = 'COVID'
normal_data['Target'] = 'Normal'
covid_data['Labels'] = '0'
normal_data['Labels'] = '1'
data = pd.concat([covid_data, normal_data], axis=0, sort=False)
data