text_plain_output_1.png
from keras.models import Model, load_model

from keras.utils.vis_utils import plot_model

from tensorflow.keras.applications import ResNet50

from tensorflow.keras.applications.resnet50 import ResNet50

from tensorflow.keras.layers import Dense, Flatten, GlobalAveragePooling2D, Dropout

from tensorflow.keras.layers import Dense, Input, Conv2D, MaxPool2D, Flatten ,Activation,Dropout,BatchNormalization

from tensorflow.keras.models import Model

from tensorflow.keras.models import Sequential

from tensorflow.keras.models import Sequential

import tensorflow as tf

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')

data_dir = '/kaggle/input/rgb-arabic-alphabets-sign-language-dataset-jpg/images_after'
images_validation = 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='validation', interpolation='bilinear')

early_stop = tf.keras.callbacks.EarlyStopping(monitor='val_loss', patience=2, restore_best_weights=True)

from tensorflow.keras.applications.resnet50 import ResNet50
from tensorflow.keras.models import Model
import tensorflow.keras as keras
resnet = ResNet50(include_top=False, weights='imagenet', input_shape=(256, 256, 3), pooling='max')
output = resnet.layers[-1].output
output = tf.keras.layers.Flatten()(output)
resnet = Model(resnet.input, output)
res_name = []
for layer in resnet.layers:
    res_name.append(layer.name)

set_trainable = False
for layer in resnet.layers:
    if layer.name in res_name[-22:]:
        set_trainable = True
    if set_trainable:
        layer.trainable = True
    else:
        layer.trainable = False

from tensorflow.keras.applications import ResNet50
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Flatten, GlobalAveragePooling2D, Dropout
model6 = Sequential()
model6.add(resnet)
model6.add(BatchNormalization())
model6.add(Dense(2048, activation='relu'))
model6.add(Dropout(0.2))
model6.add(Dense(1024, activation='relu'))
model6.add(Dropout(0.2))
model6.add(Dense(512, activation='relu'))
model6.add(Dropout(0.2))
model6.add(Dense(256, activation='relu'))
model6.add(Dropout(0.2))
model6.add(Dense(128, activation='relu'))
model6.add(Dropout(0.2))
model6.add(Dense(64, activation='relu'))
model6.add(Dropout(0.2))
model6.add(Dense(31, activation='softmax'))

model6.summary()

from keras.utils.vis_utils import plot_model
plot_model(model6, show_shapes=True, show_layer_names=True, to_file='model.png')