Small target detection and recognition method and system based on improved YOLOv8

By improving the YOLOv8 model and combining it with dynamic snake convolution and a two-stage screening mechanism, the problems of low precision and weak anti-interference ability in industrial small target detection are solved, and high-precision and real-time small target recognition is achieved.

CN120451518BActive Publication Date: 2025-10-10HUNAN ZHIXIN INTERCONNECTION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510949370.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-10-10
Estimated Expiration
2045-07-10

AI Technical Summary

Technical Problem

Existing small target detection methods based on deep learning have problems of low recognition accuracy and weak anti-interference ability in industrial applications, especially in complex backgrounds and environmental fluctuations, which make it difficult to meet real-time requirements.

Method used

An improved YOLOv8 model is adopted. By replacing the C2f module in the backbone network with a dynamic snake convolution module with a four-branch dilated convolution group, and deploying a two-stage screening mechanism after the detection head, combined with Gaussian filtering and data augmentation strategies, the model's recognition accuracy and anti-interference ability for small targets are improved.

Benefits of technology

It effectively captures the geometric deformation features of tiny defects, improves the detection accuracy and anti-interference ability of tiny targets, solves the problem of insufficient extraction of slender edge features in traditional methods, and realizes sub-pixel bounding box positioning optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451518B_ABST
    Figure CN120451518B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of target recognition, and discloses a small target detection and recognition method and system based on an improved YOLOv8. The method comprises the following steps: acquiring a small target defect image of an industrial detection object, and constructing a small target defect image dataset; taking a YOLOv8 network model as the basis, replacing a C2f module in a backbone network of the YOLOv8 network model with a dynamic snake convolution module containing a four-branch hollow convolution group, deploying a two-stage screening mechanism after a detection head, and constructing an improved YOLOv8 model; training the improved YOLOv8 model by using the small target defect image dataset, so as to obtain a trained improved YOLOv8 model; and inputting an optical image of a to-be-detected object into the trained improved YOLOv8 model to perform small target defect detection and recognition. The scheme can solve the technical problems of low small target recognition precision and weak anti-interference capability in industrial detection.
Need to check novelty before this filing date? Find Prior Art

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 with the data acquisition module and the model construction module, and is used for training the improved YOLOv8 model by using a small target defect image dataset, so as to obtain a trained improved YOLOv8 model.

[0033] The target detection module is connected with the model training module, and is used for inputting an optical image of a to-be-detected object into the trained improved YOLOv8 model to perform small target defect detection and recognition.

[0034] The embodiment of the present application has the following technical effects:

[0035] The dynamic snake convolution module and the two-stage screening mechanism are combined, the dynamic snake convolution module adopts a four-branch hollow convolution group to build multi-scale perception capability, the convolution kernel is adaptively adjusted in sampling position along the target contour through a dynamic offset accumulation formula, and the geometric deformation features of the micro defect are effectively captured; the multi-branch feature splicing and fusion weight matrix realize the synergistic enhancement of local details and global context, and solve the problem of insufficient extraction of slender edge features in the traditional convolution; the two-stage screening mechanism improves the positioning accuracy through the progressive processing of confidence threshold screening and super-resolution optimization: in the first stage, low-quality candidate boxes are filtered based on joint probability, and background interference is suppressed; in the second stage, a residual compensation amount is generated by using multi-level feature deconvolution, sub-pixel level bounding box correction is realized through cross-scale feature fusion, and the edge blur problem of the micro target is optimized; in addition, the Gauss filter preprocessing and the data enhancement strategy strengthen the adaptability of the model to noise interference and scale changes, and the topological continuity constraint of the dynamic snake convolution further guarantees the structural integrity of the complex tubular defect. BRIEF DESCRIPTION OF DRAWINGS

[0036] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the drawings needed in the specific embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.

[0037] Figure 1 is a flowchart of the small target detection and recognition method based on the improved YOLOv8 provided by the embodiment of the present application;

[0038] Figure 2 is a structural schematic diagram of the improved YOLOv8 model provided by the embodiment of the present application;

[0039] Figure 3 is a working flowchart of the two-stage screening mechanism provided by the embodiment of the present application;

[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 krepresents the feature map of the k-th layer input as the input of the offset prediction function. This mechanism makes the sampling points of the convolution kernel dynamically adjust along the edge contour of the defect, forming a path similar to a serpentine, enhancing the fitting of the irregular defect edge. For example, when detecting the linear scratch on the metal plate, the initial offset starts from the starting point of the scratch, and the offset is accumulated layer by layer along the extension direction of the scratch, ensuring that the convolution kernel is always focused on the central axis area of the scratch. The offset prediction function f θ The parameters of the offset prediction function f out are optimized by back propagation, enabling the network to dynamically learn the optimal path adjustment strategy according to the input features. This mechanism overcomes the problem of insufficient adaptability of the fixed sampling mode of the traditional convolution kernel to curved targets, and is especially suitable for feature extraction of tubular defects (such as micron-level circuit disconnection).

[0051] Further, the output features of different expansion rate branches are fused by feature concatenation, including:

[0052] ;

[0053] where F out represents the fused output feature map, Concat(·) represents an operator for concatenating multiple branch features along the channel dimension, F d1 , F d2 , F d3 , and F d4 represent the output feature maps of the first, second, third, and fourth expansion rate branches, respectively, and W fusion represents a 1×1 convolution fusion weight matrix used to adjust the channel dimension of the concatenated features, realizing adaptive fusion of multi-scale features. This design not only preserves the independence of multi-scale features, but also realizes cross-scale information interaction through learnable parameters. For example, in PCB detection, the fused features can represent both 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 branch with an expansion rate of 5 or 7), thereby improving the ability to distinguish virtual solder defects. In addition, the parameter distribution of the fusion weight matrix can be analyzed through 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] Further, the first stage includes setting a confidence threshold in front of the detection head, and the candidate bounding box is filtered by conditional probability, and the formula is as follows:

[0057] P keep ={p i |σ(cls i )·σ(conf i )>T c};

[0058] Wherein, P keep represents the reserved candidate bounding box set, p i represents the i-th candidate bounding box, σ represents the sigmoid function, cls i represents the classification score of the i-th candidate bounding box, conf i represents the confidence score of the i-th candidate bounding box, the classification score and the confidence score of the candidate bounding box are directly calculated from the output layer of the detection head, T c represents the confidence threshold, which can be set to 0.5, for filtering low-quality candidate boxes. The confidence threshold filtering formula evaluates the reliability of the candidate box through joint probability, and its mathematical basis comes from the cooperative optimization requirement of classification and positioning in the target detection task. The sigmoid function maps the original score output by the detection head into a probability form, the classification score represents the probability that the target belongs to a specific class, and the confidence score reflects the overlap degree between the predicted box and the real target. The product of the two constitutes the joint probability, which requires both accurate target class discrimination and accurate positioning box fitting. This mechanism is complementary to the original non-maximum suppression of YOLOv8, the former filters low-quality predictions from the probability level, and the latter removes redundant boxes from the spatial overlap angle, which improves the purity of the detection results.

[0059] Further, the second stage includes:

[0060] According to the initial position of the reserved candidate bounding box, i.e. the initial bounding box coordinates B init , the candidate bounding box filtered by the first stage is directly provided, and the corresponding region of interest is extracted from the feature maps of different levels;

[0061] The region of interest of each level is feature up-sampled by a deconvolution kernel to generate a residual compensation amount;

[0062] The calculation formula of the residual compensation amount is as follows:

[0063] ;

[0064] Wherein, ΔB represents the residual compensation amount, K represents the total number of feature maps, represents the number of feature levels participating in super-resolution reconstruction, w krepresents the learnable weight of the k-th layer feature map, which is used to control the contribution of features at different levels 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 structural diagram of a small target detection and recognition system based on improved YOLOv8 provided by an embodiment of the present invention, see 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] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions recorded in the above embodiments can still be modified, or some or all of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present application.

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; The two-stage screening mechanism includes a first stage and a second stage. The first stage screens candidate detection boxes based on a confidence threshold, and the second stage optimizes boundary positioning through super-resolution reconstruction. 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 fused by feature splicing include: ; 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 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.

8. The small target detection and recognition method based on improved YOLOv8 according to claim 1 is 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.

9. 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 7, 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. The two-stage screening mechanism includes a first stage and a second stage. The first stage screens candidate detection boxes based on a confidence threshold, and the second stage optimizes boundary positioning through super-resolution reconstruction. 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 to detect and identify small target defects.

Citation Information

Patent Citations

  • Corn canopy organ recognition method and canopy phenotype detection method based on improved Mask2YOLO network

    CN118230166A