Efficacy of Spatial Attention Mechanism in DenseNet121 for Tomato Leaf Detection
Abstract
Tomato leaf disease detection is an essential component of precision agriculture, as it directly influences crop yield and quality. In the domain of smart farming, numerous Convolutional Neural Network (CNN) based approaches have been proposed for disease detection and classification. However, the systematic design of an end-to-end structured pipeline remains relatively underexplored, despite its potential to significantly improve performance. In this study, a robust deep learning framework is proposed for the classification of tomato leaf diseases using pretrained CNN architectures. To enhance data quality and improve model generalization, a comprehensive preprocessing pipeline is employed. Initially, data augmentation techniques are applied to increase dataset diversity. Subsequently, the issue of class imbalance is addressed using a class-weighted cross-entropy loss function. Since CNN performance is highly dependent on the extraction of discriminative image features, an attention-based mechanism is integrated to focus on the most relevant regions of the input images. This facilitates improved feature representation and enhances the model’s ability to capture subtle disease patterns. Attention mechanisms are thereby incorporated and comparatively evaluated to analyze their effectiveness and identify the most suitable approach for enhancing classification performance. By effectively combining architectural design, preprocessing strategies, and feature enhancement using attention mechanism techniques, the proposed approach achieves a significant classification accuracy of 97.54% using DenseNet121-Spatial, demonstrating its effectiveness for tomato leaf disease identification.