text_plain_output_100.png text_plain_output_334.png text_plain_output_445.png text_plain_output_201.png text_plain_output_261.png text_plain_output_565.png text_plain_output_522.png text_plain_output_84.png text_plain_output_521.png text_plain_output_322.png text_plain_output_205.png text_plain_output_511.png text_plain_output_271.png text_plain_output_56.png text_plain_output_475.png text_plain_output_158.png text_plain_output_455.png text_plain_output_223.png text_plain_output_218.png text_plain_output_264.png text_plain_output_282.png text_plain_output_396.png text_plain_output_287.png text_plain_output_232.png text_plain_output_181.png text_plain_output_137.png text_plain_output_139.png text_plain_output_362.png text_plain_output_35.png text_plain_output_501.png text_plain_output_258.png text_plain_output_452.png text_plain_output_130.png text_plain_output_490.png text_plain_output_449.png text_plain_output_462.png text_plain_output_117.png text_plain_output_286.png text_plain_output_367.png text_plain_output_262.png text_plain_output_278.png text_plain_output_395.png text_plain_output_254.png text_plain_output_307.png text_plain_output_570.png text_plain_output_98.png text_plain_output_399.png text_plain_output_236.png text_plain_output_195.png text_plain_output_471.png text_plain_output_219.png text_plain_output_420.png text_plain_output_514.png text_plain_output_485.png text_plain_output_237.png text_plain_output_43.png text_plain_output_284.png text_plain_output_187.png text_plain_output_309.png text_plain_output_78.png text_plain_output_143.png text_plain_output_106.png text_plain_output_37.png text_plain_output_138.png text_plain_output_544.png text_plain_output_192.png text_plain_output_426.png text_plain_output_184.png text_plain_output_477.png text_plain_output_274.png text_plain_output_172.png text_plain_output_332.png text_plain_output_147.png text_plain_output_443.png text_plain_output_327.png text_plain_output_256.png text_plain_output_90.png text_plain_output_79.png text_plain_output_331.png text_plain_output_5.png text_plain_output_550.png text_plain_output_75.png text_plain_output_48.png text_plain_output_388.png text_plain_output_422.png text_plain_output_116.png text_plain_output_128.png text_plain_output_30.png text_plain_output_167.png text_plain_output_213.png text_plain_output_73.png text_plain_output_126.png text_plain_output_492.png text_plain_output_321.png text_plain_output_272.png text_plain_output_115.png text_plain_output_474.png text_plain_output_407.png text_plain_output_482.png text_plain_output_316.png text_plain_output_355.png text_plain_output_15.png text_plain_output_390.png text_plain_output_133.png text_plain_output_437.png text_plain_output_198.png text_plain_output_387.png text_plain_output_555.png text_plain_output_548.png text_plain_output_178.png text_plain_output_226.png text_plain_output_154.png text_plain_output_234.png text_plain_output_375.png text_plain_output_404.png text_plain_output_114.png text_plain_output_515.png text_plain_output_157.png text_plain_output_494.png text_plain_output_317.png text_plain_output_251.png text_plain_output_470.png text_plain_output_496.png text_plain_output_423.png text_plain_output_70.png text_plain_output_9.png text_plain_output_484.png text_plain_output_44.png text_plain_output_325.png text_plain_output_203.png text_plain_output_505.png text_plain_output_119.png text_plain_output_546.png text_plain_output_540.png text_plain_output_373.png text_plain_output_504.png text_plain_output_86.png text_plain_output_244.png text_plain_output_118.png text_plain_output_551.png text_plain_output_131.png text_plain_output_40.png text_plain_output_343.png text_plain_output_123.png text_plain_output_74.png text_plain_output_190.png text_plain_output_302.png text_plain_output_31.png text_plain_output_340.png text_plain_output_379.png text_plain_output_281.png text_plain_output_20.png text_plain_output_557.png text_plain_output_273.png text_plain_output_263.png text_plain_output_102.png text_plain_output_229.png text_plain_output_111.png text_plain_output_414.png text_plain_output_461.png text_plain_output_510.png text_plain_output_222.png text_plain_output_101.png text_plain_output_530.png text_plain_output_169.png text_plain_output_531.png text_plain_output_144.png text_plain_output_161.png text_plain_output_489.png text_plain_output_305.png text_plain_output_275.png text_plain_output_301.png text_plain_output_132.png text_plain_output_60.png text_plain_output_467.png text_plain_output_502.png text_plain_output_221.png text_plain_output_564.png text_plain_output_552.png text_plain_output_330.png text_plain_output_155.png text_plain_output_434.png text_plain_output_68.png text_plain_output_4.png text_plain_output_65.png text_plain_output_64.png text_plain_output_419.png text_plain_output_215.png text_plain_output_532.png text_plain_output_189.png text_plain_output_415.png text_plain_output_13.png text_plain_output_200.png text_plain_output_107.png text_plain_output_567.png text_plain_output_398.png text_plain_output_312.png text_plain_output_248.png text_plain_output_318.png text_plain_output_417.png text_plain_output_52.png text_plain_output_545.png text_plain_output_393.png text_plain_output_572.png text_plain_output_66.png text_plain_output_446.png text_plain_output_243.png text_plain_output_45.png text_plain_output_380.png text_plain_output_442.png text_plain_output_300.png text_plain_output_257.png text_plain_output_405.png text_plain_output_353.png text_plain_output_476.png text_plain_output_277.png text_plain_output_457.png text_plain_output_361.png text_plain_output_171.png text_plain_output_518.png text_plain_output_561.png text_plain_output_431.png text_plain_output_14.png text_plain_output_159.png text_plain_output_32.png text_plain_output_516.png text_plain_output_304.png text_plain_output_88.png text_plain_output_240.png text_plain_output_29.png text_plain_output_359.png text_plain_output_529.png text_plain_output_347.png text_plain_output_140.png text_plain_output_376.png text_plain_output_280.png text_plain_output_129.png text_plain_output_349.png text_plain_output_242.png text_plain_output_483.png text_plain_output_460.png text_plain_output_363.png text_plain_output_289.png text_plain_output_255.png text_plain_output_160.png text_plain_output_58.png text_plain_output_329.png text_plain_output_49.png text_plain_output_63.png text_plain_output_260.png text_plain_output_294.png text_plain_output_27.png text_plain_output_392.png text_plain_output_320.png text_plain_output_177.png text_plain_output_386.png text_plain_output_438.png text_plain_output_76.png text_plain_output_333.png text_plain_output_108.png text_plain_output_54.png text_plain_output_142.png text_plain_output_10.png text_plain_output_269.png text_plain_output_276.png text_plain_output_6.png text_plain_output_326.png text_plain_output_503.png text_plain_output_153.png text_plain_output_170.png text_plain_output_92.png text_plain_output_57.png text_plain_output_120.png text_plain_output_469.png text_plain_output_24.png text_plain_output_357.png text_plain_output_21.png text_plain_output_344.png text_plain_output_104.png text_plain_output_270.png text_plain_output_47.png text_plain_output_466.png text_plain_output_568.png text_plain_output_121.png text_plain_output_25.png text_plain_output_134.png text_plain_output_523.png text_plain_output_401.png text_plain_output_77.png text_plain_output_421.png text_plain_output_288.png text_plain_output_535.png text_plain_output_527.png text_plain_output_488.png text_plain_output_18.png text_plain_output_183.png text_plain_output_266.png text_plain_output_149.png text_plain_output_208.png text_plain_output_50.png text_plain_output_36.png text_plain_output_383.png text_plain_output_207.png text_plain_output_391.png text_plain_output_413.png text_plain_output_96.png text_plain_output_87.png text_plain_output_3.png text_plain_output_217.png text_plain_output_418.png text_plain_output_427.png text_plain_output_180.png text_plain_output_556.png text_plain_output_141.png text_plain_output_210.png text_plain_output_112.png text_plain_output_152.png text_plain_output_225.png text_plain_output_191.png text_plain_output_259.png text_plain_output_447.png text_plain_output_290.png text_plain_output_506.png text_plain_output_283.png text_plain_output_495.png text_plain_output_247.png text_plain_output_113.png text_plain_output_371.png text_plain_output_479.png text_plain_output_324.png text_plain_output_22.png text_plain_output_188.png text_plain_output_366.png text_plain_output_328.png text_plain_output_81.png text_plain_output_69.png text_plain_output_368.png text_plain_output_372.png text_plain_output_175.png text_plain_output_165.png text_plain_output_542.png text_plain_output_146.png text_plain_output_145.png text_plain_output_125.png text_plain_output_454.png text_plain_output_487.png text_plain_output_338.png text_plain_output_197.png text_plain_output_512.png text_plain_output_382.png text_plain_output_315.png text_plain_output_429.png text_plain_output_38.png text_plain_output_517.png text_plain_output_433.png text_plain_output_7.png text_plain_output_528.png text_plain_output_214.png text_plain_output_166.png text_plain_output_358.png text_plain_output_513.png text_plain_output_314.png text_plain_output_410.png text_plain_output_432.png text_plain_output_411.png text_plain_output_91.png text_plain_output_308.png text_plain_output_245.png text_plain_output_16.png text_plain_output_497.png text_plain_output_174.png text_plain_output_212.png text_plain_output_230.png text_plain_output_265.png text_plain_output_430.png text_plain_output_435.png text_plain_output_378.png text_plain_output_59.png text_plain_output_409.png text_plain_output_206.png text_plain_output_103.png text_plain_output_71.png text_plain_output_539.png text_plain_output_8.png text_plain_output_122.png text_plain_output_384.png text_plain_output_498.png text_plain_output_211.png text_plain_output_182.png text_plain_output_26.png text_plain_output_554.png text_plain_output_536.png text_plain_output_406.png text_plain_output_310.png text_plain_output_456.png text_plain_output_541.png text_plain_output_558.png text_plain_output_220.png text_plain_output_543.png text_plain_output_109.png text_plain_output_459.png text_plain_output_238.png text_plain_output_520.png text_plain_output_41.png text_plain_output_34.png text_plain_output_253.png text_plain_output_346.png text_plain_output_291.png text_plain_output_168.png text_plain_output_394.png text_plain_output_204.png text_plain_output_241.png text_plain_output_231.png text_plain_output_533.png text_plain_output_345.png text_plain_output_350.png text_plain_output_209.png text_plain_output_185.png text_plain_output_85.png text_plain_output_42.png text_plain_output_110.png text_plain_output_549.png text_plain_output_67.png text_plain_output_508.png text_plain_output_468.png text_plain_output_370.png text_plain_output_297.png text_plain_output_53.png text_plain_output_313.png text_plain_output_224.png text_plain_output_193.png text_plain_output_441.png text_plain_output_403.png text_plain_output_23.png text_plain_output_173.png text_plain_output_235.png text_plain_output_151.png text_plain_output_89.png text_plain_output_299.png text_plain_output_51.png text_plain_output_450.png text_plain_output_252.png text_plain_output_296.png text_plain_output_525.png text_plain_output_28.png text_plain_output_72.png text_plain_output_99.png text_plain_output_381.png text_plain_output_571.png text_plain_output_163.png text_plain_output_179.png text_plain_output_537.png text_plain_output_162.png text_plain_output_136.png text_plain_output_246.png text_plain_output_2.png text_plain_output_569.png text_plain_output_239.png text_plain_output_127.png text_plain_output_559.png text_plain_output_311.png text_plain_output_500.png text_plain_output_295.png text_plain_output_279.png text_plain_output_507.png text_plain_output_509.png text_plain_output_337.png text_plain_output_562.png text_plain_output_499.png text_plain_output_196.png text_plain_output_342.png text_plain_output_563.png text_plain_output_97.png text_plain_output_227.png text_plain_output_453.png text_plain_output_1.png text_plain_output_33.png text_plain_output_150.png text_plain_output_39.png text_plain_output_176.png text_plain_output_335.png text_plain_output_186.png text_plain_output_233.png text_plain_output_228.png text_plain_output_473.png text_plain_output_385.png text_plain_output_478.png text_plain_output_55.png text_plain_output_412.png text_plain_output_293.png text_plain_output_268.png text_plain_output_436.png text_plain_output_199.png text_plain_output_354.png text_plain_output_463.png text_plain_output_360.png text_plain_output_319.png text_plain_output_82.png text_plain_output_356.png text_plain_output_202.png text_plain_output_93.png text_plain_output_336.png text_plain_output_19.png text_plain_output_439.png text_plain_output_341.png text_plain_output_105.png text_plain_output_465.png text_plain_output_80.png text_plain_output_491.png text_plain_output_94.png text_plain_output_164.png text_plain_output_249.png text_plain_output_534.png text_plain_output_444.png text_plain_output_216.png text_plain_output_124.png text_plain_output_17.png text_plain_output_148.png text_plain_output_323.png text_plain_output_402.png text_plain_output_424.png text_plain_output_486.png text_plain_output_250.png text_plain_output_11.png text_plain_output_481.png text_plain_output_560.png text_plain_output_526.png text_plain_output_400.png text_plain_output_524.png text_plain_output_538.png text_plain_output_12.png text_plain_output_267.png text_plain_output_553.png text_plain_output_408.png text_plain_output_425.png text_plain_output_428.png text_plain_output_416.png text_plain_output_194.png text_plain_output_519.png text_plain_output_62.png text_plain_output_480.png text_plain_output_303.png text_plain_output_377.png text_plain_output_440.png text_plain_output_95.png text_plain_output_339.png text_plain_output_458.png text_plain_output_464.png text_plain_output_156.png text_plain_output_547.png text_plain_output_298.png text_plain_output_369.png text_plain_output_348.png text_plain_output_448.png text_plain_output_364.png text_plain_output_365.png text_plain_output_61.png text_plain_output_352.png text_plain_output_83.png text_plain_output_374.png text_plain_output_472.png text_plain_output_566.png text_plain_output_397.png text_plain_output_389.png text_plain_output_292.png text_plain_output_351.png text_plain_output_135.png text_plain_output_285.png text_plain_output_306.png text_plain_output_493.png text_plain_output_46.png
import matplotlib.pyplot as plt

import tensorflow as tf

import os
import cv2
import pickle
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import tensorflow as tf
from tqdm import tqdm
from sklearn.preprocessing import OneHotEncoder
from sklearn.metrics import confusion_matrix
from keras.models import Model, load_model
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.models import Sequential
from tensorflow.keras import layers
from tensorflow.keras import activations
from tensorflow.keras.layers import Dense, Input, Conv2D, MaxPool2D, Flatten, Activation, Dropout, BatchNormalization
import glob
import skimage
plt.rc('font', size=14)
plt.rc('axes', labelsize=14, titlesize=14)
plt.rc('legend', fontsize=14)
plt.rc('xtick', labelsize=10)
plt.rc('ytick', labelsize=10)

data_dir = '/kaggle/input/rgb-arabic-alphabets-sign-language-dataset-jpg/images_after'
images = tf.keras.utils.image_dataset_from_directory(data_dir, labels='inferred', label_mode='int', class_names=None, color_mode='rgb', batch_size=32, image_size=(256, 256), shuffle=True, seed=123, validation_split=0.2, subset='training', interpolation='bilinear')

class_names = images.class_names
class_names

plt.figure(figsize=(10, 10))
for image, label in images.take(1):
    for i in range(25):
        ax = plt.subplot(5, 5, i + 1)
        plt.imshow(image[i].numpy().astype('uint8'))
        plt.title(class_names[label[i]])
        plt.axis('off')