# Coffee-Leaf Diseases and Pests Detection Based on YOLO Models
## 3 Materials and Methods
### Dataset Enhancement  
The BRACOL dataset was enhanced to maximize data quality and optimize model training. The Roboflow platform was also used for this. To ensure that all the markings were accurate, the original BRACOL annotations were reviewed and improved with the help of a plant pathology expert. This process included re-evaluating the existing markings, correcting any inaccuracies, and adjusting the bounding boxes of the annotated areas. New markings were added to previously unidentified areas, increasing the representativeness of the dataset. Approximately 900 of the 1747 images were updated during this process, resulting in a substantial increase in total annotations from 1899 to 8226. This refinement aimed to provide a more comprehensive and reliable dataset for training object-detection models. Figure 3 shows two samples to exemplify the improvement of the dataset; in sample 1 of the original dataset only one diseased region was marked. When revised, four more diseased regions were marked. In sample 2, only two diseased regions were initially marked on the sheet, and after reviewing the markings, all the visible diseases were correctly marked. It can be seen that one disease was initially classified inaccurately.  
Figure 2: Examples of the main coffee-leaf diseases: (**a**) rust; (**b**) miner; (**c**) phoma; (**d**) cercospora.  
In the enhanced version of the BRACOL dataset, a significant variation can be observed in the number of annotations across different disease classes. As shown in Table 1, rust and phoma were the most frequently annotated diseases, with 6013 and 1671 markings, respectively, while miner and cercospora had fewer instances, with 341 and 201 annotations. This class imbalance reflects the natural distribution of diseases observed in the field during the data-collection process and expert analysis. On the other hand, the evaluation metrics used, such as mAP and F1-Score, are calculated by class and averaged, which mitigates the impact of the dominant classes on the overall results.  
Table 1 shows the number of disease markings for the original BRACOL dataset and the improved BRACOL dataset. It can be seen that the total number of disease annotations has increased, reflecting an improvement in the representativeness of the diseases, ensuring greater accuracy in the ground truth and a more robust database for training and evaluating the models.  
For the identification and localization of areas affected by diseases, the annotations of healthy regions do not represent areas of interest for the detection of diseases in coffee leaves and are therefore not being considered.  
To enable the improved dataset to be used in future research into the detection of diseases and pests on coffee leaves, the dataset has been made publicly available through the Kaggle platform ([[https://www.kaggle.com/datasets/jonatanfragoso/bracol-for-yolov8-detection](https://www.kaggle.com/datasets/jonatanfragoso/bracol-for-yolov8-detection)]([https://www.kaggle.com/datasets/jonatanfragoso/bracol-for-yolov8-detection](https://www.kaggle.com/datasets/jonatanfragoso/bracol-for-yolov8-detection)).), accessed on 2 March 2025.  
\begin{table}
\begin{tabular}{l c c} \hline \hline
**Classes** & **Original Markings** & **Enhanced Markings** \\ \hline miner & 540 & 341 \\ rust & 621 & 6013 \\ phoma & 464 & 1671 \\ cercospora & 274 & 201 \\ \hline Total & 1899 & 8226 \\ \hline \hline \end{tabular}
\end{table}
Table 1: The distribution of disease markers in the BRACOL dataset.  
Figure 3: Samples of the original BRACOL and enhanced BRACOL. (**a**) Sample 1 in the original BRACOL dataset. (**b**) Sample 1 in the enhanced BRACOL dataset. (**c**) Sample 2 in the original BRACOL dataset. (**d**) Sample 2 in the enhanced BRACOL dataset.