text_plain_output_1.png
import matplotlib.image as mping

import matplotlib.pyplot as plt

import os

import random

import splitfolders

os.makedirs('output')
os.makedirs('output/train')
os.makedirs('output/val')
os.makedirs('output/test')
loc = '/kaggle/input/skin-diseases-image-dataset/IMG_CLASSES'
splitfolders.ratio(loc, output='output', ratio=(0.8, 0.1, 0.1))

def random_image(val_dir, val_class):
    folder = val_dir + val_class
    random_image = random.sample(os.listdir(folder), 1)
    img = mping.imread(folder + '/' + random_image[0])
    return img

fig = plt.figure(figsize=(10, 7))
fig.add_subplot(2, 2, 1)
img_1 = random_image(val_dir='./output/val/', val_class='2. Melanoma 15.75k')
fig.add_subplot(2, 2, 2)
img_2 = random_image(val_dir='./output/val/', val_class='4. Basal Cell Carcinoma (BCC) 3323')
fig.add_subplot(2, 2, 3)
img_3 = random_image(val_dir='./output/val/', val_class='5. Melanocytic Nevi (NV) - 7970')
fig.add_subplot(2, 2, 4)
img4 = random_image(val_dir='./output/val/', val_class='1. Eczema 1677')