Development of Cocoa Pod Rot Disease Identification Model Using You Only Look Once (YOLO-v9)

Development of Cocoa Pod Rot Disease Identification Model Using You Only Look Once (YOLO-v9)

Suratman Sudjud* Mohamad Jamil Rima Melati 

Department of Agrotechnology, Faculty of Agriculture, Universitas Khairun, Ternate 97719, Indonesia

Department of Informatics Engineering, Universitas Khairun, Ternate 97719, Indonesia

Corresponding Author Email: 
suratman.sudjud@unkhair.ac.id
Page: 
1268-1274
|
DOI: 
https://doi.org/10.18280/mmep.120418
Received: 
17 February 2025
|
Revised: 
9 April 2025
|
Accepted: 
15 April 2025
|
Available online: 
30 April 2025
| Citation

© 2025 The authors. This article is published by IIETA and is licensed under the CC BY 4.0 license (http://creativecommons.org/licenses/by/4.0/).

OPEN ACCESS

Abstract: 

Cocoa pod rot is a major challenge in the cocoa industry that can reduce yields. This study aims to develop a disease detection model in cocoa pods using YOLO-v9, an effective deep learning method for object detection. The model was trained using a dataset of cocoa pod images with two classes: Healthy and Infected, through training on 10 to 50 epochs. At the 10th epoch, the model showed a precision of 82.5% and a recall of 81.9% for Healthy images, but experienced challenges on Infected images with a precision of 80.2% and a recall of 78.7%. After 50 epochs, the model showed significant improvement, with precision and recall reaching 99.7% and 99.1% for Healthy images, and 99.2% and 98.9% for Infected images, while the mean Average Precision (mAP) reached 0.99. These findings indicate that the YOLO-v9 model can detect diseases in cocoa pods with high accuracy, and its performance increases with increasing epochs. The implication is that this study has the potential to support the development of an automatic detection system to improve the sustainability and efficiency of the cocoa industry. Further research can utilize transfer learning with larger models and datasets to improve detection capabilities in a variety of environmental conditions.

Keywords: 

disease detection, cacao pod rot, cacao fruit, YOLO-v9

1. Introduction

Cocoa (Theobroma cacao) is an agricultural commodity of significant economic value and serves as one of the primary raw materials for the global chocolate industry [1, 2]. Indonesia, as one of the largest cocoa-producing countries, plays a crucial role in supplying raw materials for the global chocolate industry. However, a significant challenge in cocoa production is the prevalence of diseases, one of which is cacao pod rot (CPR) [3, 4]. This disease is caused by various pathogenic microorganisms, including fungi such as Phytophthora, Moniliophthora, dan Fusarium [5, 6]. If not treated promptly, these diseases can lead to significant reductions in crop yields and diminish the quality of cocoa beans, ultimately negatively impacting farmers' income.

Cocoa production is frequently jeopardized by a range of diseases caused by pathogens, one of which is the fungus Moniliophthora spp. This fungal disease can cause serious damage to cocoa fruit, ultimately leading to reduced yields and quality.

McElroy et al. [7] in his research he combined the Genome Wide Association Analysis approach (GWAT) dan Genomic Selection (GS) to predict and improve the resistance of cocoa plants to diseases caused by fungi Moniliophthora. The results of the research conducted succeeded in producing an accuracy value of 0.477 to predict the performance of plant traits (phenotype) based on genomic data.

Early detection of cocoa pod rot disease is very important to reduce the economic losses caused [8]. So far, disease detection has been carried out manually by farmers or agricultural experts, which requires a lot of time and effort, and has a limited level of accuracy.

In recent years, the development of image processing technology using artificial intelligence (AI) has shown great potential in improving accuracy and efficiency in various fields, including agriculture such as crops or fruits [9-12].

In addition, in relation to the detection of cocoa rot disease using deep learning algorithms, there are several previous studies that have been conducted, including: Montesino et al. [13] using ResNet18 model for disease detection phytophthora palmivora on cocoa fruit with the prediction accuracy results obtained being 96%. Soh et al. [14] using five Convolutional Neural Network (CNN) architecture models, namely VGG-16, EfficientNetB0, ResNet50, and LeNet-5 to classify cocoa diseases with an accuracy value of 91.79%. Atianashie [15] revolutionizing the accuracy of disease detection in cocoa fruit using Convolutional Neural Network (CNN) with an accuracy level of 90%.

Several previous studies have discussed the use of deep learning techniques which have been proven to provide high accuracy in detecting diseases in cocoa fruit [16]. However, most of these studies use CNN architectures that focus more on image classification without providing more specific information about object detection.

One of the emerging approaches in object detection in images is the You Only Look Once (YOLO) algorithm. YOLO is a method in deep learning that can detect objects quickly and accurately in one image processing. Unlike traditional object detection methods that may perform detection in stages (for example, through feature extraction and classification), YOLO performs the entire process in one step, allowing for more efficient object detection in images [17, 18].

In the context of disease detection in cocoa fruit, YOLO can be used to detect cocoa fruit that is infected or has direct symptoms of disease. For example, in the case of cocoa fruit rot disease, YOLO can help identify fruit infected by pathogenic fungi such as Moniliophthora atau Phytophthora simply by scanning the image of the cocoa fruit taken by the camera. The main advantage of YOLO is its ability to detect multiple objects in a single image at once, while providing the position coordinates of these objects, which makes it very suitable for agricultural applications such as plant disease detection [19-21].

Based on this, this study focuses on the development of a cocoa rot disease detection model using YOLO-v9, which is one of the latest generations of deep learning-based object detection algorithms. YOLO-v9 is not only capable of classifying infected cocoa fruits, but also offers significant improvements in terms of accuracy, computational efficiency, and detection speed compared to previous variants such as YOLO-v5 or YOLO-v8 [22, 23].

2. Material and Methods

The research provides a comprehensive explanation of the processes and approaches used. The overall methodological flow, as illustrated in Figure 1, visually depicts the stages and techniques used in the research conducted.

Figure 1. Proposed architecture for cacao pod rot disease detection

2.1 Data collection

This study uses a dataset of cocoa fruit images obtained from two different sources, namely from a cacao plantation located on Bacan Island, South Halmahera Regency, North Maluku Province, and online data sources from https://www.kaggle.com/datasets/zaldyjr/cacao-diseases.

The collected dataset consists of 4291 images categorized into two classes: healthy cocoa pods and rotten cocoa pods due to disease infection. Each image is labeled to indicate the presence of disease and the severity of the infection based on visual observation. Label validation is performed by plant disease experts to ensure accuracy in labeling, with a double verification process to reduce the possibility of mislabeling. Images are taken under various lighting conditions, angles, and distances, to ensure that the model can generalize well across environments. In addition, some images also show overlapping or occluded cocoa pods, reflecting the real-world challenges of detecting rot diseases in cocoa pods.

Figure 2 shows a sample dataset of successfully collected cocoa pods.

Figure 2. Cacao image dataset sample

2.2 Preprocessing. Data labelling and augmentation

Before being used for training, the images in this dataset were processed through several preprocessing stages. First, they were resized to 416×416 pixels to fit the input required by the YOLO-v9 model. In addition, data augmentation techniques such as rotation, scaling, and color shifting were applied to enlarge the dataset size to improve the model's robustness to data variations. The image pixel values were also normalized to the range [0, 1] by dividing the pixel values by 255, to help the neural network converge during training. For data annotation, a bounding box was applied to each cocoa fruit, with a healthy or rotten label according to the visual classification performed. Figure 3 shows an example of the cacao fruit image data augmentation process.

Figure 3. Cacao fruit image augmentation

Figure 4. Annotations and bounding boxes

After performing the data augmentation process of the cocoa fruit image, the next process is data annotation and marking of bounding boxes on each image for labeling. Figure 4 shows the annotation and bounding box process on the cocoa fruit image.

2.3 Subset division

The division of training data and testing data is a fundamental step in building a model that can produce good predictions and not get caught up in the problem of overfitting [24, 25].

The process of dividing training data and test data related to the development of a cocoa fruit rot disease detection model using YOLO-v9 is made into several subsets or smaller parts. The dataset containing images of healthy and disease-infected (rotten) cocoa fruits is divided into two main subsets, namely 80% of the data for model training and 20% for model testing.

2.4 Modelling

The model used in this study is YOLO-v9, a deep learning model for object detection designed to work in real-time. YOLO-v9 was chosen because of its high detection accuracy and speed, as well as its ability to detect objects efficiently on a variety of hardware [26, 27].

The training process was carried out using the Adam optimizer with a batch size of 16. The model was trained for 50 epochs to ensure convergence. Adam Optimizer (short for Adaptive Moment Estimation) is one of the optimization algorithms used in training deep learning models [28, 29].

Model performance is then monitored using the mean Average Precision (mAP) and Intersection over Union (IoU) metrics to evaluate the accuracy of bounding box predictions. [30]. The formula for these two parameters is shown in Eqs. (1) and (2) below:

$m A P=\frac{1}{k} \sum_i^k A P i$     (1)

$I o U=\frac{T P}{T P+F N+F P}$     (2)

2.5 Evaluation

After the training process is complete, the model is evaluated using a test dataset that was not used during training. The metrics used for evaluation include precision, recall, F1 score, and mAP. Precision measures the accuracy of object detection, while recall measures the model's ability to find all relevant objects [31]. F1 score is calculated to provide a single measure of model performance, and mAP is used to evaluate the overall detection quality. Precision, recall, and mAP were chosen as evaluation metrics due to their relevance to practical needs in disease detection in the agricultural sector. Precision is important to ensure that the model only detects truly infected fruits, thus avoiding waste of resources, such as unnecessary pesticide use. Recall plays a role in ensuring that all infected fruits are accurately detected, reducing the risk of disease spread that can harm crop yields. mAP has the advantage of not only classifying objects but also providing information about the position of infected fruits in the image, thus facilitating further decision making.

The formulas of the evaluation parameters are shown in Eqs. (3)-(6) below:

Accuracy $=\frac{T P+T N}{T P+T N+F P+F N}$     (3)

Precision $=\frac{T P}{T P+F P}$     (4)

Recall $=\frac{T P}{T P+F N}$     (5)

$F 1$ Score $=2 \times \frac{\text { Precision } \times \text { Recall }}{\text { Precision }+ \text { Recall }}$     (6)

3. Results and Discussion

To evaluate the performance of the YOLO model in detecting cocoa fruit rot diseases, testing was carried out by involving several epochs during the training process. Each epoch was designed to test the model's ability to recognize cocoa fruit diseases, so that it can provide a more comprehensive picture of the model's effectiveness. By involving several epochs, namely 10 and 50 epochs, we were able to observe changes in model accuracy over time and evaluate the model's ability to improve disease detection at each stage of training. The dataset used consisted of images of healthy cocoa fruit, infected at an early stage, and infected at an advanced stage. The data was divided into 80% for training and 20% for testing. This approach allowed us to ensure that the YOLO model could learn and recognize more complex patterns and features in cocoa fruit images.

Table 1 below shows the test results on images of healthy and infected cocoa fruit.

Table 1. Results of testing healthy and infected cacao image samples

Image Sample

Epoch

Actual

Prediction

Performance Evaluation

Precision (%)

Recall (%)

mAP (%)

Loss

10

Healthy

82.5

81.9

0.81

17.9

10

Infected

80.2

78.7

0.78

20.6

50

Healthy

99.7

99.1

0.99

0.6

50

Infected

99.2

98.9

0.99

1.0

Based on the experimental results shown in Table 1, the model had difficulty in detecting infected cocoa pods at lower epochs, especially at epoch 10. This was due to several visual and technical factors. Visually, infected pods are characterized by darker, uneven, and inconsistently patterned colors compared to healthy pods which tend to be brightly colored and have a more uniform shape. The infected area on the pod often merges or blends with the background such as leaves or tree trunks, making it difficult for the model to accurately identify object boundaries, especially when the model has not been optimally trained. At low epochs, the model is still in the early stages of learning and tends to only recognize dominant and consistent features such as those found in healthy pods. This is reflected in the lower precision and recall values for infected pods (80.2% and 78.7%, respectively), as well as a high mAP value of 0.78 and loss of 20.6. On the other hand, at the 50 epochs, the model performance improved significantly because it had acquired better feature representation, thus being able to detect both healthy and infected pods with high accuracy. Thus, it can be concluded that the difficulty in detecting infected pods at the beginning of training is due to the complexity of visual features and the limited generalization ability of the model at the early stage.

Figure 5 shows the confusion matrix from the evaluation results at 10 epochs and 50 epochs.

(a) Epoch 10

(b) Epoch 50

Figure 5. Confusion matrix: (a) Epoch 10; (b) Epoch 50

In developing a cocoa fruit disease detection model using YOLO-v9, loss and validation loss graphs play an important role in monitoring model performance during training. Training loss measures the model's prediction error on training data, which includes components such as localization loss, confidence loss, and classification loss. Ideally, the training loss graph will decrease over time, indicating that the model is getting better at detecting disease symptoms, such as rotting cocoa fruit. Meanwhile, validation loss measures the model's performance on data that was not used in training. If the validation loss decreases along with the training loss, this indicates that the model is able to generalize well on data that has never been seen before, which is very important in disease detection applications, where the data being tested can come from different conditions. However, if the validation loss starts to increase while the training loss continues to decrease, this could indicate overfitting, where the model relies too much on patterns in the training data and cannot detect diseases well in new cocoa fruit images. Conversely, if both the training loss and validation loss remain high, this indicates underfitting, meaning the model has not learned well enough. Therefore, carefully monitoring the loss and validation loss graphs can help developers improve the cocoa disease detection model, ensuring that the model is not only accurate on the training data, but can also identify diseases with high accuracy on more diverse images.

Figure 6 shows the visualization of the loss and validation graphs on cocoa fruit images.

Figure 6. Visualization graph of loss and validation

4. Conclusions

Based on the results of the development of the cocoa pod rot disease detection model using YOLO-v9, it can be concluded that this model shows very good performance in classifying healthy and infected cocoa pods. At the beginning of training (Epoch 10), although the model has shown quite good results with precision and recall of around 82.5% and 81.9% for the "Healthy" class, and 80.2% and 78.7% for the "Infected" class, there is room for further improvement. However, over time and longer training up to Epoch 50, the results show a very significant increase. Precision and recall for both classes reached almost 99%, with the mAP value also increasing to 0.99, indicating the model's ability to produce very accurate predictions. The confusion matrix analysis also revealed that at Epoch 50, the classification error between the "Healthy" and "Infected" classes was very minimal, indicating that the model has succeeded in reducing errors and can distinguish the two classes more effectively.

As a practical contribution, this research can be applied to support automatic disease detection in cocoa plants, which can improve the efficiency and sustainability of the cocoa industry. For future research, several improvements can be made, including using transfer learning techniques to utilize models that have been trained on larger datasets, and increasing the diversity of datasets by adding variations in image conditions, such as different lighting, viewing angles, and image quality. In addition, testing the model on a real-time system in the field will also be very useful to evaluate the performance of the model under real-world conditions, which can help improve the accuracy and efficiency of disease detection in agricultural practices.

  References

[1] Kongor, J.E., Owusu, M., Oduro-Yeboah, C. (2024). Cocoa production in the 2020s: Challenges and solutions. CABI Agriculture and Bioscience, 5(1): 102. https://doi.org/10.1186/s43170-024-00310-6

[2] Minimol, J.S., Suma, B., Mary, A., Shija, T.K., Jose, S., Plappallil, S.K. (2024). Evaluating black pod resistance in cocoa (Theobroma cacao L.) and its relationship with phenotypical and biochemical characteristics. Beverage Plant Research, 4(1): e038. https://doi.org/10.48130/bpr-0024-0028

[3] Sudjud, S., Mahmud, S.A., Djafar, C.A. (2019). Exploration of morphological diversity of cacao plant (theobroma cacao L.) in Bacan Island. In Proceedings of the 5th International Conference on Food, Agriculture and Natural Resources (FANRes 2019), pp. 89-93. https://doi.org/10.2991/aer.k.200325.018

[4] Decloquement, J., Ramos-Sobrinho, R., Elias, S.G., Britto, D.S., Puig, A.S., Reis, A., da Silva, R.A.F., Honorato-Júnior, J., Luz, E.D.M., Pinho, D.B., Marelli, J.P. (2021). Phytophthora theobromicola sp. nov.: A new species causing black pod disease on cacao in Brazil. Frontiers in Microbiology, 12: 537399. https://doi.org/10.3389/fmicb.2021.537399

[5] Edy, N., Angelia, M., Lakani, I., Panggeso, J. (2019). Current status on cacao disease incidence in Central Sulawesi. AGROLAND The Agricultural Sciences Journal (e-Journal), 6(1): 57-62. https://doi.org/10.22487/j24077593.2019.v6.i1.13467

[6] Trisawa, I.M., Karmawati, E., Suhesti, S. (2020). Control of Conopomorpha cramerella, Helopeltis sp., and Phytophthora palmivora using botanical and biological pesticides. IOP Conference Series: Earth and Environmental Science, 418(1): 012086. https://doi.org/10.1088/1755-1315/418/1/012086

[7] McElroy, M.S., Navarro, A.J., Mustiga, G., Stack, C., Gezan, S., Peña, G., Sarabia, W., Saquicela, D., Sotomayor, I., Douglas, G.M., Migicovsky, Z., Amores, F., Tarqui, O., Myles, S., Motamayor, J.C. (2018). Prediction of cacao (Theobroma cacao) resistance to Moniliophthora spp. diseases via genome-wide association analysis and genomic selection. Frontiers in Plant Science, 9: 343. https://doi.org/10.3389/fpls.2018.00343

[8] Puig, A.S., Irish, B., Ayala-Silva, T., Wurzel, S., Gutierrez, O. (2022). Effect of cacao black pod rot screening method on disease reaction determination. Chemistry Proceedings, 10(1): 71. https://doi.org/10.3390/iocag2022-12215

[9] Alyas, R.M., Mohammed, A.S. (2022). Detection of plant diseases using image processing with machine learning. In 2022 2nd International Conference on Computing and Machine Intelligence (ICMI), Istanbul, Turkey, pp. 1-6. https://doi.org/10.1109/ICMI55296.2022.9873793

[10] Hasan, M.M., Uddin, A.S., Akhond, M.R., Uddin, M.J., Hossain, M.A., Hossain, M.A. (2023). Machine learning and image processing techniques for rice disease detection: A critical analysis. International Journal of Plant Biology, 14(4): 1190-1207. https://doi.org/10.3390/ijpb14040087

[11] Thiagarajan, J.D., Kulkarni, S.V., Jadhav, S.A., Waghe, A.A., Raja, S.P., Rajagopal, S., Poddar, H., Subramaniam, S. (2024). Analysis of banana plant health using machine learning techniques. Scientific Reports, 14(1): 15041. https://doi.org/10.1038/s41598-024-63930-y

[12] Tripathi, M.K., Maktedar, D.D. (2021). Detection of various categories of fruits and vegetables through various descriptors using machine learning techniques. International Journal of Computational Intelligence Studies, 10(1): 36-73. https://doi.org/10.1504/ijcistudies.2021.113819

[13] Montesino, R.Y., Rosales-Huamani, J.A., Castillo-Sequera, J.L. (2021). Detection of phytophthora palmivora in cocoa fruit with deep learning. In 2021 16th Iberian Conference on Information Systems and Technologies (CISTI), Chaves, Portugal, pp. 1-4. https://doi.org/10.23919/CISTI52073.2021.9476279

[14] Soh, K.S., Moung, E.G., Danker, K.J.J., Dargham, J.A., Farzamnia, A. (2024). Cocoa diseases classification using deep learning algorithm. ITM Web of Conferences, 63: 01014. https://doi.org/10.1051/itmconf/20246301014

[15] Atianashie, M. (2024). Disease detection in CCN-51 cocoa fruits through convolutional neural networks: A novel approach for the Ghana Cocoa Board. Convergence Chronicles, 5(3): 51-72. https://doi.org/10.53075/Ijmsirq/6554213434324

[16] Arakeri, M., Dhatvik, M.P., Kavan, A.V., Murthy, K.S., Nishitha, N.L., Lakshmi, N. (2024). Intelligent pesticide recommendation system for cocoa plant using computer vision and deep learning techniques. Environmental Research Communications, 6(7): 075003. https://doi.org/10.1088/2515-7620/ad58ae

[17] Zhang, Z., Wang, Y., Xu, P., Shi, R., Xing, Z., Li, J. (2025). WED-YOLO: A detection model for safflower under complex unstructured environment. Agriculture; Basel, 15(2): 205. https://doi.org/10.3390/agriculture15020205

[18] Diwan, T., Anirudh, G., Tembhurne, J.V. (2023). Object detection using YOLO: Challenges, architectural successors, datasets and applications. Multimedia Tools and Applications, 82(6): 9243-9275. https://doi.org/10.1007/s11042-022-13644-y

[19] Casado-García, A., Del-Canto, A., Sanz-Saez, A., Pérez-López, U., Bilbao-Kareaga, A., Fritschi, F.B., Miranda-Apodaca, J., Muñoz-Rueda, A., Sillero-Martínez, A., Yoldi-Achalandabaso, A., Lacuesta, M., Heras, J. (2020). LabelStoma: A tool for stomata detection based on the YOLO algorithm. Computers and Electronics in Agriculture, 178: 105751. https://doi.org/10.1016/j.compag.2020.105751

[20] Aldakheel, E.A., Zakariah, M., Alabdalall, A.H. (2024). Detection and identification of plant leaf diseases using YOLOv4. Frontiers in Plant Science, 15: 1355941. https://doi.org/10.3389/fpls.2024.1355941

[21] Ezenwobodo, Samuel, S. (2023). An assessment on the use of mathematical softwares in teaching and learning of mathematics in colleges of education in South-Eastern Nigeria: A case study of Anambra and Enugu. International Journal of Research Publication and Reviews, 4(1): 1806-1812. https://doi.org/10.55248/gengpi.2023.4149

[22] Yang, Z., Lan, X., Wang, H. (2025). Comparative analysis of YOLO series algorithms for UAV-based highway distress inspection: Performance and application insights. Sensors, 25(5): 1475. https://doi.org/10.3390/s25051475

[23] Sharma, A., Kumar, V., Longchamps, L. (2024). Comparative performance of YOLOv8, YOLOv9, YOLOv10, YOLOv11 and Faster R-CNN models for detection of multiple weed species. Smart Agricultural Technology, 9: 100648. https://doi.org/10.1016/j.atech.2024.100648

[24] Medar, R., Rajpurohit, V.S., Rashmi, B. (2017). Impact of training and testing data splits on accuracy of time series forecasting in machine learning. In 2017 International Conference on Computing, Communication, Control and Automation (ICCUBEA), Pune, India, pp. 1-6. https://doi.org/10.1109/ICCUBEA.2017.8463779

[25] Xu, Y., Goodacre, R. (2018). On splitting training and validation set: A comparative study of cross-validation, bootstrap and systematic sampling for estimating the generalization performance of supervised learning. Journal of Analysis and Testing, 2(3): 249-262. https://doi.org/10.1007/s41664-018-0068-2

[26] Redmon, J., Divvala, S., Girshick, R., Farhadi, A. (2016). You only look once: Unified, real-time object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, pp. 779-788. https://doi.org/10.1109/CVPR.2016.91

[27] Lavanya, G., Pande, S.D. (2023). Enhancing real-time object detection with yolo algorithm. EAI Endorsed Transactions on Internet of Things, 10: 12. https://doi.org/10.4108/eetiot.4541

[28] Hospodarskyy, O., Martsenyuk, V., Kukharska, N., Hospodarskyy, A., Sverstiuk, S. (2024). Understanding the Adam optimization algorithm in machine learning. In CITI'2024: 2nd International Workshop on Computer Information Technologies in Industry 4.0, Ternopil, Ukraine.

[29] Zhang, Z. (2018). Improved Adam optimizer for deep neural networks. In 2018 IEEE/ACM 26th International Symposium on Quality of Service (IWQoS), Banff, Canada, pp. 1-2. https://doi.org/10.1109/IWQoS.2018.8624183

[30] Anam, M.T. (2021). Evaluate machine learning model to better understand cutting in wood. http://urn.kb.se/resolve?urn=urn:nbn:se:uu:diva-448713.

[31] Padilla, R., Netto, S.L., Da Silva, E.A. (2020). A survey on performance metrics for object-detection algorithms. In 2020 International Conference on Systems, Signals and Image Processing (IWSSIP), Niteroi, Brazil, pp. 237-242. https://doi.org/10.1109/IWSSIP48289.2020.9145130