Small target detection and identification method and system based on improved YOLOv8
By improving the YOLOv8 network model, combining dynamic snake convolution and dual-stage screening mechanism, the problems of low micro-object recognition accuracy and weak anti-interference ability in industrial detection are solved, and high-precision and real-time micro-object detection are achieved.
Patent Information
- Application Number
- CN202510949370.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-10
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-07-10
AI Technical Summary
In industrial inspection, the recognition accuracy of small targets is low and the anti-interference ability is weak. Traditional methods are difficult to adapt to complex and changeable industrial environments, resulting in high missed detection rates and high error detection rates, and large model calculations cannot meet the real-time requirements.
The improved YOLOv8 network model is adopted to replace the dynamic snake-shaped convolution module of the C2f module in the backbone network as a four-branch hollow convolution group, and a two-stage filtering mechanism is deployed after the detection head. Combining Gaussian filtering and data enhancement strategies, an improved YOLOv8 model is built.
The recognition accuracy and anti-interference ability of micro-targets are improved, feature extraction is enhanced through dynamic snake convolution module, and the positioning accuracy is optimized by the dual-stage screening mechanism, which solves the problems of low recognition accuracy and weak anti-interference ability of micro-targets in traditional methods, and meets the real-time requirements of industrial detection.
Smart Images

Figure CN120451518A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of target recognition technology, and in particular relates to a small target detection and recognition method and system based on improved YOLOv8. Background Art
[0002] In industries such as precision electronics manufacturing and aerospace, the detection of tiny objects (such as chip solder joints and micron-level cracks) is a core component of quality control. Traditional manual visual inspection is inefficient and prone to missed detections, while traditional rule-based image processing techniques struggle to adapt to complex and changing industrial environments. With the advancement of deep learning, object detection algorithms are increasingly being applied to automated quality inspection. However, due to their low pixel count and less distinct features, small objects in industrial scenarios still suffer from insufficient recognition accuracy and weak anti-interference capabilities, necessitating targeted optimization solutions.
[0003] Existing small target detection methods based on deep learning have significant limitations in industrial applications: the feature extraction network of general detection models does not adequately capture the texture and geometric features of small targets, resulting in a high rate of missed detection of minor defects; interference factors such as metal reflections and complex backgrounds in industrial scenes can easily lead to false detections, and traditional attention mechanisms have difficulty effectively distinguishing targets from noise; the contradiction between model complexity and detection speed is prominent, and high-precision models often have large computational complexity and cannot meet the real-time requirements of production lines; in addition, traditional methods lack dynamic adaptation mechanisms and cannot cope with production line environment fluctuations such as equipment vibration and lighting changes, which restricts the implementation of the technology.
[0004] Therefore, there is an urgent need to develop small target detection and recognition methods and systems based on the improved YOLOv8, which can solve the technical problems of low accuracy in small target recognition and weak anti-interference ability in industrial detection. Summary of the Invention
[0005] In order to solve the above technical problems, the present invention provides a small target detection and recognition method and system based on improved YOLOv8, which can solve the technical problems of low small target recognition accuracy and weak anti-interference ability in industrial detection.
[0006] The present invention provides a small target detection and recognition method based on improved YOLOv8, the method comprising the following steps:
[0007] S1. Obtain small target defect images of industrial inspection objects, preprocess the small target defect images, and annotate the preprocessed defect images to construct a small target defect image dataset;
[0008] S2. Based on the YOLOv8 network model, the C2f module in the backbone network of the YOLOv8 network model is replaced with a dynamic snake convolution module containing a four-branch dilated convolution group, and a two-stage screening mechanism is deployed after the detection head to build an improved YOLOv8 model;
[0009] S3. Use the small target defect image dataset to train the improved YOLOv8 model to obtain a trained improved YOLOv8 model;
[0010] S4. Input the optical image of the object to be detected into the trained improved YOLOv8 model for small target defect detection and recognition.
[0011] Furthermore, in S1, preprocessing the small target defect image includes eliminating image noise through Gaussian filtering and performing data enhancement processing on the small target defect image.
[0012] Furthermore, in S1, the pre-processed defect image is labeled, including labeling the defect category label and the bounding box coordinates of the defect location.
[0013] Furthermore, in S2, the dynamic snake convolution module containing a four-branch dilated convolution group includes:
[0014] The dynamic snake convolution module consists of four parallel branches, each of which is equipped with a dilated convolution kernel with a different dilation rate. The output features of branches with different dilation rates are fused through feature splicing.
[0015] Furthermore, the dynamic offset accumulation formula of the dynamic snake convolution module is defined as follows:
[0016] ;
[0017] in, represents the dynamic offset of the k-th layer feature map, represents the dynamic offset of the k+1th layer feature map, k represents the layer index of the feature map, f θ represents the learnable offset prediction function, x k Represents the feature map of the k-th layer input.
[0018] Furthermore, the output features of branches with different expansion rates are fused through feature concatenation, including:
[0019] ;
[0020] Among them, F out represents the fused output feature map, Concat(·) represents the operator for concatenating multi-branch features along the channel dimension, and F d1 、F d2 、F d3 、F d4 Represent the output feature maps of the first, second, third, and fourth expansion rate branches, respectively, W fusion Represents the fusion weight matrix.
[0021] Furthermore, in S2, the two-stage screening mechanism includes the first stage and the second stage. The first stage screens candidate detection boxes based on the confidence threshold, and the second stage optimizes the boundary positioning through super-resolution reconstruction.
[0022] Furthermore, the first stage includes setting a confidence threshold after the detection head and filtering candidate detection boxes by conditional probability as follows:
[0023] P keep ={p i |σ(cls i )·σ(conf i )>T c};
[0024] Among them, P keep represents the set of candidate detection boxes retained, p i represents the i-th candidate detection box, σ represents the sigmoid function, cls i Indicates the classification score of the i-th candidate detection box, conf i represents the confidence score of the i-th candidate detection box, T c Represents the confidence threshold.
[0025] Furthermore, the second phase includes:
[0026] According to the initial position of the retained candidate detection frame, the corresponding region of interest is extracted from the feature maps of different levels;
[0027] The deconvolution kernel is used to perform feature upsampling on the region of interest at each level to generate residual compensation;
[0028] The corrected detection frame is obtained based on the initial position of the retained candidate detection frame and the residual compensation amount.
[0029] The present invention also provides a small target detection and recognition system based on improved YOLOv8, which is used to perform the above-mentioned small target detection and recognition method based on improved YOLOv8. The system includes the following modules:
[0030] The data acquisition module is used to acquire small target defect images of industrial inspection objects, preprocess the small target defect images, and annotate the preprocessed defect images to construct a small target defect image dataset;
[0031] The model construction module is used to replace the C2f module in the backbone network of the YOLOv8 network model with a dynamic snake convolution module containing a four-branch dilated convolution group, and deploy a two-stage screening mechanism after the detection head to build an improved YOLOv8 model.
[0032] The model training module is connected to the data acquisition module and the model construction module, and is used to train the improved YOLOv8 model using the small target defect image dataset to obtain a trained improved YOLOv8 model;
[0033] The target detection module is connected to the model training module and is used to input the optical image of the object to be detected into the trained improved YOLOv8 model for small target defect detection and recognition.
[0034] The embodiments of the present invention have the following technical effects:
[0035] The present invention combines a dynamic serpentine convolution module with a two-stage screening mechanism. The dynamic serpentine convolution module uses a four-branch hole convolution group to construct multi-scale perception capabilities. The dynamic offset accumulation formula enables the convolution kernel to adaptively adjust the sampling position along the target contour, effectively capturing the geometric deformation characteristics of tiny defects. Its multi-branch feature splicing and fusion weight matrix realizes the coordinated enhancement of local details and global context, solving the problem of insufficient extraction of slender edge features by traditional convolution. The two-stage screening mechanism improves positioning accuracy through progressive processing of confidence threshold screening and super-resolution optimization: the first stage filters low-quality candidate frames based on joint probability to suppress background interference; the second stage uses multi-level feature deconvolution to generate residual compensation, and realizes sub-pixel bounding box correction through cross-scale feature fusion, which is particularly effective in optimizing the edge blur problem of tiny targets. In addition, Gaussian filtering preprocessing and data enhancement strategies enhance the model's adaptability to noise interference and scale changes, while the topological continuity constraint of dynamic serpentine convolution further ensures the structural integrity of complex tubular defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0037] Figure 1 This is a flowchart of a small target detection and recognition method based on improved YOLOv8 provided by an embodiment of the present invention;
[0038] Figure 2 1 is a schematic structural diagram of an improved YOLOv8 model provided by an embodiment of the present invention;
[0039] Figure 3 Schematic diagram of a workflow of a two-stage screening mechanism provided by an embodiment of the present invention;
[0040] Figure 43 is a schematic diagram of the structure of a small target detection and recognition system based on improved YOLOv8 provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0041] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention are described clearly and completely below. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are also within the scope of protection of the present invention.
[0042] The embodiment of the present invention provides a small target detection and recognition method based on improved YOLOv8. Figure 1 This is a flowchart of a small target detection and recognition method based on improved YOLOv8 provided by an embodiment of the present invention. Figure 2 This is a schematic diagram of the structure of an improved YOLOv8 model provided by an embodiment of the present invention, see Figure 1 and Figure 2 , the method comprises the following steps:
[0043] S1. Obtain small target defect images of industrial inspection objects, preprocess the small target defect images, and annotate the preprocessed defect images to construct a small target defect image dataset.
[0044] First, a high-resolution original image is obtained through an industrial camera or microscope. The original image needs to be preprocessed to eliminate imaging noise and enhance defect features. Among them, the preprocessing stage uses a Gaussian filtering algorithm to smooth the image, and uses a two-dimensional Gaussian function to generate a convolution kernel. The high-frequency noise is suppressed by weighted averaging, while retaining the defect edge information. The weight distribution of the Gaussian kernel has a centrally symmetric attenuation characteristic, which can effectively suppress Gaussian noise and salt and pepper noise, while avoiding edge blurring caused by mean filtering. In industrial inspection scenarios, the Gaussian kernel size and standard deviation parameters need to be dynamically adjusted according to the defect size and background complexity to ensure a balance between noise suppression and detail retention. For example, for micron-level electronic component defects, a smaller kernel size is used to avoid over-smoothing; for macroscopic defects on metal surfaces, the kernel size can be appropriately increased to eliminate large-area noise interference.
[0045] Data augmentation is performed on small target defect images. Data augmentation can expand sample diversity through random rotation, mirror flipping, scaling, and mosaic multi-image stitching, improving the model's adaptability to changes in defect morphology. Preprocessed defect images are annotated with defect category labels (such as cracks and pores) and bounding box coordinates of the defect locations to construct a structured dataset. Data augmentation strategies must be customized for the characteristics of small targets. Mosaic augmentation randomly splices four training images together, simulating defect distribution in a complex background through scaling and color perturbation, significantly improving the model's ability to learn contextual relevance for small targets. Random rotation and mirroring operations enhance the model's perception of defect orientation invariance. Local occlusion simulation randomly erases image regions, forcing the model to focus on local key features of the defect rather than global statistical characteristics. Furthermore, to address uneven illumination, histogram equalization and contrast-constrained adaptive histogram equalization techniques are used to enhance the contrast difference between the defect area and the background, improving feature recognition in low-light conditions.
[0046] S2. Based on the YOLOv8 network model, the C2f module in the backbone network of the YOLOv8 network model is replaced with a dynamic snake convolution module containing a four-branch dilated convolution group, and a two-stage screening mechanism is deployed after the detection head to construct an improved YOLOv8 model.
[0047] In some embodiments, to address the limitations of traditional convolution operations in extracting small object features, a dynamic snake convolution module is used to replace the C2f module in the original YOLOv8 backbone network. The dynamic snake convolution module, which includes a four-branch dilated convolution group, consists of four groups of parallel dilated convolution branches. The dilation rates can be set to 1, 3, 5, 7 or 1, 2, 3, 4, respectively, depending on the actual situation and are not limited here. The module covers multi-scale contextual information through differentiated receptive fields. A dynamic offset accumulation mechanism is used within each group of branches, and the output features of branches with different dilation rates are fused through feature splicing.
[0048] Furthermore, the dynamic offset accumulation formula of the dynamic snake convolution module is defined as follows:
[0049] ;
[0050] in, Indicates the dynamic offset of the k-th layer feature map, which indicates the sampling position offset of the convolution kernel in the current layer. Represents the dynamic offset of the k+1th layer feature map, which is obtained by cumulative adjustment. k represents the layer index of the feature map, indicating the sequential position of the current layer, and f θ Represents a learnable offset prediction function, θ represents the parameter set of the function, which is used to predict the offset based on the input feature map, x kThe feature map representing the input of the kth layer is used as the input of the offset prediction function. This mechanism enables the convolution kernel sampling points to dynamically adjust along the contour of the defect edge, forming a snake-like winding path, which enhances the fit to irregular defect edges. For example, when detecting linear scratches on metal sheets, the initial offset starts from the scratch starting point, and the offset is accumulated layer by layer along the direction of the scratch extension to ensure that the convolution kernel is always focused on the central axis area of the scratch. The offset prediction function f θ The parameters of the convolution kernel are optimized through backpropagation, enabling the network to dynamically learn the optimal path adjustment strategy based on input features. This mechanism overcomes the limited adaptability of traditional convolution kernels with fixed sampling patterns to curved targets and is particularly suitable for feature extraction of tubular defects, such as micron-scale circuit breaks.
[0051] Furthermore, the output features of branches with different expansion rates are fused through feature concatenation, including:
[0052] ;
[0053] Among them, F out represents the fused output feature map, Concat(·) represents the operator for concatenating multi-branch features along the channel dimension, and F d1 、F d2 、F d3 、F d4 Represent the output feature maps of the first, second, third, and fourth expansion rate branches, respectively, W fusion The fusion weight matrix represents the 1×1 convolution, which is used to adjust the channel dimension of the concatenated features, achieving adaptive fusion of multi-scale features. This design preserves the independence of multi-scale features while enabling cross-scale information exchange through learnable parameters. For example, in PCB inspection, the fused features can simultaneously represent the local texture of the solder joint (from the branch with an expansion rate of 1) and the overall shape of the pad (from the branches with expansion rates of 5 or 7), thereby improving the ability to detect cold solder joint defects. Furthermore, the parameter distribution of the fusion weight matrix can be analyzed using visualization techniques, providing a basis for model interpretability.
[0054] The core of the dynamic snake convolution module lies in enhancing the adaptability of feature extraction through the differentiated perception capabilities of a four-branch dilated convolution group. Each branch employs a dilated convolution kernel with an independent dilation rate, set to 1, 3, 5, or 7, achieving multi-scale coverage from local to global. The branch with a dilation rate of 1 extracts pixel-level details (such as tiny dents on the solder joint surface) through standard dilated convolution, while branches with dilation rates of 5 or 7 exploit large-scale dilated convolutions to perceive contextual relationships (such as the stress distribution between a crack and the surrounding metal matrix). The convolution kernels of each branch spatially adjust their sampling paths through a dynamic offset accumulation mechanism driven by the input feature map, enabling the convolution kernels to adaptively snake along the target contour, closely following the geometric deformation characteristics of the defect edge. The output feature maps of the four branches are initially integrated through a channel-wise concatenation operation. A fusion weight matrix constructed by 1×1 convolutions is then used to adaptively weight the multi-scale features. The weight matrix learns the contribution ratios of branches with different dilation rates through end-to-end training, ensuring a complementary fusion of local details and global semantics. For example, in the detection of solder joints of electronic components, the small expansion rate branch focuses on the jagged features of the solder joint edge, while the large expansion rate branch associates the positional relationship between the solder joint and the pin. The final fused feature map can retain both micromorphology and macrostructure information.
[0055] In some embodiments, a two-stage screening mechanism includes a first stage and a second stage. The first stage screens candidate detection boxes based on a confidence threshold, while the second stage optimizes boundary positioning through super-resolution reconstruction. The two-stage screening mechanism optimizes the reliability and positioning accuracy of detection results through a progressive process. The first stage screens candidate boxes based on the joint probability, using the product of the classification score and the confidence score as the evaluation metric. The raw scores are normalized to the interval [0, 1] using a sigmoid function to form a joint probability. This metric comprehensively reflects the probability of the target's existence and the certainty of the category. By setting a threshold to filter out low-confidence predictions, for example, in electronic component inspection, it can effectively eliminate false positives caused by background texture or noise. The filtered candidate box set enters the second stage, where cross-level feature fusion and super-resolution reconstruction techniques are used to optimize boundary positioning accuracy. The feature extraction in the second stage relies on a multi-scale feature pyramid (such as the PANet structure) in front of the detection head. For each candidate box, the region of interest is cropped from the feature maps at different levels. High-resolution low-level features are used to supplement detailed information, while low-resolution high-level features provide semantic context. Through deconvolution, multi-level features are upsampled and weightedly fused to generate residual compensation, correcting the center coordinates and size parameters of the initial bounding box to achieve sub-pixel positioning optimization. This mechanism is particularly suitable for scenarios with blurred edges or partial occlusion of small targets. For example, when detecting microcracks on metal surfaces, by fusing the edge gradients of high-resolution features with the structural correlations of low-resolution features, the alignment accuracy of the bounding box and the crack extension direction can be significantly improved.
[0056] Furthermore, the first stage includes setting a confidence threshold before the detection head and filtering candidate detection boxes by conditional probability as follows:
[0057] P keep ={p i |σ(cls i )·σ(conf i )>T c};
[0058] Among them, P keep represents the set of candidate detection boxes retained, p i represents the i-th candidate detection box, σ represents the sigmoid function, cls i Indicates the classification score of the i-th candidate detection box, conf i Represents the confidence score of the i-th candidate detection box. The classification score and confidence score of the candidate detection box are directly calculated by the output layer of the detection head. c Represents the confidence threshold. For example, it can be set to 0.5 to filter low-quality candidate boxes. The confidence threshold screening formula evaluates the credibility of the candidate box through joint probability. Its mathematical basis stems from the need for coordinated optimization of classification and positioning in the target detection task. The sigmoid function maps the raw score output by the detection head into a probability form. The classification score represents the probability that the target belongs to a specific category, and the confidence score reflects the degree of overlap between the predicted box and the true target. The product of the two constitutes the joint probability, which requires both accurate target category discrimination and the positioning box to fit the real area. This mechanism complements the original non-maximum suppression of YOLOv8. The former filters low-quality predictions from a probabilistic level, while the latter removes redundant boxes from the perspective of spatial overlap, jointly improving the purity of the detection results.
[0059] Furthermore, the second phase includes:
[0060] According to the initial position of the retained candidate detection frame, that is, the initial bounding box coordinates B init ,The candidate detection frames after the first stage screening are directly provided, and the corresponding regions of interest are extracted from the feature maps at different levels;
[0061] The deconvolution kernel is used to perform feature upsampling on the region of interest at each level to generate residual compensation;
[0062] The calculation formula of residual compensation is as follows:
[0063] ;
[0064] Among them, ΔB represents the residual compensation amount, K represents the total number of layers of the feature map, and represents the number of feature levels involved in super-resolution reconstruction, w krepresents the learnable weight of the k-th layer feature map, which is used to control the contribution of different level features to the bounding box correction. Deconv(·) represents the deconvolution operation, which is used to upsample the low-resolution feature map to a high resolution. Represents the region of interest features of the k-th layer feature map.
[0065] The corrected detection frame is obtained based on the initial position of the retained candidate detection frame and the residual compensation amount; the corrected detection frame B'=B init +ΔB.
[0066] The first stage screens candidate boxes based on the joint probability product of the classification score and the confidence score, filtering out low-quality predictions by setting a threshold. The second stage extracts contextual information from the corresponding regions of the retained candidate boxes from feature maps at different levels (such as high-resolution underlying features and low-resolution upper-level features). This is then upsampled through a deconvolution operation to generate a residual compensation, which is then superimposed on the initial bounding box coordinates to achieve sub-pixel positioning correction. This mechanism effectively mitigates positioning errors caused by insufficient feature map resolution in single-stage detection and is particularly suitable for industrial defect detection requiring pixel-level accuracy.
[0067] S3. Use the small target defect image dataset to train the improved YOLOv8 model to obtain a trained improved YOLOv8 model.
[0068] S4. Input the optical image of the object to be detected into the trained improved YOLOv8 model for small target defect detection and recognition.
[0069] Boundary positioning optimization is achieved through multi-level feature fusion and residual compensation mechanism. For the candidate boxes retained in the first stage, contextual features of the corresponding areas are extracted from different levels of the feature pyramid. High-resolution underlying features contain rich detail information and can capture the edge gradients and texture changes of the target; low-resolution high-level features encode the semantic associations and structural priors of the target. The high-level features are upsampled to the same resolution as the underlying features through bilinear interpolation or deconvolution operations, and then channel splicing and 1×1 convolution fusion are performed to generate enhanced multi-scale feature representations. The feature is predicted by a lightweight regression network with residual compensation, including the center point offset and size scaling factor, and superimposed on the initial bounding box parameters to complete the refinement and improve positioning accuracy.
[0070] The present invention combines a dynamic serpentine convolution module with a two-stage screening mechanism. The dynamic serpentine convolution module uses a four-branch hole convolution group to construct multi-scale perception capabilities. The dynamic offset accumulation formula enables the convolution kernel to adaptively adjust the sampling position along the target contour, effectively capturing the geometric deformation characteristics of tiny defects. Its multi-branch feature splicing and fusion weight matrix realizes the coordinated enhancement of local details and global context, solving the problem of insufficient extraction of slender edge features by traditional convolution. The two-stage screening mechanism improves positioning accuracy through progressive processing of confidence threshold screening and super-resolution optimization: the first stage filters low-quality candidate frames based on joint probability to suppress background interference; the second stage uses multi-level feature deconvolution to generate residual compensation, and realizes sub-pixel bounding box correction through cross-scale feature fusion, which is particularly effective in optimizing the edge blur problem of tiny targets. In addition, Gaussian filtering preprocessing and data enhancement strategies enhance the model's adaptability to noise interference and scale changes, while the topological continuity constraint of dynamic serpentine convolution further ensures the structural integrity of complex tubular defects.
[0071] The embodiment of the present invention further provides a small target detection and recognition system based on improved YOLOv8, which is used to execute the above-mentioned small target detection and recognition method based on improved YOLOv8. Figure 4 This is a schematic diagram of the structure of a small target detection and recognition system based on improved YOLOv8 provided by an embodiment of the present invention. Figure 4 , the system includes the following modules:
[0072] The data acquisition module is used to acquire small target defect images of industrial inspection objects, preprocess the small target defect images, and annotate the preprocessed defect images to construct a small target defect image dataset;
[0073] The model construction module is used to replace the C2f module in the backbone network of the YOLOv8 network model with a dynamic snake convolution module containing a four-branch dilated convolution group, and deploy a two-stage screening mechanism after the detection head to build an improved YOLOv8 model.
[0074] The model training module is connected to the data acquisition module and the model construction module, and is used to train the improved YOLOv8 model using the small target defect image dataset to obtain a trained improved YOLOv8 model;
[0075] The target detection module is connected to the model training module and is used to input the optical image of the object to be detected into the trained improved YOLOv8 model for small target defect detection and recognition.
[0076] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.
Claims
1. A small target detection and recognition method based on improved YOLOv8, characterized by: The method comprises the following steps: S1. Acquire small target defect images of industrial inspection objects, preprocess the small target defect images, and annotate the preprocessed defect images to construct a small target defect image dataset; S2. Based on the YOLOv8 network model, the C2f module in the backbone network of the YOLOv8 network model is replaced with a dynamic snake convolution module containing a four-branch dilated convolution group, and a two-stage screening mechanism is deployed after the detection head to build an improved YOLOv8 model; S3. Using the small target defect image dataset to train the improved YOLOv8 model to obtain a trained improved YOLOv8 model; S4. Input the optical image of the object to be detected into the trained improved YOLOv8 model for small target defect detection and recognition.
2. The small target detection and recognition method based on improved YOLOv8 according to claim 1 is characterized in that In S1, preprocessing the small target defect image includes eliminating image noise through Gaussian filtering and performing data enhancement processing on the small target defect image.
3. The small target detection and recognition method based on improved YOLOv8 according to claim 2 is characterized in that In S1, labeling the pre-processed defect image includes labeling the defect category label and the bounding box coordinates of the defect position.
4. The small target detection and recognition method based on improved YOLOv8 according to claim 1 is characterized in that In S2, the dynamic snake convolution module including the four-branch dilated convolution group includes: The dynamic snake convolution module includes four parallel branches, each branch is set with a hole convolution kernel with a different expansion rate, and the output features of the branches with different expansion rates are fused through feature splicing.
5. The small target detection and recognition method based on improved YOLOv8 according to claim 4 is characterized in that, The dynamic offset accumulation formula of the dynamic snake convolution module is defined as follows: ; in, represents the dynamic offset of the k-th layer feature map, represents the dynamic offset of the k+1th layer feature map, k represents the layer index of the feature map, f θ represents the learnable offset prediction function, x k Represents the feature map of the k-th layer input.
6. The small target detection and recognition method based on improved YOLOv8 according to claim 4 is characterized in that: The output features of branches with different expansion rates are fused by feature splicing, including: ; Among them, F out represents the fused output feature map, Concat(·) represents the operator for concatenating multi-branch features along the channel dimension, and F d1 、F d2 、F d3 、F d4 Represent the output feature maps of the first, second, third, and fourth expansion rate branches, respectively, W fusion Represents the fusion weight matrix.
7. The small target detection and recognition method based on improved YOLOv8 according to claim 1 is characterized in that In S2, the two-stage screening mechanism includes a first stage and a second stage, the first stage screening candidate detection boxes based on a confidence threshold, and the second stage optimizing boundary positioning through super-resolution reconstruction.
8. The small target detection and recognition method based on improved YOLOv8 according to claim 7 is characterized in that: The first stage involves setting a confidence threshold after the detection head and filtering candidate detection boxes using conditional probability. The formula is as follows: P keep ={p i |σ(cls i )·σ(conf i )>T c }; Among them, P keep represents the set of candidate detection boxes retained, p i represents the i-th candidate detection box, σ represents the sigmoid function, cls i Indicates the classification score of the i-th candidate detection box, conf i represents the confidence score of the i-th candidate detection box, T c Represents the confidence threshold.
9. The small target detection and recognition method based on improved YOLOv8 according to claim 7, characterized in that: The second phase includes: According to the initial position of the retained candidate detection frame, the corresponding region of interest is extracted from the feature maps of different levels; The deconvolution kernel is used to perform feature upsampling on the region of interest at each level to generate residual compensation; The corrected detection frame is obtained based on the initial position of the retained candidate detection frame and the residual compensation amount.
10. A small target detection and recognition system based on improved YOLOv8, used to execute the small target detection and recognition method based on improved YOLOv8 according to any one of claims 1 to 9, characterized in that: The system includes the following modules: A data acquisition module is used to acquire small target defect images of industrial inspection objects, preprocess the small target defect images, and annotate the preprocessed defect images to construct a small target defect image dataset; A model construction module is used to replace the C2f module in the backbone network of the YOLOv8 network model with a dynamic snake convolution module containing a four-branch dilated convolution group, and deploy a two-stage screening mechanism after the detection head to build an improved YOLOv8 model. A model training module, connected to the data acquisition module and the model construction module, is used to train the improved YOLOv8 model using the small target defect image dataset to obtain a trained improved YOLOv8 model; The target detection module is connected to the model training module and is used to input the optical image of the object to be detected into the trained improved YOLOv8 model for small target defect detection and recognition.
Citation Information
Patent Citations
Corn canopy organ recognition method and canopy phenotype detection method based on improved Mask2YOLO network
CN118230166A
Pointer type instrument reading method based on adaptive pooling and attention fusion
CN118397612A
Target identification method and device
CN119672316A
High-resolution remote sensing image target detection method based on improved YOLOv8s
CN120032266A
Linear building group identification method and system fusing dynamic snakelike convolution and YOLO11
CN120088614A
Cited By
Processing method and system for micro defect image recognition data of sealing surface of ferrule joint
CN121616818A
Small target defect optimization detection method based on capacitive screen printing
CN122135066A
Marine litter lightweight detection method and system oriented to edge computing platform
CN122244736A