text_plain_output_1.png
from tensorflow.keras.layers import Input , Dense , Flatten , GlobalAveragePooling2D

from tensorflow.keras.models import Sequential

from tensorflow.keras.preprocessing import image_dataset_from_directory

import tensorflow as tf

from tensorflow.keras.preprocessing import image_dataset_from_directory
train_dir = './output/train'
test_dir = './output/test'
val_dir = './output/val'
train_data = image_dataset_from_directory(train_dir, label_mode='categorical', image_size=(299, 299), batch_size=32, shuffle=True, seed=42)
test_data = image_dataset_from_directory(test_dir, label_mode='categorical', image_size=(299, 299), batch_size=32, shuffle=False, seed=42)
val_data = image_dataset_from_directory(val_dir, label_mode='categorical', image_size=(299, 299), batch_size=32, shuffle=False, seed=42)

addModel = tf.keras.applications.xception.Xception(input_shape=(299, 299, 3), include_top=False, weights='imagenet')
model = Sequential()
model.add(addModel)
model.add(GlobalAveragePooling2D())
model.add(Flatten())
model.add(Dense(1024, activation='relu'))
model.add(Dense(512, activation='relu'))
model.add(Dense(10, activation='softmax', name='classification'))

model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=0.0005), loss='categorical_crossentropy', metrics=['accuracy'])
model.summary()

history_1 = model.fit(train_data, validation_data=val_data, epochs=10)