Code
import tensorflow as tf
from tensorflow.keras import models, layers
import matplotlib.pyplot as plt
= 256
IMAGE_SIZE = 32
BATCH_SIZE = 3
CHANNELS = 50 EPOCHS
Tam 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
.