Code
import tensorflow as tf
from tensorflow.keras import models, layers
import matplotlib.pyplot as plt
IMAGE_SIZE = 256
BATCH_SIZE = 32
CHANNELS = 3
EPOCHS = 50Tam Le
October 2, 2025
This shows the key parts of the model training process from training/training.ipynb.
model = models.Sequential([
# Preprocessing
layers.Rescaling(1./255),
# CNN layers
layers.Conv2D(32, (3,3), activation='relu'),
layers.MaxPooling2D((2,2)),
layers.Conv2D(64, (3,3), activation='relu'),
layers.MaxPooling2D((2,2)),
layers.Conv2D(128, (3,3), activation='relu'),
layers.MaxPooling2D((2,2)),
# Classification layers
layers.Flatten(),
layers.Dropout(0.5),
layers.Dense(128, activation='relu'),
layers.Dense(len(class_names), activation='softmax')
])The complete training code is in the Jupyter notebook at training/training.ipynb.