A potato surface defect detection method and system based on YOLOv8
By improving the YOLOv8 network model and introducing GSConv, CoordAtt, and BiFPN modules, the problem of insufficient multi-scale feature representation ability in potato surface defect detection was solved, achieving high-precision and efficient defect detection.
Patent Information
- Application Number
- CN202610393912.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-27
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technologies struggle to ensure both detection accuracy and multi-scale feature representation in potato surface defect detection. Traditional methods exhibit limited robustness and generalization ability under conditions of complex lighting variations, diverse defect morphologies, or strong background interference.
An improved YOLOv8 network model is adopted, which introduces a lightweight convolution module GSConv, an attention enhancement module CoordAtt, and a weighted bidirectional feature fusion module BiFPN to construct a multi-scale feature extraction and fusion mechanism, enhance the perception of small, elongated and local defect regions, and achieve adaptive weighted fusion.
It improves the accuracy and localization of potato surface defect detection, enhances the model's adaptability in complex scenarios, and achieves efficient detection of multi-scale defects.
Smart Images

Figure CN122492556A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent detection of agricultural products and computer vision technology, and in particular to a method and system for detecting surface defects in potatoes based on YOLOv8. Background Technology
[0002] As an important food and economic crop, the appearance quality of potatoes directly affects food safety, processing quality, and commercial grading value. During harvesting, transportation, storage, and processing, potatoes are prone to various surface defects, such as mechanical damage and cracks. These defects not only affect the commercial appearance of potatoes but may also lead to physiological deterioration or microbial contamination, reducing storage stability and even jeopardizing food safety.
[0003] Existing methods for detecting potato defects mainly rely on manual visual inspection or simple traditional machine vision methods. However, manual inspection suffers from problems such as high labor intensity, strong subjectivity, low efficiency, and poor consistency, making it difficult to meet the needs of large-scale production and standardized grading. Detection methods based on traditional image processing usually rely on manually designed features, such as color thresholds, texture features, or morphological features. Under conditions of complex lighting changes, diverse defect morphologies, or strong background interference, their robustness and generalization ability are limited.
[0004] Therefore, there is a need for a method, system, and medium for detecting potato surface defects that can ensure detection accuracy while also taking into account the ability to express multi-scale features. Summary of the Invention
[0005] The main objective of this invention is to provide a method and system for detecting potato surface defects based on YOLOv8, aiming to solve the problem that existing methods for detecting potato surface defects are difficult to guarantee detection accuracy while also taking into account the ability to express multi-scale features.
[0006] To achieve the above objectives, this invention proposes a potato surface defect detection method based on an improved YOLOv8, the method comprising the following steps:
[0007] We acquired potato surface defect image data and integrated them into a surface defect dataset. We then expanded the surface defect dataset using data augmentation methods and divided the expanded surface defect dataset into a training set, a validation set, and a test set.
[0008] A YOLOv8 network model for potato defects is constructed. The network model includes a backbone feature extraction network, a feature fusion network, and a detection head network. The backbone feature extraction network includes a lightweight convolutional module and an attention enhancement module. The feature fusion network includes a weighted bidirectional feature fusion module.
[0009] The training set is input into the potato defect YOLOv8 network model for iterative training to obtain the trained potato defect YOLOv8 network model.
[0010] The images to be detected in the test set are input into the trained YOLOv8 network model for potato defects to obtain prediction results, thus completing the detection of potato surface defects.
[0011] Preferably, the lightweight convolutional module is a GSConv convolutional module, the attention enhancement module is a CoordAtt attention module, and the weighted bidirectional feature fusion module is a BiFPN module.
[0012] Preferably, the CoordAtt attention module is located at the output of at least a portion of the C2f modules in the backbone feature extraction network.
[0013] Preferably, the BiFPN module is located at at least a portion of the splicing layer positions in the feature fusion network, and the GSConv convolution module is located at at least a portion of the standard convolutional layer positions in the feature fusion network.
[0014] This invention also discloses a potato surface defect detection system based on an improved YOLOv8, the improved YOLOv8-based potato surface defect detection system comprising:
[0015] The network model includes a backbone feature extraction network, a feature fusion network, and a detection head network;
[0016] The backbone feature extraction network includes a lightweight convolutional module and an attention enhancement module. The lightweight convolutional module is used to perform multi-scale feature extraction on the input feature map, and the attention enhancement module is used to jointly encode the channel information and spatial location information of the feature map of the intermediate layer of the backbone feature extraction network. The lightweight convolutional module is a GSConv convolutional module, the attention enhancement module is a CoordAtt attention module, and the weighted bidirectional feature fusion module is a BiFPN module.
[0017] The feature fusion network includes a weighted bidirectional feature fusion module, which is used to adaptively weighted fuse feature maps of different scales;
[0018] The detection head network outputs the category and location information of potato surface defects based on the fused multi-scale features.
[0019] Preferably, the GSConv convolution module includes a main branch convolution and a sub-branch depthwise separable convolution. The features output by the main branch convolution and the sub-branch depthwise separable convolution are concatenated in the channel dimension, and cross-channel information interaction is achieved through channel shuffling operation.
[0020] Preferably, in the backbone feature extraction network, at least some of the C2f modules have the CoordAtt attention module at their output ends, at least some of the splicing layers are replaced with the BiFPN module, and at least some of the standard convolutional layers are replaced with the GSConv convolutional module.
[0021] Preferably, the CoordAtt attention module performs global average pooling along the height and width directions of the feature map, and generates direction-dependent attention weights through convolution transformation. The attention weights are then multiplied by the input feature map to obtain a weighted feature map.
[0022] The present invention also discloses a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program, when executed by a processor, performs the steps of the potato surface defect detection method based on the improved YOLOv8 as described in any of the above technical solutions.
[0023] This invention introduces a lightweight convolutional structure, GSConv, into the backbone feature extraction network. This effectively reduces the number of network parameters and computational complexity while ensuring feature representation capabilities, thereby improving the model's deployment adaptability in real-world application scenarios. The introduction of the CoordAtt module enhances the network's ability to perceive small, elongated, and localized defect regions, improving the accuracy of defect localization and enhancing the model's overall adaptability to complex defect scenarios. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the processes shown in these drawings without creative effort.
[0025] Figure 1 A schematic flowchart illustrating the preparation method of a potato surface defect detection method based on an improved YOLOv8 according to an embodiment of the present invention;
[0026] Figure 2 This is a network structure diagram of a trained YOLOv8 network model for potato defects provided in an embodiment of the present invention;
[0027] Figure 3 This is a schematic diagram of BiFPN feature fusion provided in an embodiment of the present invention;
[0028] Figure 4This is a schematic diagram of the internal structure of the GSConv module provided in an embodiment of the present invention;
[0029] Figure 5 This is a schematic diagram of the CoordAtt module provided in an embodiment of the present invention. Detailed Implementation
[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0031] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.
[0032] Furthermore, the use of terms such as "first" and "second" in this invention is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Additionally, the technical solutions of the various embodiments can be combined with each other, but only on the basis of being achievable by those skilled in the art. When the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed by this invention.
[0033] In recent years, with the development of deep learning technology, object detection methods based on convolutional neural networks have been widely applied in the field of agricultural product appearance defect detection. Among them, the YOLO series of algorithms have good engineering advantages in practical applications due to their end-to-end detection structure and high inference efficiency. However, directly applying the existing YOLO to potato surface defect detection still has shortcomings. On the one hand, potato surface defects are diverse, and different defects vary significantly in scale, morphology, and spatial distribution. Regardless of whether the defect presents a thin and elongated structure or local weak features, key information is easily lost during downsampling. On the other hand, the complex network structure and numerous standard convolution operations of the native YOLO, while ensuring detection accuracy, often result in a high number of parameters and computational complexity, which is not conducive to deployment in resource-constrained actual sorting equipment or embedded scenarios. In addition, traditional feature fusion methods lack adaptive adjustment capabilities for the contribution of features at different scales, making it difficult to fully leverage the complementary advantages of multi-level features in multi-class defect detection.
[0034] Based on this, the present invention provides a method for detecting surface defects of potatoes based on an improved YOLOv8, comprising the following steps:
[0035] Step S10: Obtain potato surface defect image data and integrate them into a surface defect dataset. Expand the surface defect dataset using data augmentation methods and divide the expanded surface defect dataset into a training set, a validation set, and a test set.
[0036] Step S20: Construct a YOLOv8 network model for potato defects. The network model includes a backbone feature extraction network, a feature fusion network, and a detection head network. The backbone feature extraction network includes a lightweight convolutional module and an attention enhancement module, and the feature fusion network includes a weighted bidirectional feature fusion module.
[0037] Step S30: Input the training set into the potato defect YOLOv8 network model for iterative training to obtain the trained potato defect YOLOv8 network model.
[0038] Step S40: Input the images to be detected from the test set into the trained potato defect YOLOv8 network model to obtain the prediction results and complete the detection of potato surface defects.
[0039] It is understandable that, such as Figure 1 As shown, this invention improves the sampling convolutional structure of the native YOLOv8 backbone feature extraction network by introducing a lightweight GSConv convolutional module to replace at least some of the standard convolutional layers in the native YOLOv8. This module is used to construct a multi-level sampling feature extraction structure, reducing the number of parameters and computation while improving feature representation capabilities. Simultaneously, a CoordAtt module is introduced at different feature stages to enhance the network's spatial localization ability for potato surface defect regions, especially fine-grained defects such as cracks and insect holes, through joint modeling of channel information and spatial location. In the feature fusion network, a weighted bidirectional feature pyramid network (BiFPN) structure is introduced to replace the original simple feature splicing fusion method. This invention improves the fusion effect of multi-scale defect features by adaptively weighting and fusing feature maps from different scales, enabling the network to automatically adjust the contribution ratio of each layer's features according to the defect scale. After feature fusion is completed, the detection head network makes predictions at three scales, P3, P4 and P5, based on the fused multi-scale features, and outputs the category and location information of potato surface defects, thus realizing the joint detection of multi-scale and multi-category defects.
[0040] In detail, in this invention, step S30 further includes the following steps:
[0041] Step S31: Input the training set into the potato defect YOLOv8 network model for iterative training. After training, the model with the best weights is obtained.
[0042] Step S32: Verify the performance of the best.pt model with optimal weights using a validation set and evaluate the best.pt model with optimal weights using evaluation metrics.
[0043] Step S40 also includes the following steps:
[0044] Step S41: Set the potato defect YOLOv8 network model to predict mode, load the obtained optimal weight best.pt model, input the image to be detected in the test set, obtain the prediction result, and complete the detection of potato surface defects.
[0045] Step S42: Based on the prediction results obtained in step S41, the detection accuracy and defect localization performance of the YOLOv8 network model for potato defects are statistically evaluated.
[0046] Among them, 10. The evaluation of model performance includes the following indicators:
[0047] (1) Mean accuracy mAP@50:
[0048]
[0049] Where C represents the number of defect categories, AP c This represents the average precision of class c.
[0050] (2) Precision and Recall
[0051] ,
[0052] ;
[0053] Where TP represents the number of true positive samples, FP represents the number of false positive samples, and FN represents the number of missed samples.
[0054] (3) F1 score:
[0055]
[0056] The above indicators can be used to comprehensively evaluate the best.pt model with optimal weights and the YOLOv8 network model for potato defects, thereby enabling quantitative analysis of the performance of potato surface defect detection.
[0057] In one embodiment, the lightweight convolutional module is the GSConv convolutional module, the attention enhancement module is the CoordAtt attention module, and the weighted bidirectional feature fusion module is the BiFPN module.
[0058] In this embodiment, as Figure 2 As shown, in the downsampling stage of the backbone feature extraction network, the standard convolutional Conv modules in layers 0, 1, 4, 7, and 10 of the original YOLOv8 backbone network structure are uniformly replaced with GSConv convolutional modules to construct multi-level downsampling feature extraction layers.
[0059] This invention also discloses a potato surface defect detection system based on an improved YOLOv8, which includes:
[0060] The network model includes a backbone feature extraction network, a feature fusion network, and a detection head network.
[0061] The backbone feature extraction network includes a lightweight convolution module and an attention enhancement module. The lightweight convolution module is used to extract multi-scale features from the input feature map, and the attention enhancement module is used to jointly encode the channel information and spatial location information of the feature map of the intermediate layer of the backbone feature extraction network. The lightweight convolution module is the GSConv convolution module, the attention enhancement module is the CoordAtt attention module, and the weighted bidirectional feature fusion module is the BiFPN module.
[0062] The feature fusion network includes a weighted bidirectional feature fusion module, which is used to adaptively weight and fuse feature maps at different scales;
[0063] The detection head network outputs the category and location information of potato surface defects based on the fused multi-scale features.
[0064] This invention also discloses an ablation experiment and analysis of the experimental results of the present potato defect YOLOv8 network model to verify the independent contribution and synergistic effect of each improved module to the potato defect detection performance.
[0065] The ablation experiment used the same dataset partitioning, training format, and hyperparameter settings as the potato defect YOLOv8 network model in this invention. The modules and combinations disclosed in this invention were introduced onto the native YOLOv8 network. mAP@0.5 was used as the main evaluation metric to compare and analyze the detection performance of different structural configurations. Specific experimental results are as follows:
[0066] Table 1 compares the mAP@0.5 of potato defect YOLOv8 network models with different modules loaded on the test set.
[0067] Native YOLOv8 × × × 92.4 Model 1 √ × × 92.6 Model 2 × √ × 93.5 Model 3 × × √ 93.1 Model 4 √ √ × 93.9 Model 5 √ × √ 93.2 Model 6 × √ √ 94.9 This invention model √ √ √ 95.4
[0068] As can be seen, Model 1 only loads the GSConv convolutional module; Model 2 only loads the CoordAtt attention module; Model 3 only loads the BiFPN module; Model 4 only loads the GSConv convolutional module and the CoordAtt attention module; Model 5 only loads the GSConv convolutional module and the BiFPN module; Model 6 only loads the CoordAtt attention module and the BiFPN module; and the model of this invention is the potato defect YOLOv8 network model trained according to step S30 of the potato surface defect detection method based on the improved YOLOv8 in this invention.
[0069] As shown in Table 1, each of the three modules (Models 1-3) individually contributes to a certain degree of performance improvement, but the magnitude of the improvement varies. The native YOLOv8 model has an mAP@0.5 of 92.4%. After adding the lightweight convolution module (Model 1), the mAP@0.5 increases to 92.6%, a relatively small increase, indicating that this module has limited direct contribution to detection accuracy and is more inclined to maintain feature representation ability under lightweight constraints. Adding the spatial attention mechanism alone (Model 2) can improve mAP@0.5 to 93.5%, indicating that position-sensitive attention modeling helps to enhance the response of defect regions, especially for fine-grained defects. Introducing the weighted feature fusion mechanism alone (Model 3) makes mAP@0.5 reach 93.1%, indicating that multi-scale feature fusion can improve the model's ability to represent scale-changing defect targets, but its individual improvement is lower than that of the spatial attention mechanism.
[0070] In the combined experiments (Models 4-6), the synergistic effect of spatial attention and weighted feature fusion was the most significant. Model 6 (with only spatial attention and weighted feature fusion) achieved an mAP@0.5 of 94.9%, an improvement of 2.5 percentage points compared to the baseline, significantly higher than the other pairwise combinations, indicating that "defect region feature enhancement + multi-scale information fusion" has complementary gains for potato defect detection. In contrast, the combination of lightweight convolution and spatial attention (Model 4) reached 93.9%, and the combination of lightweight convolution and weighted feature fusion (Model 5) reached 93.2%, both lower than Model 6, further indicating that lightweight convolution plays a more auxiliary role in improving accuracy.
[0071] Ultimately, the complete improved model (incorporating all three modules) achieved an mAP@0.5 of 95.4%, a 3.0 percentage point improvement over the baseline, representing the best result in this ablation experiment. This indicates that each improved module positively contributes to the detection performance, and exhibits a significant synergistic enhancement effect after gradual stacking. GSConv improves feature extraction efficiency, CoordAtt enhances the spatial perception capability of defect regions, and BiFPN effectively improves the quality of multi-scale feature fusion. The combined effect of these three modules enables the improved YOLOv8 model to achieve high-precision detection of multiple types of potato defects while maintaining lightweight design and real-time performance.
[0072] In one embodiment, the GSConv convolution module includes a main branch convolution and a sub-branch depthwise separable convolution. The features output by the main branch convolution and the sub-branch depthwise separable convolution are concatenated in the channel dimension, and cross-channel information interaction is achieved through a channel shuffling operation.
[0073] In detail, the GSConv module consists of main branch convolutions and sub-branch depthwise separable convolutions, and its feature fusion method satisfies the following relationship:
[0074] ;
[0075] Among them, F out Indicates the output feature map; F main F represents the output features of the main branch convolution; aux The output features of the sub-branch depthwise convolution are represented by ; Shuffle(·) represents the channel shuffling operation, used to enhance the information interaction between channels; Concat(·) represents channel concatenation.
[0076] In one embodiment, in the backbone feature extraction network, at least some of the C2f modules have a CoordAtt attention module at their output, at least some of the splicing layers are replaced with BiFPN modules, and at least some of the standard convolutional layers are replaced with GSConv convolutional modules.
[0077] like Figures 3-5 As shown, in the feature fusion network, one embodiment of the present invention introduces a weighted bidirectional feature pyramid (BiFPN) module to replace the simple feature splicing and fusion method in the native YOLOv8. Specifically, at layer 14, the present invention introduces a BiFPN module to perform weighted fusion of upsampled features and the output features of layer 8 of the backbone feature extraction network; at layer 17, a BiFPN module is introduced to perform weighted fusion of upsampled features and the output features of layer 5 of the backbone feature extraction network; and the standard convolutional Conv modules in layers 19 and 22 are uniformly replaced with GSConv convolutional modules.
[0078] BiFPN's feature fusion method satisfies the following relationship:
[0079]
[0080] Among them, F i Let ω represent the i-th feature map. i ω represents the corresponding learnable weight parameter. j The weights of the input features, where ε is a constant to prevent the denominator from being zero.
[0081] In one embodiment, the CoordAtt attention module performs global average pooling along the height and width directions of the feature map, and generates direction-dependent attention weights through convolution transformation. The attention weights are then multiplied by the input feature map to obtain a weighted feature map.
[0082] In detail, the CoordAtt module in this invention performs global average pooling along the height and width directions of the feature map to generate direction-dependent attention weights, and its attention calculation process satisfies:
[0083] ;
[0084] ;
[0085] in, (·) represents the Sigmoid activation function, A h A represents the attention weight in the height direction. w f represents the attention weights in the width direction. w This refers to a function (usually a convolution or fully connected operation) that processes the features after pooling in the width direction. h This refers to a function that processes features obtained through height-oriented pooling.
[0086] The input features are then weighted using the following formula, the specific formula of which is as follows:
[0087]
[0088] Where F' represents the output feature map after attention weighting, and ⊙ represents element-wise multiplication.
[0089] The present invention also discloses a computer-readable storage medium, wherein the storage medium is a computer-readable storage medium and stores a computer program thereon. When the computer program is executed by a processor, the steps of the potato surface defect detection method based on the improved YOLOv8 according to any of the above technical solutions are as follows.
[0090] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0091] The aforementioned computer-readable storage medium may be included in a device for detecting potato surface defects; or it may exist independently and not assembled into a device for detecting potato surface defects.
[0092] It is understood that the present invention may also relate to a device for detecting surface defects of potatoes, the device comprising:
[0093] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method for detecting potato surface defects based on YOLOv8 as described in Embodiment 1 above.
[0094] The device for detecting potato surface defects in this application embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. The device for detecting potato surface defects disclosed above is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments in this application.
[0095] It should be understood that the various parts disclosed in this invention can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples.
[0096] The above description is merely a specific embodiment of the present invention, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0097] This invention introduces a lightweight convolutional structure, GSConv, into the backbone feature extraction network. This effectively reduces the number of network parameters and computational complexity while maintaining feature representation capabilities, thus improving the model's deployment adaptability in practical application scenarios. The introduction of the CoordAtt module combines channel information with spatial location information, enhancing the network's ability to perceive small, elongated, and localized defect regions and improving the accuracy of defect localization. The adoption of a weighted bidirectional feature pyramid (BiFPN) structure enables adaptive fusion of features at different scales, improving the network's comprehensive detection capability for multi-scale potato surface defects. Through the collaborative output of multi-scale detection heads, the system can simultaneously address the detection needs of both large-scale and small-scale defects, enhancing the model's overall adaptability to complex defect scenarios.
[0098] The above description is merely a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural transformations made using the contents of the present invention's specification and drawings under the inventive concept of the present invention, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.
Claims
1. A potato surface defect detection method based on improved YOLOv8, characterized by, The method for detecting surface defects in potatoes includes the following steps: We acquired potato surface defect image data and integrated them into a surface defect dataset. We then expanded the surface defect dataset using data augmentation methods and divided the expanded surface defect dataset into a training set, a validation set, and a test set. A YOLOv8 network model for potato defects is constructed. The network model includes a backbone feature extraction network, a feature fusion network, and a detection head network. The backbone feature extraction network includes a lightweight convolutional module and an attention enhancement module. The feature fusion network includes a weighted bidirectional feature fusion module. The training set is input into the potato defect YOLOv8 network model for iterative training to obtain the trained potato defect YOLOv8 network model. The images to be detected in the test set are input into the trained YOLOv8 network model for potato defects to obtain prediction results, thus completing the detection of potato surface defects.
2. The improved YOLOv8-based potato surface defect detection method of claim 1, wherein, The lightweight convolutional module is the GSConv convolutional module, the attention enhancement module is the CoordAtt attention module, and the weighted bidirectional feature fusion module is the BiFPN module.
3. The improved YOLOv8-based potato surface defect detection method of claim 2, wherein, The CoordAtt attention module is located at the output of at least a portion of the C2f modules in the backbone feature extraction network.
4. The improved YOLOv8-based potato surface defect detection method of claim 2, wherein, The BiFPN module is located at least in a portion of the splicing layer positions in the feature fusion network, and the GSConv convolution module is located at least in a portion of the standard convolutional layer positions in the feature fusion network.
5. A potato surface defect detection system based on improved YOLOv8, characterized in that, The potato surface defect detection system based on the improved YOLOv8 includes: The network model includes a backbone feature extraction network, a feature fusion network, and a detection head network; The backbone feature extraction network includes a lightweight convolutional module and an attention enhancement module. The lightweight convolutional module is used to perform multi-scale feature extraction on the input feature map, and the attention enhancement module is used to jointly encode the channel information and spatial location information of the feature map of the intermediate layer of the backbone feature extraction network. The lightweight convolutional module is a GSConv convolutional module, the attention enhancement module is a CoordAtt attention module, and the weighted bidirectional feature fusion module is a BiFPN module. The feature fusion network includes a weighted bidirectional feature fusion module, which is used to adaptively weighted fuse feature maps of different scales; The detection head network outputs the category and location information of potato surface defects based on the fused multi-scale features.
6. The potato surface defect detection system based on improved YOLOv8 as described in claim 5, characterized in that, The GSConv convolution module includes a main branch convolution and a sub-branch depthwise separable convolution. The features output by the main branch convolution and the sub-branch depthwise separable convolution are concatenated in the channel dimension, and cross-channel information interaction is achieved through channel shuffling operation.
7. The potato surface defect detection system based on improved YOLOv8 as described in claim 6, characterized in that, In the backbone feature extraction network, at least some of the C2f modules have the CoordAtt attention module at their output, at least some of the splicing layers are replaced with the BiFPN module, and at least some of the standard convolutional layers are replaced with the GSConv convolutional module.
8. The potato surface defect detection system based on improved YOLOv8 as described in claim 7, characterized in that, The CoordAtt attention module performs global average pooling along the height and width directions of the feature map, and generates direction-related attention weights through convolution transformation. The attention weights are then multiplied by the input feature map to obtain a weighted feature map.
9. A computer-readable storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it performs the steps of the potato surface defect detection method based on the improved YOLOv8 as described in any one of claims 1 to 4.