text_plain_output_1.png
import os

import shutil

MAIN_DIR = '/kaggle/input/bach-breast-cancer-histology-images/ICIAR2018_BACH_Challenge/ICIAR2018_BACH_Challenge/Photos'

BASE_DIR = '/kaggle/working/bach-train'
TRAIN_DIR = os.path.join(BASE_DIR, 'training')
VAL_DIR = os.path.join(BASE_DIR, 'validation')
TEST_DIR = os.path.join(BASE_DIR, 'test')
if os.path.exists(BASE_DIR):
    shutil.rmtree(BASE_DIR)
os.makedirs(BASE_DIR)
os.makedirs(TRAIN_DIR)
os.makedirs(VAL_DIR)
os.makedirs(TEST_DIR)

bc_types = [file for file in os.listdir(MAIN_DIR) if os.path.isdir(os.path.join(MAIN_DIR, file))]
print('Types: ', bc_types)
bc_dict = {'InSitu': 2, 'Benign': 1, 'Normal': 0, 'Invasive': 3}
print('Encode: ', bc_dict)
dict_bc = {0: 'Normal', 1: 'Benign', 2: 'InSitu', 3: 'Invasive'}
print('Decode: ', dict_bc)