image_output_2.png image_output_1.png
import cv2

import matplotlib.pyplot as plt

import os

import os

import numpy as np
import pandas as pd
import os

import numpy as np
import pandas as pd
import os
import keras
from keras.layers import Conv2D, MaxPool2D, Flatten, Dense, Dropout, BatchNormalization
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras import regularizers
from sklearn.model_selection import train_test_split
import cv2
import matplotlib.pyplot as plt
import seaborn as sns
from keras.applications import VGG16
from keras import models
from keras import layers
from keras import optimizers

os.listdir('../input/isl-dataset-double-handed')

train_dir = '../input/isl-dataset-double-handed/ISL_Dataset'

def load_unique():
    size_img = (224, 224)
    images_for_plot = []
    labels_for_plot = []
    for folder in os.listdir(train_dir):
        for file in os.listdir(train_dir + '/' + folder):
            filepath = train_dir + '/' + folder + '/' + file
            image = cv2.imread(filepath)
            final_img = cv2.resize(image, size_img)
            final_img = cv2.cvtColor(final_img, cv2.COLOR_BGR2RGB)
            images_for_plot.append(final_img)
            labels_for_plot.append(folder)
            break
    return (images_for_plot, labels_for_plot)
images_for_plot, labels_for_plot = load_unique()
print('unique_labels = ', labels_for_plot)
fig = plt.figure(figsize=(15, 15))
def plot_images(fig, image, label, row, col, index):
    fig.add_subplot(row, col, index)
    plt.axis('off')
    plt.imshow(image)
    plt.title(label)
    return
image_index = 0
row = 4
col = 6
for i in range(1, 25):
    plot_images(fig, images_for_plot[image_index], labels_for_plot[image_index], row, col, i)
    image_index = image_index + 1
plt.show()