# A Real-Time Cotton Boll Disease Detection Model Based on Enhanced YOLOv11n
## 2 Materials and Methods
### Cotton Boll Disease Dataset Construction  
The common ball diseases mainly include ball rot, red rot, anthracose, and soft rot. The characteristics of ball diseases primarily consist of brown spots on the ball surface and yellow-brown, fuzz-like mold. These features provide a reference for rapid identification and detection of field diseases. The obtained ball disease image data are categorized into four types: uncracked green bolls, cotton bolls with opened fibers, lightly diseased bolls (with disease spots covering 0-50% of the ball surface area), and severely diseased bolls (with disease spots covering more than 50% of the entire ball surface area), as shown within the red rectangular box in Figure 3. The four-category grading scheme employed in this study is grounded primarily in observable morphological characteristics and practical field assessment expertise. It was designed to enhance operational efficiency for image recognition research and serve as a foundation for preliminary data organization. The disease severity thresholds (0-50% and \(>\)50% surface coverage) were established through consensus by experienced field technicians during data collection, based on standardized visual symptom assessments. This approach was adopted to capture distinct levels of visual symptom severity relevant to field scouting and potential management decisions.  
Figure 2: Examples of dataset images: (**a**) RGB-D camera collection, (**b**) manual collection, and (**c**) online collection. All images are in RGB format.  
Using LabelImg for annotation, the healthy uncracked green bolls, severely diseased bolls, lightly diseased bolls, and cotton bolls with opened fibers were labeled as \"0\", \"1\", \"2\", and \"3\", respectively.  
Although factors such as changes in lighting conditions and complex backgrounds in the natural environment were considered during the image collection process, with data collected from multiple angles, times, and locations, it is still impossible to capture all scenarios. To address these challenges, several data augmentation techniques were chosen, tailored to agricultural environmental conditions: color enhancement simulated lighting variations; mirroring and rotation facilitated multi-angle observation; and random occlusion mimicked partial obstructions caused by plant leaves or branches. Data augmentation was performed on the annotated boll disease images using the Python PIL (Pillow 10.0.0) library. Methods such as color enhancement, mirroring, rotation, adding Gaussian noise, random occlusion, and scaling were applied for multiple data augmentation techniques on a single image [8]. To ensure data quality, an augmentation screening framework based on agricultural pathological characteristics was developed. This framework enforces dual constraints--HSV hue variation \(\leq\)5\({}^{\circ}\) (preserving diagnostic color features such as the reddish-brown hue) and Structural Similarity Index (SSIM) >0.85 (maintaining lesion morphological integrity)--using an automated pipeline for real-time filtering of non-compliant samples. A sample of the data augmentation is shown in Figure 4. A total of 35,500 sample images were obtained and randomly divided into training, validation, and testing sets in an 8:1:1 ratio.  
Figure 3: Cotton boll disease dataset division: (**a**) uncracked green bolls, (**b**) severely diseased bolls, (**c**) lightly diseased bolls, and (**d**) opening cotton bolls.