application_vnd.jupyter.stderr_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))
#Add an Axes to the figure as part of a subplot arrangement(Three integers (nrows, ncols, index).)
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")

fig = plt.figure(figsize=(10, 7))
fig.add_subplot(2, 2, 1)
img_1 = random_image(val_dir='./output/val/', val_class='3. Atopic Dermatitis - 1.25k')
fig.add_subplot(2, 2, 2)
img_2 = random_image(val_dir='./output/val/', val_class='6. Benign Keratosis-like Lesions (BKL) 2624')
fig.add_subplot(2, 2, 3)
img_3 = random_image(val_dir='./output/val/', val_class='7. Psoriasis pictures Lichen Planus and related diseases - 2k')
fig.add_subplot(2, 2, 4)
img4 = random_image(val_dir='./output/val/', val_class='10. Warts Molluscum and other Viral Infections - 2103')