This study developed a Convolutional Neural Network (CNN) based on digital images to classify five tomato leaf categories: Healthy, Early Blight, Late Blight, Leaf Mold, and Septoria Leaf Spot. The dataset consisted of 5,459 images that had been divided into training, validation, and testing sets using a 70%, 15%, and 15% split. The original 256 × 256 pixel images were resized to 224 × 224 pixels, converted to RGB format, and normalized to the 0-1 range. Data augmentation was applied only to the training set to increase image variability. The CNN contained four convolutional and max-pooling blocks, followed by global average pooling, dropout, and a five-class softmax classifier. The model was trained using the Adam optimizer and categorical crossentropy with early stopping. Testing on 824 images resulted in 611 correct predictions and 213 incorrect predictions, producing an accuracy of 74.15%, precision of 78.31%, recall of 74.15%, and F1-score of 74.30%. The Healthy class achieved the highest recall at 100%, while disease classes obtained recall values between 65.24% and 73.78%. The confusion matrix showed that the largest errors occurred when Early Blight, Leaf Mold, and Septoria Leaf Spot were classified as Healthy. Grad-CAM indicated that the model attended to leaf regions, although some samples still showed activation around leaf edges and background regions.
Copyrights © 2026