AI-powered detection and quantification of post-harvest physiological deterioration (PPD) in cassava using YOLO foundation models and K-means clustering Authors: Daniela Gómez Ayalde, Juan Camilo Giraldo Londoño, Audberto Quiroga Mosquera, Jorge Luis Luna Melendez, Winnie Gimode, Thierry Tran, Xiaofei Zhang, Michael Gomez Selvaraj Published: 2024 ABSTRACT AbstractBackgroundPost-harvest physiological deterioration (PPD) poses a significant challenge to the cassava industry, leading to substantial economic losses. This study aims to address this issue by developing a comprehensive framework in collaboration with cassava breeders.ResultsAdvanced deep learning (DL) techniques such as Segment Anything Model (SAM) and YOLO foundation models (YOLOv7, YOLOv8, YOLOv9, and YOLO-NAS), were used to accurately categorize PPD severity from RGB images captured by cameras or cell phones. YOLOv8 achieved the highest overall mean Average Precision (mAP) of 80.4%, demonstrating superior performance in detecting and classifying different PPD levels across all three models. Although YOLO-NAS had some instability during training, it demonstrated stronger performance in detecting the PPD_0 class, with a mAP of 91.3%. YOLOv7 exhibited the lowest performance across all classes, with an overall mAP of 75.5%. Despite challenges with similar color intensities in the image data, the combination of SAM, image processing techniques such as RGB color filtering, and machine learning (ML) algorithms was effective in removing yellow and gray color sections, significantly reducing the Mean Absolute Error (MAE) in PPD estimation from 20.01 to 15.50. Moreover, Artificial Intelligence (AI)-based algorithms allow for efficient analysis of large datasets, enabling rapid screening of cassava roots for PPD symptoms. This approach is much faster and more streamlined compared to the labor-intensive and time-consuming manual visual scoring methods.ConclusionThese results highlight the significant advancements in PPD detection and quantification in cassava samples using cutting-edge AI techniques. The integration of YOLO foundation models, alongside SAM and image processing methods, has demonstrated promising precision even in scenarios where experts struggle to differentiate closely related classes. This AI-powered model not only effectively streamlines the PPD assessment in the pre-breeding pipeline but also enhances the overall effectiveness of cassava breeding programs, facilitating the selection of PPD-resistant varieties through controlled screening. By improving the precision of PPD assessments, this research contributes to the broader goal of enhancing cassava productivity, quality, and resilience, ultimately supporting global food security efforts.Supplementary InformationThe online version contains supplementary material available at 10.1186/s13007-024-01309-w.Keywords: Post-harvest physiological deterioration (PPD), Cassava, Deep learning, Segment Anything Model (SAM), YOLO models, Image processing, Machine learning, Cassava breeding, PPD assessment Background Cassava (Manihot esculenta Crantz), a resilient root crop native to South America, is a vital food source for over 800 million people globally [1]. Known by various names such as manioc in French and yuca in Spanish, it serves as a dietary staple, particularly in regions facing food insecurity. Cassava’s adaptability to challenging conditions has earned it the reputation as "drought, war, and famine crop of the developing world," making it a cornerstone of agricultural systems in the face of climate change [1]. As the world's most important basic root crop, cassava provides dietary energy for nearly one billion people across 105 countries [2]. Its versatility extends beyond food, with cassava starch finding applications in over 300 industrial products [2]. To address global food security and nutritional needs, cassava breeding programs prioritize key traits like early vigor, rapid root bulking, higher root yield, resistance to major pests and diseases [3], and increasingly quality traits capturing consumer preferences (texture, color, aroma) [4]. Despite its versatility in agricultural systems and improvement in agronomic performance, cassava production grapples with the very short shelf-life of the storage roots [5, 6], primarily caused by post-harvest physiological deterioration (PPD). The deterioration process involves changes in the molecules that make up the root parenchyma, such as the degradation of starch granules to monosaccharides, altering the functional and structural properties of cassava starch (such as lower gelatinization temperature and high-water holding capacity and viscosity), rendering it unsuitable for food and animal feed, chemical and pharmaceutical applications [7]. PPD presents a significant challenge for the cassava industry, leading to substantial economic losses (reduced quality and market value of cassava roots) and food insecurity, particularly in regions where cassava serves as a staple crop. This deterioration process lowers the quality and market value of cassava tubers, shortening their shelf life and limiting post-harvest usability [2, 8], resulting in the loss of a third of the total fresh roots produced worldwide [9]. In addition, the limited shelf life not only hampers market potential but discourages stakeholders investment throughout cassava value chain [10]. Extending cassava storability offers substantial benefits, as evidenced by studies in Thailand, Nigeria, Ghana, and Uganda. Extending storage to 45 days in Thailand could yield an annual benefit increase of about US $35 million [11], while implementing cassava genotypes with delayed PPD could result in potential benefits of US $2.9 billion in Nigeria, $855 million in Ghana, and $280 million in Uganda over 20 years [12]. Recognizing the urgency of this issue, the Food and Agriculture Organization of the United Nations (FAO) prioritizes extending cassava storage life to at least two weeks [6]. The Future Seeds gene bank and Cassava Breeding Program at the Alliance of Bioversity International and CIAT, manage an extensive and diverse Global Germplasm collection of cassava, which serves as a valuable resource for studying PPD variability and genetic characteristics [13]. Current evaluation methods are based on visual scoring of 2 cm thick cassava slices and include a high number of repetitions to mitigate the high variability even among roots from the same cassava plant [14, 15]. However, these methods are still slow, subjective, and hence prone to errors. These limitations stem from observer bias and environmental influences, such as row-to-row variations, and plant root complexities. Visual scoring can also lead to misclassification of PPD symptoms as microbial or mechanical damage. As a result, image-based scoring systems can be proposed to reduce these inconsistencies and improve the accuracy and efficiency of phenotyping in cassava breeding programs. However, image-based scoring for PPD evaluation can be time-consuming and may not perfectly capture primary and secondary deterioration types in cassava roots [2, 16]. One limitation is the complexity of the imaging process, which often requires specific equipment and expertise. Additionally, image-based classification algorithms might struggle with subtle variations in PPD symptoms or overlap with other types of damage, leading to misclassification. Moreover, the long processing time for analyzing large image datasets can hinder breeding program efficiency. Therefore, while image-based scoring may offer improvements over traditional visual methods, ongoing research is needed to enhance its accuracy, efficiency, and applicability in real-world settings. AI-powered object detection models offer a promising solution to these limitations, as CNNs (Convolutional Neural Networks) have been shown to improve accuracy and efficiency in plant phenotyping applications [17]. The development and implementation of models for effective detection and classification of post-harvest deterioration (PPD) holds significant potential for improving phenotypic data accuracy in breeding programs. Such object detection models could reduce misclassification errors by differentiating PPD from other classes that often complicate the selection process. By meticulously analyzing complex datasets, models like R-CNN, YOLO, and Mask R-CNN [18], which have been successfully applied to object detection tasks, could identify patterns and markers associated with PPD susceptibility and resistance, thereby guiding targeted breeding programs aimed at developing PPD-resistant cassava varieties. The application of these PPD detection models would enhance the accuracy of selections within the breeding pipeline, reducing the risk of misidentifying other issues as PPD. Overall, this multidisciplinary approach, which combines genomics, phenomics, artificial intelligence, and sensor technologies, has the potential to significantly advance our understanding of PPD in cassava and lead to innovative solutions that mitigate its detrimental impacts on crop yields and food security. Foundation models like YOLO (You Only Look Once) [19] have revolutionized object detection with their speed and precision in real-time object detection [20]. YOLO models analyze entire images in a single evaluation, significantly reducing detection time while maintaining high accuracy. The YOLO series has demonstrated promising solutions in a wide variety of applications including agriculture [21], especially in challenging environments for deep learning-based disease detection, such as tea leaf diseases [22]. Among the YOLO family of models, this study focuses on the potential of YOLO foundation models, particularly YOLOv9 and YOLO-NAS, for detecting, classifying, quantifying PPD in cassava. These models excel at striking an optimal balance between inference speed and classification accuracy, which is essential for real-time monitoring and timely agricultural interventions. Their inherent flexibility facilitates the diagnosis of various crop diseases, enabling proactive, data-driven approach to agricultural practice [23]. Consequently, by leveraging the strengths of YOLO models, this study aims to contribute to more effective crop management strategies for cassava. While YOLO models excel at detection and classification, K-Means clustering and SAM (Segmentation Anything Model) offer powerful techniques for quantifying damage in various domains, including agriculture [24], healthcare [25, 26] Click or tap here to enter text., and manufacturing [27]. These methods leverage data-driven approaches to categorize and segment distinct groups or clusters based on inherent characteristics, enabling identification of patterns and trends related to damage severity [28–30]. On the other hand, SAM provides a framework for precisely delineating regions of interest within images or datasets, facilitating accurate quantification of damage extent or intensity [31, 32]. In the present study, we bring together these methodologies, YOLO foundation models, K-Means clustering and SAM, and apply them to a large dataset of annotated PPD images, in order to develop a robust solution for detecting and quantifying PPD in cassava. Our specific objectives were as follows: Assemble a thorough dataset enhanced with expert annotations of PPD images from the post-harvest quality laboratory at CIAT, Colombia. Assemble a thorough dataset enhanced with expert annotations of PPD images from the post-harvest quality laboratory at CIAT, Colombia. Qualitative approach: Develop advanced YOLO-based object detection models customized for accurately detecting and classifying PPD. In particular, the YOLO models must be able to discriminate between samples with no PPD and samples exhibiting PPD symptoms, in order to retain only the latter for subsequent quantitative evaluation of PPD. Qualitative approach: Develop advanced YOLO-based object detection models customized for accurately detecting and classifying PPD. In particular, the YOLO models must be able to discriminate between samples with no PPD and samples exhibiting PPD symptoms, in order to retain only the latter for subsequent quantitative evaluation of PPD. Perform a comprehensive evaluation of four YOLO architectures (YOLOv7, YOLOv8, YOLOv9, and YOLO-NAS) employing rigorous evaluation metrics to determine the most suitable framework for achieving high-accuracy PPD classification. Perform a comprehensive evaluation of four YOLO architectures (YOLOv7, YOLOv8, YOLOv9, and YOLO-NAS) employing rigorous evaluation metrics to determine the most suitable framework for achieving high-accuracy PPD classification. Quantitative approach: Utilize SAM as a tool to segment and remove irrelevant information from the predicted images with PPD symptoms, as detected by the YOLO models. Quantitative approach: Utilize SAM as a tool to segment and remove irrelevant information from the predicted images with PPD symptoms, as detected by the YOLO models. Implement PPD quantification for each cassava slice, using RGB color filtering and machine learning (ML) powered K-means clustering algorithms. Implement PPD quantification for each cassava slice, using RGB color filtering and machine learning (ML) powered K-means clustering algorithms. Materials and methods PPD dataset collection We focused the PPD image dataset collection on genotypes originating from the segregation of PPD susceptible and resistant populations. Cassava image slices with varying PPD levels were obtained from populations cultivated at the CIAT campus station in Palmira, Colombia (approximately 1000 m above sea level) [14]. The photoperiod varied slightly throughout the year, ranging from 11 h 55 m to 12 h 20 m, due to the location close to the equator. Average monthly rainfall over the past 30 years fluctuated between 500 and 1000 mm. Temperatures in Palmira remain relatively constant throughout the year. During the growing season, daily maximum and minimum temperatures averaged 30.1 ± 2.7 °C and 19.2 ± 1.2 °C, respectively. The field layout (Fig. 1) consisted of 0.8 m between plants and 1.20 m between rows. Fifteen plants per genotype were cultivated in the center of 30 cm high raised beds using a completely randomized design across different fields. Field management practices followed the standard procedures for cassava cultivation at CIAT [33]. Cassava genotypes evaluated in this study were selected from cassava breeding program trials conducted between 2019, 2020 and 2023. Geotagged field images collected at the experimental site Table 1 details the behavior of each genotype and their response to PPD during these evaluation periods. Table 1Description of cassava trials used for PPD evaluationTrialDescription trialObjective19–01Post-harvest Deterioration—fortnightlyEvaluation of stability against PPD of 15 genotypes over 10 staggered, fortnightly harvests, at age 10 months after planting20–01Post-harvest Deterioration—fortnightlyEvaluation of stability against PPD of 20 genotypes over 10 staggered, fortnightly harvests, at age 10 months after planting23–21Cooking Quality Specialty trial sowing 4 and elite clonesEvaluation of 11 genotypes for their response to the development of PPD23–22Diversity Trial-Preliminary Year Trial 202231DVPRGEvaluation of 45 genotypes for their response to the development of PPD23–23Training Population Trial-Only for GS 202258DVGSTEvaluation of 106 genotypes for their response to the development of PPD23–24Cooking Quality Specialty trial sowing 5—202259CQQU1Evaluation of 3 genotypes for their response to the development of PPD23–25Training Population Trial-Only for GS 202271DVGSTEvaluation of 76 genotypes for their response to the development of PPD23–26Cooking Quality Specialty trial sowing 6—202273CQQU1Evaluation of 2 genotypes for their response to the development of PPD23–27Frogskin disease Seed Multiplication 202248FSMUL (Clones Llanos)Evaluation of 14 genotypes for their response to the development of PPD23–31Diversity Trial Seed Multiplication 202272DVMUL_CIAT_Rep1Evaluation of 23 genotypes for their response to the development of PPD23–32Diversity Trial Seed Multiplication 202283DVMULT_ciat_rep1 (Part 2)Evaluation of 19 genotypes for their response to the development of PPD23–38Cooking Quality Specialty trial sowing 8—202275CQQU1Evaluation of 6 genotypes for their response to the development of PPD Description of cassava trials used for PPD evaluation PPD phenotyping and visual scoring We adapted the methodology for PPD evaluation reported in [14, 15, 34] with some modifications (Figs. 1, 2).Ten commercial-sized cassava roots (minimum diameter of 5 cm and length of 18 cm) from three harvested plants were selected for each genotype. These roots were numbered from 1 to 10 and stored for seven days (roots with cuts at the ends: all trials in Table 1) or fourteen days (whole roots: trials 19-01 and 20-01) on shaded shelving in a shed without walls, with good air circulation between the shelves and the roots. PPD phenotyping and visual scoring The proximal and distal ends were removed by transversal cuts to obtain roots with a length of approximately 15 cm. The distal section was covered with a cling film to prevent the flow of oxygen and induce PPD development at the uncovered proximal end. During the experiments, the average temperature was 25.0 °C, with a maximum of 34.2 °C (daytime) and a minimum of 19.4 °C (nighttime); the relative humidity averaged 68.9%, ranging from a minimum of 37.3% to a maximum of 92.2%. At the end of storage, seven transversal cross-sections (slices), approximately 2 cm thick, were cut from the proximal end of each root. A visual score from 0 to 10 (0 = 0%, 1 = 10%, 2 = 20%, etc.) was assigned corresponding to the percentage of the cut surface exhibiting discoloration on the parenchyma [14]. The average PPD score for each root was calculated by averaging the scores of the seven cross sections (slices). Roots displaying signs of microbial decomposition or mechanical damage were noted and the data were conserved and included to train the model to predict these alternative symptoms besides PPD. Immediately after the visual evaluation, the cassava slices were photographed using a standardized methodology, as described in the following section. The photographs were linked to the corresponding visual evaluation PPD data for each genotype to facilitate the development of the Deep Learning model. Image acquisition A dedicated photo shooting setup was employed to capture high-quality images of PPD-affected cassava slices. This setup consisted of the following equipment: Fotodiox Photo Shooting Box (80 × 80 × 80 cm cube); Nikon D5500 camera; Nikon DX VR lens (AF-S NIKKOR 18–55 mm 1:3.5–5.6GII); Table tripod positioned 86 cm from the Photo Shooting Box base; ThinkPad Tablet Model ESK-316A for Wi-Fi image capture and real-time quality verification; qDslrDashboard V3.5.5 photo shooting software. Two photographs were captured per genotype: Photo 1 included roots from 1 to 5, and Photo 2 included roots from 6 to 10. Each photo contained up to 35 slices, with 7 slices per root (previously visually evaluated for PPD), arranged inside the Photo Shooting Box from left to right by root order and from top to bottom by slice order (#1) and ending with the distal slice (#7). All the camera and image acquisition parameters are detailed in Supplementary Table 1. System description of deep transfer learning approach (qualitative classification approach) As mentioned above, each cassava slice was assigned a PPD score from 0 to 10, translating to 11 different classes for PPD. Class PPD_0 corresponds to 0% PPD, PPD_1 to 10% PPD (0% < PPD < = 10%), PPD_2 to 20% PPD (10% < PPD < = 20%), and so on up to PPD_10. However, for initial analysis, we focused on a binary classification: PPD present or PPD absent. Our consolidated dataset contains images with several slices, each with different PPD scores. This results in a total of 1142 images meticulously taken by field technicians in the cassava post-harvest quality laboratory, and a total of 23,934 annotated slices across all classes. Each of these was validated by three cassava postharvest experts working at the Alliance Bioversity International and CIAT. The number of annotations per class is detailed in Table 2. As seen in Table 2, classes with lower PPD levels had a higher number of annotations, reflecting their prevalence in the trials. Table 2Description of annotated PPD dataset used in this study, before and after groupingClassesAnnotations before groupingGrouped classesAnnotations after groupingImages collectedPPD_08404PPD_08404PPD_12941PPD_110,690PPD_21444PPD_31142PPD_41204PPD_5985PPD_6685PPD_7598PPD_8561PPD_9524PPD_10606M2225M2225G2615G2615Total23,93423,9341142 Description of annotated PPD dataset used in this study, before and after grouping While our initial approach assigned PPD scores from 0 to 10, we encountered challenges when working with all 11 classes. Distinguishing fine visual gradations between consecutive PPD classes (e.g., between PPD_4 and PPD_5, PPD_7 and PPD_8) made the problem more complex for qualitative classification approach, especially for the model during training. To address this challenge and focus on the core objective of identifying PPD presence, we opted to consolidate the original 11 classes into two classes, which represent whether the cassava slice exhibits PPD. The classes were grouped as follows: In addition to PPD, we defined two more classes belonging to secondary deterioration, corresponding to mechanical damage (class G) and microbiological damage (class M). Considering the above, our Deep Transfer Learning (DTL) system, outlined in Table 2 (column Grouped classes) and visually represented in Fig. 1. Figure 3, employs a four-class classification scheme. The architecture and workflow of this system are meticulously designed to efficiently process and analyze the intricate variations within our dataset, thereby ensuring precise detection and classification of the deterioration level in each cassava slice. Overview of complete pipeline for the proposed YOLO foundation models Dataset description for PPD detection and quantification (quantitative approach) Figure 4 illustrates the construction of a comprehensive image dataset from a single site in Palmira (Colombia). This dataset was the same as the one used for the qualitative approach and is described above (1142 images). It includes a diverse set of breeding lines and accessions, encompassing various cassava varieties and root colors, including yellow cassava. This diversity was intentionally curated to enhance the model's ability to generalize across different genotypes. However, the training dataset was collected under consistent environmental conditions, using the same background and camera settings. Real images of cassava slices with PPD score To further improve the model's robustness and ensure broader applicability across varied conditions, we plan to expand the dataset with images captured under different environmental settings and with diverse backgrounds as access to these additional images becomes available. While current images were collected from a single controlled environment, this planned dataset augmentation will help enhance the model's generalization capabilities without compromising the progress already made. Dataset annotation The cassava images were meticulously annotated to train the deep learning models for accurate PPD detection and quantification. We employed the 'Labellmg' software for the annotation process. This tool enabled the creation of tight bounding boxes around each cassava slice within the entire training set (Fig. 5). This process reduced background noise inclusion and ensured the models were trained on the most accurate representations of the cassava slices possible. This meticulous approach resulted in a total of 23,934 annotations (Table 2). Demonstration of the annotation process. a Original raw image; b Annotated image The corresponding class labels were assigned to each bounding box based on PPD score of the respective slice. The resulting annotations were saved in XML files for data organization. Subsequently, these annotations were converted to YOLO format to ensure they were compatible with the object detection models employed in this study. Challenges in annotating mixed deterioration in cassava slices A major challenge during the annotation process arose from the images with multiple types of deterioration within a single slice. Scenarios included various levels of PPD, co-occurrence of PPD with either mechanical damage (class G) or microbial damage (class M), or occurrence of all three types combined. Ideally, these multiple cases would be excluded. However, due to the large number of these types of situations, complete exclusion was not possible. Out of the 34,684 cassava slices present in the images, a total of 10,750 were excluded (not annotated) for the reasons described, resulting in 23,934 annotations as mentioned above. Therefore, the annotation process focused on considering the most prominent form of deterioration within each slice. The exclusion of cassava slices with more than one type of deterioration was determined visually, without applying a specific threshold. This decision was made collaboratively with experts when such situations arose, which did not ensure accurate annotation. This approach aimed to allow the model to learn the characteristics of each type of deterioration clearly. As a result, rather than negatively affecting the generalization of the model, exclusion can improve its ability to distinguish between different types of deterioration in complex scenarios, and even predict more than one class for a single slice. YOLO architectures In this study, we concentrated on training four different CNN architectures for PPD classification: YOLOv7, YOLOv8, YOLOv9, and YOLO-NAS. We utilized PyTorch, a Python-based open-source library [35], as the deep learning framework for model training. Its dynamic computational graph, combined with support for NVIDIA CUDA [36], enabled accelerated GPU processing, optimizing training times. YOLO pre-trained models, initially trained on the COCO (Common Objects in Context) dataset [37], served as the foundation for our study. We applied a transfer learning strategy to tailor these pre-trained models to our cassava dataset. To optimize each model’s performance for our dataset, we fine-tuned specific configurations during the training process. Given the number of images and the inherent complexity of the classification task, a batch size of 1 was employed. To ensure training consistency, all four models underwent 200 epochs. Segment anything model (SAM) In addition to the YOLO models, we incorporated the Segment Anything Model (SAM), an AI-based image segmentation model developed by Meta AI and released in April 2023. SAM excels at creating precise segmentation masks that delineate the exact outline of objects, offering a versatile tool applicable for various practical scenarios. SAM demonstrates exceptional generalization capabilities, enabling object recognition in any image or video context [38]. In our study, SAM is employed to generate masks within the bounding boxes predicted by the YOLO models. These masks precisely outline each cassava slice, accurately isolating them from the background. This step is crucial for enhancing subsequent quantification steps, as it allows for accurate measurements of the PPD percentage within each slice. By eliminating background noise, such as peel remnants, SAM contributes to more accurate PPD percentage calculations. Enhancement of image resolution Image resolution is a fundamental aspect in object detection and quantification tasks, as any alteration in image can significantly impact the outcome. To address this, we explored various image quality preprocessing methods to assess their influence on the accuracy of PPD percentage calculations aligning more closely with ground truth values. The test methods included four image processing conditions: original image without any filter, decreased image quality using a blur filter, high-resolution image, and a combination of blur and high-resolution filter. Original Image (no Filter): The original image is used to calculate the percentage of PPD by analyzing slices of cassava extracted from it, without applying any image processing filters. Decreased Image Quality (Blur filter): To decrease image quality, we initially planned to utilize a GaussianBlur function from the OpenCV library in Python to simulate lower quality images. This filter function applies a Gaussian blur filter to the input image, which effectively smooths and reduces noise. Specifically, we intended to use a kernel size of 11 × 11 pixels and set the sigma value to 3, which controls the intensity of the blur effect. The kernel size determines the area over which the blur is applied, while the sigma value defines the standard deviation of the Gaussian distribution used in the blur. Applying the Gaussian blur filter reduces image sharpness, simulating lower-quality images. This reduction allowed us to observe the impact on PPD percentage calculation. By blurring the images, we aimed to determine if the detection and quantification of PPD would remain accurate compared to the ground truth values. However, this method was excluded from the final analysis due to unforeseen complications. Applying blur filter to some naturally blurred or low-quality images resulted in excessive degradation, making it difficult to distinguish features and generate distinct clusters necessary for PPD percentage calculation. Increased Image Resolution: To increase the resolution, two methods were employed. The first used only the addWeighted function of OpenCV, while the second combined Gaussian blur with resolution, as detailed below: In the first method, the image resolution was improved using only the addWeighted function, with the coefficients alpha (2.5) for the original image and beta (−1.5). For the blended option, a Gaussian blur filter was applied with a kernel size of (0, 0) and a sigma value of 10. Subsequently, the same blending coefficients of the first method were used to increase the resolution. First, the Gaussian blur filter was applied to generate a high-resolution image using the specified parameters. Then, the original and blurred images were combined using the addWeighted function, which improved the resolution by integrating the clarity of the original image with the smoothness of the blurred image. By first applying the blur process and then enhancing the resolution, we avoided the errors previously encountered when using the blur filter independently. This combined approach ensured high quality images suitable for accurate PPD percentage calculation. Figure 6 illustrates the different image processing methods applied to a cassava slice, demonstrating the effectiveness of our approach. Possible methods for changing resolution in calculating PPD percentage. a Original image; b Blur filter applied; c High resolution filter applied; d Combination of blur and high-resolution method RGB color filtering, clustering and PPD quantification Following background removal and image quality enhancement, images were processed through Python’s OpenCV library. Images were cropped using a ring-shaped mask defined by concentric circles. The first circle starts from 40% of the radius from the center of the cassava slice outward, defining the inner boundary of the ring. The second circle extends up to 82% of the radius from the center outward, defining the outer boundary of the ring. This cropping approach aligns with the standard method for PPD evaluation, which involves a visual score corresponding to the percentage of the cut surface exhibiting discoloration of the parenchyma excluding the center and the edge of the slice. Figure 7 demonstrate the cropping procedure [28]. Example of cropped image used for PPD quantification Next, two-color filtering algorithms were applied to the cropped images to eliminate color sections that could hinder accurate segmentation. The first algorithm targeted a yellow section within the RGB range from 160, 160, 10 (lower yellow) to 195, 195, 180 (upper yellow). This yellow section was removed because the presence of yellow-colored varieties caused the algorithm to misclassify these areas, resulting in a 100% PPD rating. The second algorithm addressed a gray section falling within the RGB range from 119, 111, 100 (lower gray) to 235, 237, 218 (upper gray). This gray section was removed because enhancing the resolution of the images led the algorithm to erroneously amplify gray tones across all images, which again resulted in a misleading 100% PPD quantification. After removing these color regions, the K-Means clustering algorithm was employed to perform image segmentation. This algorithm groups pixels with similar characteristics to generate three clusters within the image. Following this, the segmented images were further divided into 720 parts, with each division representing a 0.5-degree interval of the total 360-degree circumference. The percentage of PPD was then quantified by counting the number of segments containing pixels classified within the relevant K-Means segmentation process. The entire algorithmic process is illustrated in Fig. 8 [39]. Pipeline for the RGB process of the PPD images Model training Splitting the dataset is a crucial step in machine learning to prevent overfitting, underfitting and ensuring proper generalization. In our study, we employed a common data splitting strategy, dividing the cassava slice image dataset into training (80%), validation (15%), and testing (5%) (Table 3). By incorporating this data splitting procedure, we aimed to achieve a robust model capable of accurately detecting PPD in cassava slices. Table 3Number of training, validation, and testing annotationsClassesTraining annotationsValidation annotationsTesting annotationsPPD_065321501371PPD_184101630650M1727355143G1949469197Total annotations18,61839551361 Number of training, validation, and testing annotations To maintain clarity and effectiveness in our implementation, we chose to randomly select images for each dataset. The number of annotations for each set is shown in Table 3. Performance metrics Loss function In this research, we employed several loss functions to measure the differences between the model's predicted outputs and the actual ground truth values. Different loss functions serve specific roles, offering insights into distinct features of model performance. These functions include: Classification Loss [40], which assesses errors in categorizing objects into predefined groups; IoU (Intersection over Union) Loss [40], which measures the overlap between the predicted bounding boxes and the ground truth bounding boxes for a detected object; Dual Focal Loss [40], which addresses the challenge of class imbalance by prioritizing the learning on hard examples (objects that are difficult for the model to classify correctly) during training, aiming to improve classification accuracy for unbalanced classes in datasets; Objectness Loss [41], which is used to differentiate between regions containing an object and background regions, helping the model focus on relevant areas and improving detection accuracy by reducing false positives; and Box Loss [19], which focuses on refining the predicted bounding boxes around detected objects, leading to precise object detection. mAP score The mean average precision (mAP), as discussed in [42, 43], is considered essential for validating object detection models. This metric assesses the model's overall performance across all object classes, offering valuable insights into its capacity to accurately detect and recall objects from various categories. A high mAP score reflects the model's strong ability to detect objects across all classes, with both high precision and effective recall. Precision and recall Precision measures the accuracy of the model’s positive predictions, representing the proportion of true positives among all predicted positive instances. Recall assesses the model’s ability to identify all relevant objects, representing the proportion of true positives (instances that were correctly identified by the model) among all actual positive instances [44]. The mAP, explained above, is calculated by averaging the Average Precision (AP) values obtained for all classes, where each AP corresponds to the area under the Precision-Recall curve [42], which is plotted from the calculation of precision and recall for each confidence threshold. The equations for mAP, precision and recall [42] are shown below for a better understanding: where n corresponds to the number of classes, TP to true positives, FP to false positives and FN to false negatives. Confidence score In object detection problems, the confidence score, often called the prediction probability, indicates the model's certainty about the presence and classification of objects within bounding boxes in an image [45]. Ranging from 0 (no confidence) to 1 (absolute certainty), this threshold directly impacts metrics like precision and recall. Confusion matrix In addition to the mean Average Precision (mAP) score, we used confusion matrices (CMs) to gain deeper insights into the performance of each evaluated model in object detection tasks, as outlined in [46]. The protocol for generating CMs was adapted from the recent YOLO bean paper by [47]. Software and hardware systems used in this study The hardware and software utilized in this study are listed in Supplementary Table 2. Python 3.9 served as the main programming language for implementing algorithms and data processing scripts. PyTorch, a robust deep learning framework created by Facebook, was employed for model re-training. PyTorch offers comprehensive support for training and inference on both CPUs and GPUs, allowing us to leverage hardware acceleration for improved effectiveness and scalability in our tests. Further details about PyTorch are available in [35]. We also employed a streamlined version of the YOLO-NAS model, which was built using the SuperGradients library created by Deci-AI [48], and described in [49]. In addition, the YOLOv8 and YOLOv9 models, as outlined in [50, 51] respectively, were implemented through the Ultralytics package [52]. The YOLOv7 model was similarly implemented according to the guidelines provided in [53]. Results and discussion This study aims to address post-harvest physiological deterioration (PPD) in cassava by using advanced AI techniques, allowing the accurate detection and quantification of PPD in cassava slices, and streamlining the phenotyping process in cassava breeding programs. Data augmentation and class imbalance Data augmentation methods, including flipping and brightness modifications, were frequently employed to enrich training datasets [54]. These techniques enhance model robustness by diversifying the dataset and mitigating overfitting. However, in this study, data augmentation presented a challenge due to the class imbalance within the dataset (Table 2). While classes with the least number of annotations (G and M) would benefit most from data augmentation, applying it uniformly could exacerbate the imbalance. This is because images often contain multiple objects belonging to different classes. Augmenting such images would increase the number of already well-represented classes (e.g., PPD_0) at a disproportionate rate. Alternative approaches to address class imbalance were also considered. One option involved randomly eliminating annotations from over- represented classes (PPD_0 and PPD_1). However, this could lead to a situation where some images have very few annotations, hindering the model’s ability to learn from those specific examples. Another option was to isolate and annotate individual cassava slices from the original images to increase the number of samples in the less-represented classes. However, this was not feasible due to the significant reduction in image resolution, which would have hindered accurate detection of post-harvest deterioration. Given the limitations of data augmentation and random removal techniques in addressing class imbalance, we opted to leverage the original dataset without modifications. This decision was based on the comprehensive nature of the dataset and the high quality of the annotations. Therefore, the comprehensive dataset comprising 1142 images with 23,934 expert-validated annotations was finally used in our study. This dataset was annotated by three experts over six months, ensuring high-quality and reliable ground truth information. This meticulous approach enhances the model's robustness against common challenges such as overfitting and underfitting, thereby strengthening its effectiveness and adaptability across various agricultural settings. Comprehensive evaluation of YOLO models for PPD detection and classification This research presents a pioneering evaluation of YOLO object detectors—YOLOv7, YOLOv8, YOLOv9, and YOLO-NAS—with a particular emphasis on their performance in identifying PPD in cassava slices. YOLO foundation models are renowned for their ability to perform single-stage detection and their efficiency in real-time processing, as extensively analyzed in previous works [55]. This study offers a comprehensive analysis of these detectors, comparing their performance using various detailed metrics. Training dynamics and loss function Analyzing the training dynamics of advanced object detection models like YOLOv7, YOLOv8, YOLO NAS, and YOLOv9 revealed distinct patterns in their validation losses. These patterns are crucial for understanding model effectiveness and stability during the machine learning process. In addition to serving as a key performance metric, validation loss plays an integral role in the optimization of loss functions to enhance model accuracy, as demonstrated in recent research [56]. While all models exhibit a consistent decrease in training losses across epochs (Fig. 9a), indicating effective and continuous learning, their validation losses present more complex and suggestive patterns (Fig. 9b) requiring detailed examination for performance optimization and generalization. It is important to note there are two different scales (Fig. 9a) to visualize the losses, one scale for the YOLOv8, YOLOv9 and YOLO-NAS models, and another for the YOLOv7 model. Total loss for different models. a Train loss; b Validation loss for the four models; c Better view of YOLOv8 and YOLO-NAS validation losses The validation loss of YOLOv7 demonstrated a steady decrease throughout the 200 epochs with minor fluctuations (Fig. 9b), suggesting that the model was learning effectively and consistently improving its performance on unseen data (testing data). The loss fluctuated between 0.17387 and 0.22595, with most values falling between 0.18 and 0.19. This indicated that YOLOv7 maintained relatively stable performance during training, leading to a low final validation loss and suggesting a good generalization capability to new images. Additionally, there were no significant signs of overfitting, as the validation loss followed a similar decreasing trend as the training loss. In contrast to YOLOv7, YOLOv8 exhibited early instability, evident from the peak around the second epoch (Fig. 9b). However, the model reduced its validation loss over time, indicating its ability to overcome initial challenges. The loss exhibited significant fluctuations, with values ranging from 1.68 to 12.94. For most epochs, the loss fluctuated between 1.7 and 2.0. The validation loss increased slightly towards the end of training but remained relatively low compared to the training loss. The early stopping mechanism was triggered in this case indicating satisfactory level of performance before completing the expected 200 epochs, albeit with a slightly higher final validation loss compared to YOLOv7. Compared to YOLOv8 model, YOLOv9 showed a smoother decrease in validation loss, with values ranging from 1.66551 to 2.25029, with minor fluctuations (Fig. 9b). This indicates a more stable learning process with steady improvement on the validation dataset. Similar to YOLOv8, the loss predominantly fluctuated between 1.7 and 2.0. The steady decline suggested efficient learning and good generalization by YOLOv9, achieving a final validation loss for YOLOv9 comparable to YOLOv7. The smoother decrease also indicated potentially more stable training dynamics for YOLOv9 compared to YOLOv8. There were no clear signs of overfitting as the validation loss decreased along with the training loss. YOLO-NAS started with an initial decreasing trend in validation loss but exhibited frequent fluctuations and occasional peaks throughout training (Fig. 9b). The loss exhibited significant variations, with peaks reaching as high as 720 and 380. However, for most epochs, the loss fluctuated between 1.3 and 1.6. Despite this erratic behavior, the model maintained a relatively low validation loss, comparable to YOLOv7 and YOLOv9. This suggested that even with a less stable training process, the model can still generalize well to unseen images. While this behavior might imply some overfitting, the overall trend showed a decrease in validation loss. Such fluctuations could also indicate the presence of challenging samples in the dataset that intermittently disrupted the learning process. Exploring the specific instances that caused these peaks could provide insights into potential biases or weaknesses in the dataset, guiding further refinement of the training strategy to enhance model robustness and accuracy. Due to the presence of peaks in the validation losses of YOLO-NAS and YOLOv8 (Fig. 9b), these peak values are not fully visible, leading to a compressed view of their trends. To address the limitations of Fig. 9b in visualizing the peaks of YOLO-NAS and YOLOv8, Fig. 9c provides a more detailed view of the validation loss trends. This additional figure highlights two exceptionally high peaks observed in YOLO-NAS, with values of 720 and 380. These peaks are crucial to consider in the analysis, as they represent significant deviations from the typical loss values of the model. Overall, the four models demonstrated the ability to effectively reduce their validation losses during training; however, they exhibited different convergence patterns: YOLOv7 and YOLOv9 showed more stable and consistent decreases in validation loss, while YOLOv8 and YOLO-NAS demonstrated a more erratic behavior. Despite these differences, all models ultimately achieved relatively low validation losses, indicating their effectiveness in object detection tasks. The ability of these models to perform well with low validation losses signifies their effectiveness in learning underlying patterns within the unseen data of cassava PPD dataset. While the current performance is encouraging, there is potential for further optimization. This generalizability to unseen data is paramount for real-world applications, where models encounter novel examples not explicitly included in the training dataset. Similar to this, the study conducted by [57] highlights the ongoing need for developing machine learning models that not only perform well under controlled testing environments but also exhibit reliable functionality in unpredictable real-world settings and domains unseen during training. Concluding this analysis leads us to consider the implementation of additional strategies such as exploring more sophisticated regularization techniques, and adjustments in the model architecture. For instance, the PLPNet study on tomato leaf disease detection employs advanced attention mechanisms and a proximity feature aggregation network to enhance model generalization [58]. These improvements could enhance the model’s ability to generalize to unseen data, ensuring their applicability in real-world settings is as efficient as possible. The supplementary figures provide a detailed breakdown of individual loss components contributing to the total loss for each model: YOLO-NAS model (Supplementary Figure 1), YOLOv7 (Supplementary Figure 2), YOLOv8 (Supplementary Figure 3), and YOLOv9 (Supplementary Figure 4). Mean average precision (mAP) score To evaluate the performance of object detection models for cassava PPD detection, we particularly focused on the mean Average Precision (mAP) metric as the primary benchmark, evaluating different YOLO models. This widely adopted metric in object detection challenges such as PASCAL VOC [59], ImageNet [60], and COCO [37], is suitable for comparative analysis. Our study also included confusion matrix analysis, emphasizing performance on unseen data. Table 4 presents a detailed breakdown of mAP scores achieved by different YOLO models for each PPD class and overall dataset. For the PPD_0 class, YOLO-NAS achieved the highest mAP (91.3%), slightly surpassing YOLOv8 (90.9%). Both models outperformed YOLOv7 and YOLOv9, which exhibited very similar values (87.8 and 87.9%, respectively). This high performance for PPD_0 can be attributed to class’s visual consistency (i.e. virtually no PPD damage) and distinct features compared to slices with varying levels of deterioration, making it easier for the model to learn and recognize these features. The homogeneity within this class reduced the complexity of the task for the model, further enhancing accuracy. Additionally, the high number of annotations (8404) and the nature of the classes provided ample training data, allowing the model to effectively learn the characteristics of non-deteriorated slices, resulting in better performance. Table 4mAP score per class for different models (IOU = 0.5, Conf = 0.35)ClassesmAP@0.5YOLO-NASYOLOv7YOLOv8YOLOv9PPD_00.9130.8780.9090.879PPD_10.8790.8400.8720.865M0.7170.6020.7950.761G0.7620.7010.7830.748Total0.8180.7550.8400.813 mAP score per class for different models (IOU = 0.5, Conf = 0.35) YOLO-NAS again demonstrated stronger performance in the PPD_1 class with the highest mAP score (87.9%), followed by YOLOv8 (87.2%), and YOLOv9 (86.5%). YOLOv7 showed the lowest score (84%) in this class, indicating a potential area for improvement in handling slight deterioration features compared to the other models. Overall, mAP scores were lower for PPD_1 than for PPD_0, which may be explained by the higher degree of complexity, due to the high variability in levels of PPD (from 1 to 10) within the PPD_1 class. The overlapping visual features between different types of deterioration (e.g., between the lowest levels and class M or the highest levels and class G) also posed a challenge for the model in accurately classifying instances of this class PPD_1. However, the substantial number of annotations (10,690) provided a rich dataset that can potentially improve performance with further training techniques, albeit with some difficulties. Both classes M and G (2225 and 2615 annotations respectively) exhibited lower mAP compared to PPD_0 and PPD_1. This can be attributed to the limited number of annotations, hindering the model's ability to identify and classify these classes accurately. Additionally, cassava slices with class G labels often exhibited co-occurring PPD levels, further increasing confusion for the model. In the M class, YOLOv8 showed the best performance (79.5%), followed closely by YOLOv9 (76.1%). YOLO-NAS had a lower performance (71.7%), and YOLOv7 lags significantly with 60.2%. Finally, for the G class, YOLOv8 again leads with a mAP of 78.3%, followed by YOLO-NAS (76.2%). YOLOv9 showed a slightly lower performance (74.8%), and YOLOv7 was in last place with 70.1%. In total performance, YOLOv8 emerged as the leader in overall performance with the highest mAP (84.0%), followed closely by YOLO-NAS (81.8%) and YOLOv9 (81.3%). Similar cases are presented in [61–65], where YOLOv8 outperforms other models in terms of mAP, demonstrating its superior performance across a wide variety of applications. In our study, YOLOv7 consistently exhibited the lowest overall performance across all classes resulting in the lowest overall mAP (75.5%). This trend is evident in the studies [66–68], where YOLOv7 demonstrates worse performance compared to other models, particularly those released after YOLOv7. However, it is important to highlight that, although many studies demonstrate that YOLOv7 and YOLOv8 models exhibit the lowest and highest performance, respectively, this cannot be generalized to all cases. Each specific scenario has unique characteristics that may influence the models' behavior differently. This analysis highlights the importance of both the quantity and quality of annotations, as well as the intrinsic characteristics of each class, in determining the performance of YOLO models. While the overall mAP scores might not be exceptionally high due to the presence of misclassifications (incorrect predictions made by the models), they represent a commendable achievement considering the dataset’s complexity. Similar to our study, the research in [69] highlights the impact of dataset quality and annotation precision on the performance of YOLO models. In this study, YOLOv8 achieved a mAP of 84.0%, underscoring its effectiveness in handling complex datasets with varied pest types. This comparison underscores the importance of specialized training to achieve high detection accuracy, reflecting similar challenges and achievements in our work. Figure 10 depicts the progression of the validation mAP throughout the model training process. As observed, the mAP steadily increases throughout the epochs before reaching a plateau with minor fluctuations (except for YOLO-NAS, where the fluctuations are larger and more noticeable). mAP@0.5 evaluation metric for different models during training Confusion matrix analysis In our research, confusion matrices emerged as an essential instrument in the evaluation of YOLO models performance for cassava PPD detection. By detailing true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN) for each class, these matrices provided insights on the specific accuracy of each level of deterioration and identified potential misclassification areas (Fig. 11). This analysis highlighted challenges posed by class complexity and guiding opportunities for targeted enhancements [70]. Confusion matrix for different models. a YOLO-NAS model; b YOLOv7 model; c YOLOv8 model; d YOLOv9 model The YOLOv7 model exhibited strong performance in detecting the PPD_0 class (86% accuracy) but encountered difficulties with the M class (55% accuracy). The primary source of error was misclassification of M as PPD_1, potentially due to the similarities between the M class and slices with low PPD levels. On the other hand, the model achieved high accuracy for classes G (86%) and PPD_1 (84%). However, some confusion between these classes was evident, possibly caused by overlapping visual characteristics between severe PPD and “hits”. YOLOv8 excelled at detecting PPD_1 class (86% accuracy) and significantly improved M-class detection compared to the YOLOv7 model (77% accuracy). However, some confusion between M and PPD_1 persisted. On the other hand, both PPD_0 and G classes reached 82% accuracy, indicating some confusion with the PPD_1 class. Conversely, YOLOv9 stands out in its ability at accurately detecting the PPD_1 class (89% accuracy) and the model performed well with the PPD_0 class (85% accuracy). It also achieved balanced performance across other classes, with 72% accuracy for the M class and 78% for the G class. Notably, YOLOv9 exhibited the lowest performance in class G compared to the other models. Finally, the YOLO-NAS model achieved the highest detection accuracy for PPD_0 (96%) but exhibited a performance drop for the M class (64% accuracy), primarily due to misclassification as PPD_1 class. Additionally, it presented accuracy of 86% and 79% for the PPD_1 and G classes, respectively, showing some confusion between both classes. As evident from the confusion matrices, all four models exhibited misclassifications, especially when encountering classes with similar characteristics. Another contributing factor was the presence of slices containing more than one symptom. In such cases, the model predicted one of the possible classes, potentially leading to mismatches with the original annotation containing the other possible class. In addition to this, the class imbalance could lead to occasional misclassification errors affecting the generalization of the model for underrepresented classes. However, the overall impact due to this was not very significant. Interestingly, the confusion matrices revealed that the models often detected additional objects (i.e., slices that were not initially annotated) beyond the annotated ground truth. Although these additional detections slightly impacted precision, a significant portion of them were correct, demonstrating the model’s ability to identify relevant objects in complex agricultural environments, where comprehensive annotation is difficult. This is particularly noteworthy given the inherent difficulties in annotating every object within an image. Similarly, a study on self-supervised learning (SSL) shows that SSL techniques can significantly reduce the reliance on heavily annotated datasets, further enhancing model robustness in precision agriculture. This study further notes that labeling is both a resource-intensive and slow process, contrasting sharply with the rapid increase in available unlabeled data brought about by technological advancements [71]. Notably, the YOLO-NAS model recorded the highest number of extra detections compared to other models. This aligns with the observation of fewer extra detections in the other model’s confusion matrices, suggesting a higher occurrence of undetected objects. Conversely, YOLO-NAS’s excelled at detecting all image slices, indicating its ability to comprehensively identify objects present within the images. Precision and recall Evaluating model performance involves a trade-off between precision and recall, which is visually depicted in the Precision-Recall (PR) curve (Supplementary Figure 5c, Supplementary Figure 6a, Supplementary Figure 7a, Supplementary Figure 8a). To achieve this balance, a confidence threshold (conf) of 0.35 was consistently applied across all models. A higher confidence threshold tends to increase precision by reducing false positives, but may decrease recall as some true positives with lower confidence might be overlooked (Supplementary Figure 5a, b, Supplementary Figure 6b, c, Supplementary Figure 7b and c, Supplementary Figure 8b and c). The area under the PR curve (AUPRC) acts as a comprehensive metric that encapsulates overall model performance across every threshold. YOLO-NAS demonstrated high effectiveness, achieving a precision of 0.55 and a recall of 0.935, as shown in Table 5. Although the model exhibits a low precision due to a higher number of false positives (extra detections), its high recall affirms its robust detection capability, which can also be validated by the absence of undetected objects. On the other hand, YOLOv7 achieved a balance of precision (0.732) and recall (0.812), indicating that it has a lower number of extra detections compared to YOLO-NAS, resulting in a higher accuracy. However, it also has a higher number of undetected objects, leading to a lower recall [72]. Similarly, YOLOv8 exhibited the best overall performance with precision of 0.77 and recall of 0.831, while YOLOv9 exhibited a precision of 0.73 and a recall of 0.818. It is important to note that the accuracy of these models is not exceptionally high due to misclassifications. Table 5Precision and Recall metrics for different models (IoU = 0.5, Confidence = 0.35)MetricsModelsYOLO-NASYOLOv7YOLOv8YOLOv9Precision0.550.7320.770.76Recall0.9350.8120.8310.818 Precision and Recall metrics for different models (IoU = 0.5, Confidence = 0.35) The standardized dataset used in the study enables rigorous evaluation and consistent comparisons of each model’s performance. This allows for a thorough assessment of the model’s capabilities in detecting PPD cases, considering both precision and recall. Model predictions using testing data (unseen data) The predictions made by the YOLO-NAS (Fig. 12), YOLOv7 (Fig. 13), YOLOv8 (Fig. 14), and YOLOv9 models (Fig. 15) demonstrated varying levels of accuracy in detecting PPD cases. One example of PPD detection results using YOLO-NAS One example of PPD detection results using YOLOv7 One example of PPD detection results using YOLOv8 One example of PPD detection results using YOLOv9 The discrepancy in model performance highlights the effectiveness of considering factors like dataset complexity, the nature of the deterioration, and specific model requirements when evaluating the effectiveness of annotation methods. For instance, the model predictions for cassava slices may exhibit overlapping bounding boxes due to the complexity of the deterioration types. This can occur when a slice has multiple types of deterioration or when it is challenging to differentiate between PPD classes. Automated quantification of PPD damage in root slices Enhancing cassava PPD quantification with SAM In addition to PPD detection and classification, the quantification of PPD damage in cassava slices is a crucial step in the phenotyping pipeline, enabling the mapping of QTL/genes and identification of sources of resistance to PPD. To achieve this, a robust tool is required to create masks from annotations containing bounding boxes of each detection. Initially, the possibility of creating a dataset with all cassava slice contours to train a segmentation algorithm capable of generating masks from detections was considered. However, this approach posed the risk of introducing additional errors due to the need to train another algorithm. Instead, the use of SAM (Segment Anything Model) ensures that all detections have a generated mask, thus mitigating the risk of missing detections. The removal of image backgrounds is pivotal in PPD quantification, as calculating the PPD percentage involves tracing a circumference around each slice. In most cases, cassava slices have an irregular shape, which can be addressed by two approaches. One method involves tracing a small area within the slice to avoid including background information, which can distort the percentage calculation based on pixels. A second method uses precise background removal to extract the maximum amount of information from the cassava slice, even if it has an irregular shape. During background removal, an array is created that contains all positions where a segmentation mask created by SAM was detected. This array is then used to map the pixels of the original image to the positions generated by SAM on a black image. It is noteworthy that SAM creates masks with specific colors for different classes, which is crucial for accurate segmentation and background removal. In our study, we observed that all the slices whose mask had a blue color presented a particularity that generated errors in the calculation of PPD quantification. This is due to the fact that, being a color-based technique, the slices that had the blue color after pixel extraction from the original image maintained a blue tone, instead of the original image, as occurs with images assigned with other colors when using SAM. Therefore, SAM should not assign the color blue to any of the PPD classes when creating its masks. To achieve this, we utilized the Supervision library [73], which enables the reading of files in YOLO format and the configuration of colors via a YAML file. This ensured that the blue color was not used by SAM, thereby preventing any potential errors in the calculation of the PPD percentage. The removal of the blue layer from images without a background is crucial, as it directly affects the accuracy of the PPD percentage. Figure 16 illustrates the creation of masks generated by SAM and the subsequent background removal based on these masks. Use of SAM to remove the background of the images predicted by the model. a Masks obtained from SAM, colored by predicted class; b Image without background using the obtained masks Optimizing RGB processing for precise estimation of PPD percentage After applying SAM to remove the background, each cassava slice within the image was extracted using their corresponding bounding box coordinates. RGB color filtering was applied to each extracted cassava slice. The test results revealed that excluding specific color sections significantly influenced PPD estimation accuracy. Eliminating yellow color sections yielded modest enhancement in estimation precision (Fig. 17), while removing gray sections had a more substantial impact. RGB and clustering algorithm tests. a Test without removing any color; b Test eliminating the yellow segment Notably, the combination of removing the yellow section and the gray section yielded the same outcome to gray section removal alone (Table 6), highlighting the influence of color section removal on the algorithm's estimation performance. The similarity in results between eliminating the gray sections alone and removing both gray and yellow sections can be attributed to the presence of yellow undertones within the lower limit of the gray color. Specifically, the color scheme in RGB (235, 237, 218) indicates a subtle combination of this hue [74]. Table 6MAE score metric for RGB image processingMean Absolute Error (MAE)OriginalNot yellowNot grayNot yellow and not grayPPD_152.6552.2527.9627.96PPD_235.2434.9922.9522.95PPD_324.79924.7516.1516.15PPD_422.7922.6617.3317.33PPD_516.9416.9514.0114.01PPD_614.4414.0915.9315.93PPD_79.7910.0714.49814.498PPD_87.7998.0415.1815.18PPD_99.599.6215.7815.78PPD_106.096.096.096.09Average20.0119.9516.5916.59 MAE score metric for RGB image processing PPD quantification The original dataset used to calculate the metrics of the algorithm employed for PPD quantification is presented in Table 2. Notably, only classes exhibiting a positive PPD (PPD_1 to PPD_10) were considered for these calculations. Before utilizing the results obtained from the YOLO-trained object detector for M, G, PPD_0, and PPD_1, a preprocessing of the results was conducted to remove multiple detections of the same cassava slice. Only the prediction with the highest confidence score was included in the analysis. As mentioned earlier in this study, image processing techniques were evaluated using original image, an image with increased resolution, and an image with the combination of blurring and increased resolution. Interestingly, the option of blurring with high resolution yielded the lowest errors, particularly, from PPD_1 to PPD_6, while for PPD levels from PPD_7 to PPD_10, it was more effective to increase the resolution of the images. This finding can be explained by the fact that at lower PPD levels (1–6), combining blurring with increased resolution yielded the best results by smoothing out the imperfections in the cassava image while still highlighting the PPD for quantification. On the other hand, at higher PPD levels (7–10), it is crucial to highlight all the visual characteristics of the image to quantify the highest possible amount of PPD. The Mean Absolute Error (MAE) was calculated based on the median of the value range corresponding to each PPD class (Table 7). For instance, a real value of 5 was assigned to class PPD_1, and a real value of 15 to class PPD_2, following this pattern for all relevant classes. Once these real values were established, the absolute difference between each calculated PPD percentage and its respective real value was computed. This difference was used to determine the MAE for each class, thus obtaining an average of errors for each group. At a global level, the error for each image processing was determined by averaging the errors of all classes involved in the analysis. Table 7MAE metric score for each image processing methodMean Absolute Error (MAE)No filterHigh resolutionBlur + High resolutionPPD_127.9536.9727.08PPD_222.9533.3619.72PPD_316.1523.6414.22PPD_417.3221.7916.47PPD_514.0016.8912.09PPD_615.9216.1814.50PPD_714.4913.5214.63PPD_815.1810.5014.18PPD_915.789.5216.00PPD_106.094.076.09Average16.5818.6415.50 MAE metric score for each image processing method The “Blur + High resolution” processing yielded very promising results. The percentage of error was calculated using the median of the value range per class. This approach allowed us to conclude that the error percentage does not exceed a one-class difference while quantifying the PPD percentage. Furthermore, our analysis revealed that the classes with the highest error rates were PPD_1, PPD_2, and PPD_4. In other words, low levels of PPD were associated with a greater margin of error, possibly due to the algorithm’s detection of numerous smaller-scale visual details that were either not considered or deemed less relevant when labeling the original data. In contrast, at high levels of PPD, minimal errors were observed due to the algorithm’s inherent ability to scrutinize a broad spectrum of details, thereby facilitating precise calculation of PPD. Table 7 presents the mean absolute errors in the final quantification of PPD, reflecting the outcomes obtained after applying the RGB color filtering and clustering process for enhancement in image resolution. Figure 18 presents the final result of PPD quantification for two examples of cassava slices. Examples of PPD quantification in individual slices (extracted from the images without background) AI-powered PPD detection and quantification Traditional visual scoring methods for PPD detection rely on human observers, introducing subjectivity and potential observer variation. Environmental factors can further influence scoring decisions, leading to errors and inconsistencies. In contrast, AI-powered PPD detection systems eliminate observer variation and reduce the impact of environmental factors, improving the reliability of PPD assessment. In addition, AI-based algorithms enable efficient analysis of large datasets, facilitating rapid screening of cassava roots for PPD symptoms. This efficiency surpasses the time-consuming nature of manual visual scoring methods, leading to faster and more streamlined evaluations. Additionally, AI-powered classification provides objective scoring based on predefined criteria, reducing ambiguity, and increasing the reliability of PPD evaluation. By removing the subjectivity inherent in traditional scoring methods, AI ensures more consistent and reliable results. Furthermore, AI algorithms can detect subtle PPD symptoms that may be overlooked by human observers, enhancing the sensitivity of detection, and enabling early identification of affected roots. Standardization is another advantage offered by AI-powered methods. PPD assessment protocols can be standardized across different research settings, ensuring consistency and comparability of results among different studies and institutions. This standardization enhances the reliability and reproducibility of PPD evaluations, facilitating collaboration and data sharing among researchers. Finally, AI-powered systems are scalable and adaptable to various environments, making them suitable for large-scale screening efforts in breeding programs and research initiatives. This scalability enables efficient screening of large populations of cassava plants, accelerating the development of resilient varieties with improved post-harvest traits. In summary, AI-powered PPD detection and classification offer significant advantages in terms of accuracy, efficiency, objectivity, standardization, and scalability compared to traditional visual scoring methods. These advancements contribute to more reliable and comprehensive evaluations of PPD in cassava roots, ultimately supporting efforts to develop resilient cassava varieties with enhanced post-harvest traits. Conclusions and future directions This study investigated the performance of various YOLO model variants for detecting PPD in cassava roots, aiming to significantly advance cassava breeding and research efforts. By combining advanced image analysis techniques with deep learning models, we have established the foundation for a framework for PPD screening, promoting uniformity and consistency in PPD assessment methodologies, across cassava breeding programs. By standardizing PPD phenotyping, this AI-powered model is expected to accelerate the selection of PPD-resistant cassava lines, ultimately improving cassava productivity, quality, and food security in cassava dependent regions. By providing state-of-the-art AI-powered tools, including phenomics platforms, object detection and clustering models, we empower cassava breeders and researchers to accelerate crop improvement efforts. We envision our future research on AI-based application for PPD percentage quantification will work as a supportive tool for image classification. This methodology will be used to enrich the existing datasets, leading to further refinement of AI models to support scientists, field workers, and farmers reliant on cassava cultivation. Future research will aim to expand the dataset, refine quantification methods, and develop user-friendly software and mobile applications to broaden the platform's impact. By continuously refining and expanding this AI-powered phenotyping platform, we can expedite the breeding process, ultimately enabling the timely delivery of sustainable solutions to address the challenges posed by PPD in cassava production and value chains. Supplementary Information Additional file 1 Additional file 2 Acknowledgements The authors gratefully acknowledge the Alliance of Bioversity International and CIAT's Crop Nutrition and Health Division for their facilities and logistical support. Special appreciation goes to Joe Tohme from CIAT for his invaluable guidance and support throughout this research. We are also thankful to Dr. Luis Augusto Becerra for funding the purchase of the box and camera used for photography, and to Vianey Barrera for her contributions to the annotation of the photographs. We extend our thanks to Luisa Fernanda Leiva for her technical assistance in camera set-up and image acquisition software. Additionally, we appreciate the efforts of everyone involved in image annotation and data collection, as well as those who provided crucial support in capturing smartphone images. Finally, we are grateful to two anonymous reviewers for their constructive feedback, and to Angela Fernando and Jorge Casas from CIAT for their help with formatting and technical editing. Abbreviations Artificial Intelligence Average Precision Area under the precision-recall curve Confusion Matrix Convolutional Neural Network Common Objects in Context Deep learning Deep Transfer Learning False negatives False positives Mean Absolute Error Mean average precision Machine learning Neural Architecture Search Post-harvest physiological deterioration Segment Anything Model True negatives True positives You Only Look Once Author contributions M.G.S., D.G., J.C.G., A.M., and J.L.L. designed the study, conducted the experiments, and are the primary contributors to the paper. W.G.and T.T. assisted with writing, editing, and revising the manuscript. X.Z. designed the field experiments, and J.L.L. contributed to image collection and expert pre-screening of PPD images. M.G.S. wrote the paper, with all authors reviewing and providing corrections. Funding Not applicable. Availability of data and materials The datasets from this study are available from the corresponding author upon request. Declarations Ethics approval and consent to participate Not applicable. Consent for publication All authors agreed to publish this manuscript. Research Involving Plant Statement The authors confirm that all necessary permissions for root collection and imaging were obtained in compliance with regulations. The species used are not endangered. Competing interests The authors declare no competing interests. Footnotes Publisher's Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. References Associated Data Supplementary Materials Additional file 1 Additional file 2 Data Availability Statement The datasets from this study are available from the corresponding author upon request.