Leveraging Deep Learning for Real-Time Coffee Leaf Disease Identification
Abstract
:1. Introduction
- A survey on coffee leaf disease identification is presented, highlighting the key techniques to identify diseases.
- We introduce CoffNet, a novel deep learning model designed specifically for the identification of coffee leaf disease. CoffNet outperforms existing models in terms of processing speed, achieving 125.93 frames per second (fps), making it ideal for real-time applications.
- We evaluate the performance of several state-of-the-art CNN architectures, providing a comprehensive comparison of their accuracy and suitability for real-time deployment in agricultural settings.
- Using a diverse dataset of images captured from various devices, our approach aims to deliver a practical, scalable, and cost-effective solution for coffee growers.
2. Related Work
2.1. Disease Identification Techniques
2.1.1. Image-Based Analysis
2.1.2. Spectroscopy and Hyperspectral Imaging
2.2. Molecular Techniques
Remote Sensing and Aerial Imaging
2.3. Coffee Leaf Disease Identification
3. Materials and Methods
3.1. Dataset
- Data Preprocessing: images were standardized by cropping and resizing to a uniform resolution (224 × 224 pixels), ensuring consistency across all samples regardless of the device used.
- Data Augmentation: techniques such as rotation, flipping, and zooming were applied to enhance the dataset’s diversity and help the model generalize better to varying image qualities.
- Normalization: pixel values were normalized to reduce the impact of lighting and color variations introduced by different camera sensors.
- Robust Model Selection: transfer learning models like CoffNet, Xception, and ResNet101 were chosen for their proven ability to handle diverse image features and adapt to noise or variability.
3.2. Data Preprocessing
3.2.1. Cropping Image
3.2.2. Data Augmentation
- Flipping (both horizontal and vertical) was applied only when the disease features (e.g., lesions or rust spots) did not rely on specific orientations. In cases where leaf patterns were symmetric, such transformations were safe and maintained the integrity of the disease features.
- Rotation was limited to 180° to avoid misaligning the disease features. Rotations were performed such that the disease symptoms remained in similar relative positions on the leaf, preserving key visual characteristics needed for accurate classification.
- Data augmentation techniques were carefully selected to avoid altering the shape or size of disease-related features. The focus was on transformations like zooming, which could simulate real-world variability without distorting key visual cues.
- Low to moderate noise levels were used, typically with a mean of 0 and a standard deviation of 0.01 to 0.05. These values were chosen to ensure the noise simulated realistic conditions without overwhelming the disease features.
- Noise levels were incrementally tested during preprocessing. Performance metrics (accuracy and loss) were monitored to identify the optimal noise level that improved generalization without reducing classification accuracy.
- The final noise level was selected based on the validation set performance, ensuring the model maintained feature recognition integrity while reducing overfitting to the training data.
3.3. Classification Based on Deep Learning
3.3.1. Feature Extraction Model
3.3.2. Convolution Map
3.3.3. Max-Pool Map
3.4. Modeling
3.4.1. Transfer Learning
3.4.2. Xception
3.4.3. ResNet101
3.4.4. VGG16
3.4.5. CoffNet
- Input Layer: The input layer remains unchanged from the pre-trained base model. It is responsible for accepting input data (e.g., images, text, or other data formats) in different dimensions and passing them to the subsequent layers. In this research, the dimension used to feed the model was 224 × 224 × 3.
- Convolutional Layers: These layers are responsible for extracting features and learning representations from the input data. In transfer learning, the lower-level functional layers are often frozen (the weights are not updated) or have a lower learning rate applied during training, as they have already learned useful low-level features from the source task.
- Global Average Pooling Layers: For each feature map, the global average pooling (GAP) layer computes the spatial average of the feature values, essentially reducing the feature map to a single scalar value. The resulting scalars from all feature maps are then concatenated into a vector, representing the final feature representation of the input. This vector is then fed directly into the dense layer.
- Dense Layers (Fully Connected Layers): Dense layers, also known as fully connected layers, are responsible for combining the learned features and making predictions or classifications. In transfer learning, the dense layers from the pre-trained base model are often replaced or fine-tuned to adapt to the target task. New dense layers may be added or modified to match the output size of the target task (e.g., number of classes for classification or dimensions for regression). Typically, the weights of these dense layers are initialized with pre-trained weights and then fine-tuned on the target dataset during training, just as a data scientist would do. This layer reduces the size to the five classification categories and applies SoftMax activation.
3.5. Performance Evaluation Metrics
3.6. Model Performance and Evaluation
4. Experiment Results
4.1. Xception
4.2. ResNet101
4.3. VGG16
4.4. CoffNet
ROC Analysis
4.5. Comparison with Other Methods
4.6. Discussion
- Diseases like Phoma and Cercospora were occasionally confused due to their similar lesion patterns in certain lighting conditions.
- Augmented images with slight distortions or added noise may have reduced the clarity of fine-grained features, contributing to classification errors.
- Classes with fewer samples (e.g., Coffee Miner) showed slightly higher misclassification rates, likely due to less representative training data.
- Environmental Factors: variations in lighting, leaf orientation, and weather conditions in real-world agricultural settings could affect the models’ accuracy.
- Class Representation: some disease classes had fewer samples, potentially impacting model generalization for underrepresented conditions.
- Combine the proposed model with Internet of Things (IoT) devices, such as sensors and drones, for real-time, automated disease monitoring and reporting;
- Incorporate real-world datasets with diverse backgrounds and lighting conditions to enhance CoffNet’s robustness in practical agricultural settings;
- Collaborate with coffee growers to create intuitive user interfaces and mobile applications to ensure that the system meets practical requirements in agricultural settings.
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Pancsira, J. International Coffee Trade: A literature review. J. Agric. Inform. 2022, 13, 26–35. [Google Scholar] [CrossRef]
- McCook, S.; Vandermeer, J. The big rust and the red queen: Long-term perspectives on coffee rust research. Phytopathology 2015, 105, 1164–1173. [Google Scholar] [CrossRef] [PubMed]
- Shoaib, M.; Shah, B.; Ei-Sappagh, S.; Ali, A.; Ullah, A.; Alenezi, F.; Gechev, T.; Hussain, T.; Ali, F. An advanced deep learning models-based plant disease detection: A review of recent research. Front. Plant Sci. 2023, 14, 1158933. [Google Scholar]
- Sharma, A.; Jain, A.; Gupta, P.; Chowdary, V. Machine learning applications for precision agriculture: A comprehensive review. IEEE Access 2020, 9, 4843–4873. [Google Scholar] [CrossRef]
- Novtahaning, D.; Shah, H.A.; Kang, J.M. Deep learning ensemble-based automated and high-performing recognition of coffee leaf disease. Agriculture 2022, 12, 1909. [Google Scholar] [CrossRef]
- Kamilaris, A.; Prenafeta-Boldú, F.X. Deep learning in agriculture: A survey. Comput. Electron. Agric. 2018, 147, 70–90. [Google Scholar] [CrossRef]
- Mohanty, S.P.; Hughes, D.P.; Salathé, M. Using deep learning for image-based plant disease detection. Front. Plant Sci. 2016, 7, 1419. [Google Scholar] [CrossRef]
- Thakur, P.S.; Sheorey, T.; Ojha, A. VGG-ICNN: A Lightweight CNN model for crop disease identification. Multimed. Tools Appl. 2023, 82, 497–520. [Google Scholar] [CrossRef]
- Bansal, P.; Kumar, R.; Kumar, S. Disease detection in apple leaves using deep convolutional neural network. Agriculture 2021, 11, 617. [Google Scholar] [CrossRef]
- Barbedo, J.G.A. Plant disease identification from individual lesions and spots using deep learning. Biosyst. Eng. 2019, 180, 96–107. [Google Scholar] [CrossRef]
- González-Domínguez, E.; Monzó, C.; Vicent, A. New Trends in Disease and Pest Management: Challenges and Opportunities. Agronomy 2021, 11, 923. [Google Scholar] [CrossRef]
- Picon, A.; Alvarez-Gila, A.; Seitz, M.; Ortiz-Barredo, A.; Echazarra, J.; Johannes, A. Deep convolutional neural networks for mobile capture device-based crop disease classification in the wild. Comput. Electron. Agric. 2019, 161, 280–290. [Google Scholar] [CrossRef]
- Brahimi, M.; Arsenovic, M.; Laraba, S.; Sladojevic, S.; Boukhalfa, K.; Moussaoui, A. Deep learning for plant diseases: Detection and saliency map visualisation. In Human and Machine Learning: Visible, Explainable, Trustworthy and Transparent; Springer: Berlin/Heidelberg, Germany, 2018; pp. 93–117. [Google Scholar]
- Barbedo, J.G. Factors influencing the use of deep learning for plant disease recognition. Biosyst. Eng. 2018, 172, 84–91. [Google Scholar] [CrossRef]
- Rodriguez-Gallo, Y.; Escobar-Benitez, B.; Rodriguez-Lainez, J. Robust coffee rust detection using uav-based aerial rgb imagery. AgriEngineering 2023, 5, 1415–1431. [Google Scholar] [CrossRef]
- Mengistu, A.D.; Alemayehu, D.M.; Mengistu, S.G. Ethiopian Coffee Plant Diseases Recognition Based on Imaging and Machine Learning Techniques. Int. J. Database Theory Appl. 2016, 9, 79–88. [Google Scholar] [CrossRef]
- Marcos, A.P.; Rodovalho, N.L.S.; Backes, A.R. Coffee leaf rust detection using genetic algorithm. In Proceedings of the 2019 XV Workshop de Visao Computacional (WVC), São Bernardo do Campo, Brazil, 9–11 September 2019; pp. 16–20. [Google Scholar]
- Manso, G.L.; Knidel, H.; Krohling, R.A.; Ventura, J.A. A smartphone application to detection and classification of coffee leaf miner and coffee leaf rust. arXiv 2019, arXiv:1904.00742. [Google Scholar]
- Javierto, D.P.P.; Martin, J.D.Z.; Villaverde, J.F. Robusta Coffee Leaf Detection based on YOLOv3-MobileNetv2 model. In Proceedings of the 2021 IEEE 13th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM), Manila, Philippines, 28–30 November 2021; pp. 1–6. [Google Scholar]
- Esgario, J.G.; Krohling, R.A.; Ventura, J.A. Deep learning for classification and severity estimation of coffee leaf biotic stress. Comput. Electron. Agric. 2020, 169, 105162. [Google Scholar] [CrossRef]
- Velásquez, D.; Sánchez, A.; Sarmiento, S.; Toro, M.; Maiza, M.; Sierra, B. A method for detecting coffee leaf rust through wireless sensor networks, remote sensing, and deep learning: Case study of the Caturra variety in Colombia. Appl. Sci. 2020, 10, 697. [Google Scholar] [CrossRef]
- Marin, D.B.; Santana, L.S.; Barbosa, B.D.S.; Barata, R.A.P.; Osco, L.P.; Ramos, A.P.M.; Guimarães, P.H.S. Detecting coffee leaf rust with UAV-based vegetation indices and decision tree machine learning models. Comput. Electron. Agric. 2021, 190, 106476. [Google Scholar] [CrossRef]
- Yebasse, M.; Shimelis, B.; Warku, H.; Ko, J.; Cheoi, K.J. Coffee disease visualization and classification. Plants 2021, 10, 1257. [Google Scholar] [CrossRef]
- Faisal, M.; Leu, J.S.; Darmawan, J.T. Model selection of hybrid feature fusion for coffee leaf disease classification. IEEE Access 2023, 11, 62281–62291. [Google Scholar] [CrossRef]
- Chavarro, A.F.; Renza, D.; Ballesteros, D.M. Influence of hyperparameters in deep learning models for coffee rust detection. Appl. Sci. 2023, 13, 4565. [Google Scholar] [CrossRef]
- Vilela, E.F.; Silva, C.A.d.; Botti, J.M.C.; Martins, E.F.; Santana, C.C.; Marin, D.B.; Freitas, A.R.d.J.; Jaramillo-Giraldo, C.; Lopes, I.P.d.C.; Corrêdo, L.d.P.; et al. Detection of Coffee Leaf Miner Using RGB Aerial Imagery and Machine Learning. AgriEngineering 2024, 6, 3174–3186. [Google Scholar] [CrossRef]
- Krohling, R.A.; Esgario, J.; Ventura, J.A. BRACOL—A Brazilian Arabica Coffee Leaf images dataset to identification and quantification of coffee diseases and pests. Mendeley Data 2019, 1. [Google Scholar]
- Shorten, C.; Khoshgoftaar, T.M. A survey on image data augmentation for deep learning. J. Big Data 2019, 6, 60. [Google Scholar] [CrossRef]
- Chollet, F. Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 1251–1258. [Google Scholar]
- Simonyan, K.; Zisserman, A. Very deep convolutional networks for large-scale image recognition. arXiv 2014, arXiv:1409.1556. [Google Scholar]
- Kingma, D.P. Adam: A method for stochastic optimization. arXiv 2014, arXiv:1412.6980. [Google Scholar]
- Géron, A. Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow; O’Reilly Media, Inc.: Sebastopol, CA, USA, 2023. [Google Scholar]
- Jouini, O.; Aoueileyine, M.O.E.; Sethom, K.; Yazidi, A. Wheat Leaf Disease Detection: A Lightweight Approach with Shallow CNN Based Feature Refinement. AgriEngineering 2024, 6, 2001–2022. [Google Scholar] [CrossRef]
- Rainio, O.; Teuho, J.; Klén, R. Evaluation metrics and statistical tests for machine learning. Sci. Rep. 2024, 14, 6086. [Google Scholar] [CrossRef]
- Jmour, N.; Zayen, S.; Abdelkrim, A. Convolutional neural networks for image classification. In Proceedings of the 2018 International Conference on Advanced Systems and Electric Technologies (IC_ASET), Hammamet, Tunisia, 22–25 March 2018; pp. 397–402. [Google Scholar]
Year & Reference | Methods | Dataset/Number of Images | Performance |
---|---|---|---|
2016 [16] | ANN, KNN, Naive Bayes, SOM+RBF | 9100 | Accuracy: 90.07% |
2019 [18] | ANN | 690 | Accuracy: 99.095% |
2020 [20] | VGG16, ResNet50 | 1747 | Accuracy: 95.65% |
2020 [21] | RS+WSN+DL | - | F1 score: 77.5% |
2021 [23] | DNN+(Grad-CAM, Grad-CAM++, Score-CAM) | RoCoLE/1560 | Accuracy: 98% |
2021 [22] | LMT, K48, ExtraTree, REPTree, FunctionalTrees, Random Tree, RF | 400 | F1 score: 91.5% |
2023 [24] | Swin Transformer, MobileNetV3, and VAE | RoCoLE/1560 | Accuracy: 84.29% |
2023 [25] | VGG19, Xception, ResNet50, InceptionV3, DenseNet201 | RoCoLE, BRACOL, D&P, Digipathos, and Locole | Accuracy: 94.60% |
2023 [15] | Python-based rust detection | RoCoLE/1560 | Accuracy: 97% |
Coffee Leaf Condition | Description | Number of Images | Data Distribution (%) |
---|---|---|---|
Cerscospora | The appearance of circular to irregular brown spots on the upper surface of coffee leaves | 4070 | 20.8 |
Healthy | A uniform green color with no spots or visible damage | 3925 | 20.0 |
Leaf Rust | Characterized by the presence of orange-colored granular pustules on the lower surface of coffee leaves | 3893 | 19.9 |
Phoma | The presence of asymmetrical brown or reddish-brown lesions on the leaves | 3891 | 19.9 |
Miner | The existence of serpentine or winding mines inside the leaves | 3820 | 19.5 |
Layer | Input Size | Output Size |
---|---|---|
conv2d | (None, 224, 224, 3) | (None, 222, 222, 128) |
activation | (None, 222, 222, 128) | (None, 222, 222, 128) |
max_pooling2d | (None, 222, 222, 128) | (None, 111, 111, 128) |
dropout | (None, 111, 111, 128) | (None, 111, 111, 128) |
conv2d_1 | (None, 111, 111, 128) | (None, 109, 109, 64) |
activation_1 | (None, 109, 109, 64) | (None, 109, 109, 64) |
max_pooling2d_1 | (None, 109, 109, 64) | (None, 54, 54, 64) |
dropout_1 | (None, 54, 54, 64) | (None, 54, 54, 64) |
conv2d_2 | (None, 54, 54, 64) | (None, 52, 52, 32) |
activation_2 | (None, 52, 52, 32) | (None, 52, 52, 32) |
max_pooling2d_2 | (None, 52, 52, 32) | (None, 26, 26, 32) |
dropout_2 | (None, 26, 26, 32) | (None, 26, 26, 32) |
flatten | (None, 26, 26, 32) | (None, 21632) |
dense | (None, 21632) | (None, 5) |
Input size | 224 × 224 |
Split | 80:20 |
Training Image | 12,543 |
Validation Image | 3136 |
Test Image | 3920 |
Optimizer | Adam (Adaptive Moment Estimation) |
Class | Disease |
---|---|
0 | Cercospora |
1 | Healthy |
2 | Leaf Rust |
3 | Miner |
4 | Phoma |
Model Used | Test Accuracy | Avg. Time per Epoch (s) |
---|---|---|
Xception | 0.98 | 276 s |
CoffNet | 0.98 | 399 s |
VGG16 | 0.99 | 809 s |
ResNet101 | 0.97 | 1273 s |
Model | Precision | Recall | F1 Score | Accuracy |
---|---|---|---|---|
Xception | 0.98 | 0.98 | 0.98 | 0.98 |
CoffNet | 0.99 | 0.99 | 0.99 | 0.98 |
VGG16 | 0.98 | 0.98 | 0.98 | 1.00 |
ResNet101 | 0.97 | 0.97 | 0.97 | 0.97 |
Model | Frames per Second (fps) |
---|---|
CoffNet | 125.93 |
Xception | 60.82 |
VGG16 | 47.99 |
ResNet101 | 37.55 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Adelaja, O.; Pranggono, B. Leveraging Deep Learning for Real-Time Coffee Leaf Disease Identification. AgriEngineering 2025, 7, 13. https://doi.org/10.3390/agriengineering7010013
Adelaja O, Pranggono B. Leveraging Deep Learning for Real-Time Coffee Leaf Disease Identification. AgriEngineering. 2025; 7(1):13. https://doi.org/10.3390/agriengineering7010013
Chicago/Turabian StyleAdelaja, Opeyemi, and Bernardi Pranggono. 2025. "Leveraging Deep Learning for Real-Time Coffee Leaf Disease Identification" AgriEngineering 7, no. 1: 13. https://doi.org/10.3390/agriengineering7010013
APA StyleAdelaja, O., & Pranggono, B. (2025). Leveraging Deep Learning for Real-Time Coffee Leaf Disease Identification. AgriEngineering, 7(1), 13. https://doi.org/10.3390/agriengineering7010013