Weilong He , Fan Wu , Lori Unruh Snyder , Jean Cheng , Evelynn Wilcox , Lirong Xiang
{"title":"Improved two-stage deep learning algorithm and lightweight YOLOv5n for classifying cottonseed damage","authors":"Weilong He , Fan Wu , Lori Unruh Snyder , Jean Cheng , Evelynn Wilcox , Lirong Xiang","doi":"10.1016/j.compag.2025.110042","DOIUrl":null,"url":null,"abstract":"<div><div>With a rich historical background, the US cotton industry consistently maintains its position as one of the leading global producers. Due to the direct correlation between cottonseed quality and germination rate, conducting non-destructive testing to identify defects in cottonseeds becomes important to optimize yield performance. In this study, we propose an objective method for detecting cottonseed defects which classifies cottonseeds into four categories (Normal, Pinhole, Damage, and Very Damaged) and fourteen subcategories (N, R, C, RH, EH, CH, R Cut, C Cut, RV, CV, RH Expose, EH Expose, CH Expose, and V). Leveraging our customized cottonseed image dataset, we introduce a cottonseed defect detection and classification method based on a lightweight YOLOv5n model enhanced with Swin Transformer and an improved two-stage deep learning classification model. For cottonseed detection, our method achieves a 30.11 % reduction in model size and a 7.7 % increase in <span><math><mrow><msub><mrow><mi>m</mi><mi>A</mi><mi>P</mi></mrow><mrow><mn>50</mn><mo>:</mo><mn>95</mn></mrow></msub></mrow></math></span> compared to YOLOv5n. For individual cottonseed image classification, the accuracy, precision, recall, and <span><math><mrow><msub><mi>F</mi><mn>1</mn></msub></mrow></math></span> scores of our two-stage deep learning model are 97.34 %, 97.7 %, 97.3 %, and 97.3 %, respectively. The gradient-weighted class activation mapping (Grad-CAM) algorithm was then used to visually explain the model’s classification mechanism. Moreover, our algorithm demonstrates superior performance compared to six commonly used classification algorithms, including ResNet-18, ResNet-50, AlexNet, GoogleNet, VGG-16, and VGG-19, achieving a notable 1.65 % increase in accuracy over the best-performing algorithm among them. We then compared its performance with four state-of-the-art (SOTA) cottonseed damage classification methods. The findings demonstrate the potential for this design to advance the development of non-destructive seed damage detection.</div></div>","PeriodicalId":50627,"journal":{"name":"Computers and Electronics in Agriculture","volume":"232 ","pages":"Article 110042"},"PeriodicalIF":7.7000,"publicationDate":"2025-02-07","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Computers and Electronics in Agriculture","FirstCategoryId":"97","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0168169925001486","RegionNum":1,"RegionCategory":"农林科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"AGRICULTURE, MULTIDISCIPLINARY","Score":null,"Total":0}
引用次数: 0
Abstract
With a rich historical background, the US cotton industry consistently maintains its position as one of the leading global producers. Due to the direct correlation between cottonseed quality and germination rate, conducting non-destructive testing to identify defects in cottonseeds becomes important to optimize yield performance. In this study, we propose an objective method for detecting cottonseed defects which classifies cottonseeds into four categories (Normal, Pinhole, Damage, and Very Damaged) and fourteen subcategories (N, R, C, RH, EH, CH, R Cut, C Cut, RV, CV, RH Expose, EH Expose, CH Expose, and V). Leveraging our customized cottonseed image dataset, we introduce a cottonseed defect detection and classification method based on a lightweight YOLOv5n model enhanced with Swin Transformer and an improved two-stage deep learning classification model. For cottonseed detection, our method achieves a 30.11 % reduction in model size and a 7.7 % increase in compared to YOLOv5n. For individual cottonseed image classification, the accuracy, precision, recall, and scores of our two-stage deep learning model are 97.34 %, 97.7 %, 97.3 %, and 97.3 %, respectively. The gradient-weighted class activation mapping (Grad-CAM) algorithm was then used to visually explain the model’s classification mechanism. Moreover, our algorithm demonstrates superior performance compared to six commonly used classification algorithms, including ResNet-18, ResNet-50, AlexNet, GoogleNet, VGG-16, and VGG-19, achieving a notable 1.65 % increase in accuracy over the best-performing algorithm among them. We then compared its performance with four state-of-the-art (SOTA) cottonseed damage classification methods. The findings demonstrate the potential for this design to advance the development of non-destructive seed damage detection.
期刊介绍:
Computers and Electronics in Agriculture provides international coverage of advancements in computer hardware, software, electronic instrumentation, and control systems applied to agricultural challenges. Encompassing agronomy, horticulture, forestry, aquaculture, and animal farming, the journal publishes original papers, reviews, and applications notes. It explores the use of computers and electronics in plant or animal agricultural production, covering topics like agricultural soils, water, pests, controlled environments, and waste. The scope extends to on-farm post-harvest operations and relevant technologies, including artificial intelligence, sensors, machine vision, robotics, networking, and simulation modeling. Its companion journal, Smart Agricultural Technology, continues the focus on smart applications in production agriculture.