text_plain_output_1.png
import glob

import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
import glob
glob.glob('../input/skin-cancer-mnist-ham10000/*')

images_path = glob.glob('../input/skin-cancer-mnist-ham10000/HAM10000_images_part_1/*')
img_id = []
for i in images_path:
    img_id.append(i.split('/')[4].split('.')[0])

data = pd.read_csv('../input/skin-cancer-mnist-ham10000/HAM10000_metadata.csv')

full_name_cancer_dict = {'akiec': "Bowen's disease", 'bcc': 'basal cell carcinoma', 'bkl': 'benign keratosis-like lesions', 'df': 'dermatofibroma', 'mel': 'melanoma', 'nv': 'melanocytic nevi', 'vasc': 'vascular lesions'}

img_with_class = data.loc[:, ['image_id', 'dx']].to_dict('list')

img_with_class.keys()

img_to_class = {img_id: full_name_cancer_dict[disease] for img_id, disease in zip(img_with_class['image_id'], img_with_class['dx'])}

random = np.random.choice(list(img_to_class.keys()), 10)
{i: img_to_class[i] for i in random}

inter_data_id = set(img_to_class.keys()).intersection(set(img_id))
len(inter_data)

def compelete_path(id_images, path):
    full_paths = [path + i + '.jpg' for i in id_images]
    return full_paths

full_paths = compelete_path(inter_data_id, '../input/skin-cancer-mnist-ham10000/HAM10000_images_part_1/')
full_paths[:5]

plt.figure(figsize=(10, 8))
for i in range(25):
    plt.subplot(5, 5, i + 1)
    plt.imshow(plt.imread(full_paths[i]))
    plt.axis('off')