Weak and small target detection method and device based on YOLOv5

By introducing SPD-Conv, Ghost-Conv and EMA attention mechanism modules into the YOLOv5 neural network, the object detection model is optimized, and the problem of low accuracy in weak object detection is solved, and higher recognition accuracy is achieved .

CN119478342AActive Publication Date: 2025-02-18CHANGCHUN INST OF OPTICS FINE MECHANICS & PHYSICS CHINESE ACAD OF SCI

Patent Information

Application Number
CN202411468796.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-02-18
Estimated Expiration
2044-10-21

AI Technical Summary

Technical Problem

In weak target detection, the traditional YOLOv5 algorithm has limited feature information and is easily disturbed by noise, light changes, occlusion and other factors, resulting in low detection accuracy.

Method used

The SPD-Conv module, Ghost-Conv module and EMA attention mechanism module are introduced into the YOLOv5 neural network to optimize the object detection model to improve the recognition accuracy of weak targets.

Benefits of technology

Through these optimization measures, the performance of the network model is improved, and the problem of too single features extracted by the original model is overcome, so that the newly constructed object detection model has a high recognition accuracy for the recognition of weak targets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478342A_ABST
    Figure CN119478342A_ABST
Patent Text Reader

Abstract

The invention provides a weak and small target detection method and device based on YOLOv5, and the method comprises the steps: carrying out the preprocessing of a to-be-detected image, and obtaining a feature image; inputting the feature image into an optimized YOLOv5 target detection model to obtain a weak and small target detection result; the optimization of the target detection model comprises the following steps: introducing an SPD-Conv module into a YOLOv5 neural network; using a Ghost-Conv module to replace a Conv module of the YOLOv5 neural network, and using the Ghost-Conv module to further extract features from the features extracted by the SPD-Conv module; an EMA attention mechanism module is introduced into a C3 module of the YOLOv5 neural network to form a C3EMA module, and the C3EMA module suppresses invalid information through feature image segmentation and cross-stage connection. According to the invention, the Ghost-Conv module is introduced to replace an original Conv module, an EMA attention mechanism is introduced into the C3 module, and an SPD-Conv module is introduced into the feature fusion module, so that the recognition precision of a weak and small target is improved, and the problem that features extracted by an original model are too single is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of target detection, and specifically, to a method and device for detecting red weak small targets based on YOLOv5. Background Art

[0002] Small target detection is an important part of the target detection field. Small target detection is a very challenging task with a wide range of important application scenarios, including but not limited to remote sensing satellite image analysis, intelligent security monitoring, unmanned vehicle environment perception, and medical image processing. These application scenarios usually require the system to be able to quickly and accurately identify small targets with small size, low contrast, and susceptible to noise interference in complex and changing environments.

[0003] With the rapid development of deep learning technology, especially the widespread application of convolutional neural networks (CNN) in the field of image recognition, new solutions have been provided for small and weak target detection. As a representative of the field of real-time target detection, the YOLO (You Only Look Once) series of algorithms have attracted widespread attention for their fast and accurate features.

[0004] However, the traditional YOLOv5 algorithm has very limited feature information of small targets in images and is easily disturbed by various factors such as noise, illumination changes, and occlusion, resulting in low detection accuracy. Summary of the invention

[0005] The purpose of the present invention is to provide a method, device, medium and electronic device for detecting red weak small targets based on YOLOv5, which can solve at least one of the technical problems mentioned above. The specific solution is as follows:

[0006] According to a specific embodiment disclosed in the present invention, a first aspect provides a small target detection method based on YOLOv5, comprising: preprocessing an image to be detected to obtain a feature image;

[0007] Inputting the feature image into an optimized YOLOv5 target detection model, and performing small and weak target detection using the optimized YOLOv5 target detection model;

[0008] The optimization of the target detection model includes:

[0009] Introduce the SPD-Conv module into the YOLOv5 neural network;

[0010] Using a Ghost-Conv module to replace the Conv module of the YOLOv5 neural network, and using the Ghost-Conv module to further extract features from the features extracted by the SPD-Conv module;

[0011] The EMA attention mechanism module is introduced into the C3 module of the YOLOv5 neural network to form the C3_EMA module, which suppresses invalid information by segmenting feature images and cross-stage connections.

[0012] Preferably, the step of preprocessing the image to be detected to obtain the feature image includes: adaptively resizing the acquired image to be detected, and uniformly dividing the adjusted image to be detected into blocks using an N×N grid system.

[0013] Preferably, the optimization also includes: in the feature fusion network of the YOLOv5 neural network, using a cross-dimensional interaction module combining SPD-Conv, a feature fusion module and a convolution module to fuse the extracted features to capture the relationship between shallow features and deep features at the pixel level.

[0014] Preferably, the C3_EMA module is implemented as follows:

[0015] The input feature images enter the first branch and the second branch respectively;

[0016] The feature image is subjected to one-dimensional global pooling in the first branch to obtain channel attention weights, and a 3x3 convolution is performed in the second branch to obtain spatial attention weights;

[0017] The channel attention weight and the spatial attention weight are combined to generate a final attention weight map, and the final attention weight map is applied to the feature image to obtain a final output.

[0018] Preferably, the final output expression is:

[0019] Output_Features=Input_Features⊙(Channel_Attention×Spatial_Attention)

[0020] Among them, ⊙ represents element-by-element multiplication;

[0021] Output_Features is the output features; Input_Features is the input features;

[0022] Channel_Attention is the channel attention weight; Spatial_Attention is the spatial attention weight.

[0023] Preferably, the optimization further includes: extracting features from the fused features of the cross-dimensional interaction module through the C3_EMA module to obtain feature images of different sizes, which are output through probes of different resolutions respectively.

[0024] Preferably, the step of detecting small and weak targets includes:

[0025] Generate prediction boxes: for a feature image containing any target center point in an N×N grid, generate a corresponding number of prediction boxes according to the number of preset anchor boxes in the N×N grid;

[0026] Calculating the confidence of the border: the confidence of each predicted border is calculated by the probability of the target existing and the cross ratio of the predicted border and the real border, and the probability of the target existing is a binary variable;

[0027] Generate grid prediction result vector: organize the prediction results of each grid into vector y i ,

[0028] y i =[b x ,b y ,b w ,b h ,c]

[0029] Among them, (b x , b y ) is the target center coordinate, (b w , b h ) is the size of the real border, and c is the confidence of the border;

[0030] Integrate the global detection results, summarize all the grid prediction result vectors, and form the result of the entire image to be detected.

[0031] According to a specific embodiment disclosed in the present invention, in a second aspect, the present invention discloses a small target detection device based on YOLOv5, comprising: a data acquisition unit, generating a feature image according to an input image to be detected;

[0032] A target detection unit, using the target detection model of the method described in any one of claims 1 to 7 to predict the small and weak targets in the feature image, and output a detection result;

[0033] The detection result includes: target bounding boxes, probability categories and confidence information of all detected small targets in the entire image to be detected.

[0034] Preferably, the target detection model includes:

[0035] The backbone network consists of 4 SPD-Conv layers, 3 Ghost-Conv layers, 3 C3-EMA layers, and 1 SPPF layer;

[0036] Neck network, including: 2 feature pyramid networks and 2 path aggregation networks;

[0037] The feature pyramid network includes: 1 Ghost-Conv layer, 1 upsampling layer and a feature fusion layer;

[0038] The path aggregation network includes: a cross-dimensional interaction module, which is used to splice the features extracted by the SPD-Conv layer to form a new feature map in the channel dimension;

[0039] The head network includes three detection heads, which are used to detect objects of different sizes.

[0040] Preferably, the cross-dimensional interaction module includes, in order of processing, an SPD convolution layer, a feature fusion layer, and a convolution layer;

[0041] The SPD convolution layer is used to extract deep features of the Ghost-Conv layer, which are fused with shallow features extracted by the Ghost-Conv layer of the feature pyramid network through the feature fusion layer, and then the convolution layer is used to further extract common features. The extracted common features are output by the head network after passing through the C3_EMA layer.

[0042] Compared with the prior art, the above solution of the embodiment disclosed in the present invention has at least the following beneficial effects:

[0043] In the YOLOv5 network model, the Ghost-Conv module is introduced to replace the original Conv module, the EMA attention mechanism is introduced in the C3 module, and the SPD-Conv module is introduced in the feature fusion module to improve the recognition accuracy of weak targets, overcoming the problem that the features extracted by the original model are too single. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0045] Figure 1 This is a flowchart of a small target detection method based on YOLOv5 of the present invention;

[0046] Figure 2 is a structural diagram of the target detection model of the present invention;

[0047] Figure 3 Schematic diagram of the Ghost_Conv module of the present invention;

[0048] Figure 4is a schematic diagram of the C3_EMA module of the present invention;

[0049] Figure 5 Comparison chart of six models on box_loss, obj_loss, precision, recall, mAP 50 and mAP 50-95 evaluation indicators using DB_Licenta dataset;

[0050] Figure 6 This is a comparison chart of the recognition capabilities of six models for small targets in complex and changing scenes using the DB_Licenta dataset;

[0051] Figure 7 Comparison chart of six models using USOD dataset on box_loss, obj_loss, precision, recall, mAP50 and mAP 50-95 evaluation indicators;

[0052] Figure 8 This is a comparison chart of the recognition capabilities of six models for small targets in complex and changing scenes using the DB_Licenta dataset. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention.

[0054] The terms used in the embodiments disclosed in the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present disclosure. The singular forms "a", "said" and "the" used in the embodiments disclosed in the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.

[0055] It should be understood that although the terms first, second, third, etc. may be used to describe in the disclosed embodiments of the present invention, these descriptions should not be limited to these terms. These terms are only used to distinguish the descriptions. For example, without departing from the scope of the disclosed embodiments of the present invention, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.

[0056] The optional embodiments disclosed in the present invention are described in detail below with reference to the accompanying drawings.

[0057] like Figure 1 As shown, a small target detection method based on YOLOv5 of the present invention comprises the following steps:

[0058] Step S1. Preprocess the image to be detected to obtain a feature image;

[0059] Step S2. Input the feature image into the optimized YOLOv5 target detection model to obtain weak target detection results;

[0060] Among them, the optimization of the target detection model includes:

[0061] Introduce the SPD-Conv module into the YOLOv5 neural network;

[0062] The Ghost-Conv module is used to replace the Conv module of the YOLOv5 neural network, and the features extracted by the Ghost-Conv module are fused using the SPD-Conv module;

[0063] The EMA attention mechanism module is introduced into the C3 module of the YOLOv5 neural network to form the C3_EMA module, which suppresses invalid information by segmenting feature images and cross-stage connections.

[0064] The present invention introduces the SPD-Conv module, the Ghost-Conv module and the EMA attention mechanism module into the YOLOv5 (You Only Look Once Version5) network model, thereby improving the overall performance of the network model and overcoming the problem that the features extracted by the original model are too single, so that the newly constructed target detection model has higher recognition accuracy for weak targets.

[0065] In step S1, the preprocessing step of the image to be detected specifically includes:

[0066] Step S1.1 obtains the image to be detected. The small target in this application may be: an infrared image with target pixels smaller than 10*10 pixels.

[0067] Step S1.2 adaptively resizes the acquired image to be detected, and evenly divides the adjusted image to be detected into blocks using an N×N grid system to generate a number of feature images.

[0068] This step can divide complex image scenes into more manageable local areas, facilitating subsequent target detection and classification.

[0069] The structure of the YOLOv5 network model includes: backbone network, neck network and head network. Figure 2 The structure of the target detection model after optimization in step S2 is shown, which specifically includes the following optimization steps:

[0070] Step S2.1, optimization of the feature extraction part.

[0071] The feature extraction part of YOLOv5 is mainly composed of a deep neural network, usually using CSPDarknet as the backbone network. The infrared feature image preprocessed in step S1 is adjusted to a specific size, such as 640x640, and after normalization, shallow features and deep features are extracted through multiple convolutional layers. Each convolutional layer is usually followed by batch normalization and activation functions (such as Leaky ReLU) to enhance the nonlinear expression ability of the model.

[0072] In this embodiment, the SPD-Conv module is used to replace the Conv module in the backbone network of YOLOv5 to extract shallow features. The SPD-Conv module can improve the detection performance of the model for low-resolution images.

[0073] Specifically, for an intermediate original feature map X of size S×S×C1, when it is sliced ​​through the SPD-Conv structure, the process sequentially extracts a series of sub-feature maps, each of which comes from a different part of the original feature map X.

[0074] When downsampling on a feature map X, a scale factor scale is usually used to reduce its spatial dimension. Assuming that scale is set to 2, the feature map X will be divided into four equal-sized sub-maps, denoted as X 0,0 , X 1,0 , X 0,1 , X 1,1 , the size of each sub-map is half the size of the original feature map (i.e. Where S is the spatial size of the original feature map and C is the number of channels. The four sub-maps are then concatenated in the channel dimension through a feature fusion operation to form a new feature map. at this time, The number of channels is four times that of the original feature map X, but its spatial size is reduced by half, that is, the size is This improves the detection performance for low-resolution images.

[0075] Furthermore, the Ghost-Conv module is introduced into the backbone network of YOLOv5. The Ghost-Conv module can reduce the number of parameters and the amount of calculation, and can use 3*3, 5*5 or 7*7 convolutions.

[0076] Figure 3 The feature extraction process of the Ghost-Conv module is shown. For a given input (where c is the number of channels, w is the width, and h is the height), after passing through the n×k×k convolution kernel, the feature map is obtained The amount of calculation is

[0077] The number of parameters of ordinary convolution is n×c×k×k, and the amount of calculation is h′×w′×n×c×k×k, so the amount of calculation can be reduced.

[0078] In this embodiment, the feature image is first processed at multiple scales by the SPD-Conv module, which can more effectively generate redundant feature maps, improve computational efficiency while maintaining performance. The Ghost-Conv module is then used to generate feature maps, which can more accurately capture and retain key information, thereby improving the overall performance of the model, improving the detection of low-resolution images, and reducing the amount of subsequent computation.

[0079] Furthermore, the EMA attention mechanism module is introduced into the C3 module of the YOLOv5 neural network, forming the C3_EMA module, which further enhances the recognition ability of small targets.

[0080] As a lightweight and efficient residual module, the C3 module can effectively extract and fuse features in the image through specific convolution operations and structural design, while maintaining low computational complexity and model size. Its information compensation mechanism and receptive field expansion capabilities enhance global consistency and can capture richer detail features. The introduction of the EMA attention mechanism (Exponential Moving Average) imitates the focusing mechanism of the human brain, helping the model to pay more attention to key areas in the image and ignore irrelevant information, thereby improving detection efficiency and accuracy.

[0081] The present invention integrates the C3 module with the attention mechanism to complement each other's strengths, giving full play to their respective capabilities in feature extraction, fusion and key information focusing, thereby improving the performance of the model.

[0082] The processing and working principle of the C3_EMA module are as follows: Figure 4 As shown:

[0083] C3_EMA adopts a parallel sub-network structure, including: a first branch using 1x1 convolution and a second branch using 3x3 convolution to extract feature information of different scales.

[0084] Group processing: The input feature image is divided into multiple sub-features in the channel dimension, and each sub-feature is processed by a different parallel sub-network to learn different semantic information. The specific processing flow includes the following:

[0085] Step 1: Get the channel attention weight Channel_Attention of the first branch:

[0086] The input C×H×W feature image is subjected to global average pooling on the X and Y channels using a pooling kernel with dimensions (H, 1) or (1, W) to obtain statistical information for each channel.

[0087] The output of global average pooling is processed through 1x1 convolution to learn the relationship between different channels;

[0088] Use the concat module to fuse the outputs of each part after convolution processing;

[0089] Then activate them through the Sigmoid function to get the channel attention weight Channel_Attention, which is expressed as follows:

[0090] Channel_Attention=σ(Conv1x1(Global_Avg_Pool(Input_Features)))

[0091] Among them, σ represents the Sigmoid function, Conv1x1 represents 1x1 convolution, and Global_Avg_Pool represents global average pooling.

[0092] EMA update: At each time length t, the current attention weight is updated through the EMA mechanism, expressed as:

[0093] EMA t =α·Attention Weight+(1-α)EMA t-1

[0094] The coefficient α is used to balance the current and historical weights, preferably α = 0.7

[0095] Step 2: Synchronously obtain the spatial attention weight of the second point Spatial_Attention:

[0096] A 3x3 convolution is simultaneously applied to the input feature image of dimension C×H×W, and the output of the 3x3 convolution is globally average pooled to capture local cross-channel interactions and spatial context information.

[0097] The processed data is output and activated by the Sigmoid function to obtain the spatial attention weight, which is expressed as follows:

[0098] Spatial_Attention=σ(Functions(Conv3x3(Input_Features)))

[0099] Among them, Functions represents a series of possible processing steps (such as global average pooling, combining with the output of other branches, etc.), and Conv3x3 represents 3x3 convolution.

[0100] Step 3: Cross-spatial feature aggregation and final output

[0101] The channel attention weights and spatial attention weights are combined in an element-wise multiplication to generate the final attention weight map. The final attention weight map is applied to the input feature map to emphasize key channels and spatial locations and suppress unimportant information.

[0102] The final output is:

[0103] Output_Features=Input_Features⊙(Channel_Attention×Spatial_Attention)

[0104] Where ⊙ represents element-by-element multiplication.

[0105] In this embodiment, the element-by-element multiplication method can be used to fuse the features of different subspaces, thereby significantly reducing the computational overhead while improving the performance and computational efficiency of model image processing.

[0106] After the feature image is extracted by the C3_EMA module three times, the feature information of different scales is fused in the spatial pyramid pooling layer SPPF (SpatialPyramid Pooling Fast) to generate a multi-scale feature map as the input of the subsequent feature fusion network.

[0107] Step S2.2, optimization of the feature fusion network part.

[0108] After the spatial pyramid pooling layer, the YOLOv5 network model in this embodiment uses two feature pyramid networks (FPNs) and two path aggregation networks (PANs) to extract features at different levels.

[0109] The feature pyramid network (FPN) includes: 1 Ghost-Conv layer, 1 upsampling layer UpSample and a feature fusion layer concat. The two feature pyramid networks are connected by a C3_EMA module. The features obtained by the first feature pyramid network are weighted and input into the second feature pyramid network to further enhance the extraction of shallow features, such as the shape, color, position and basic text meaning of weak targets.

[0110] The path aggregation network (PAN) consists of: 1 C3_EMA module, 1 Ghost-Conv layer and 1 cross-dimensional interaction module. The path aggregation network further processes the feature image to enhance the semantic information of shallow features while maintaining the spatial information of deep features. This process uses bottom-up feature transfer to make detection more accurate.

[0111] Specifically, the multi-scale feature map output by the backbone network is extracted through multiple convolution layers, and the resolution of the feature map is adjusted using the upsampling layer to capture image details. In this process, the Ghost-Conv module and C3_EMA module are introduced to perform detection at different feature map levels, and the effective fusion of features is achieved through bottom-up path enhancement. In addition, spatial pyramid pooling (SPP) or SPD convolution is introduced to further fuse multi-scale features and enhance the representation ability of features.

[0112] After these processes, the feature maps output by the neck network not only change in resolution and number of channels, but also contain richer information, providing a basis for subsequent target detection. Finally, these feature maps are passed to the output of the head network to generate the final target bounding box, probability category, confidence and other detection results.

[0113] Furthermore, the present invention adds a cross-dimensional interaction module in the path aggregation network, and the cross-dimensional interaction module is composed of an SPD convolutional layer, a feature fusion layer and a convolutional layer connected sequentially in the feature transfer direction.

[0114] The SPD convolution layer is used to cross-extract the deep features obtained and the shallow features extracted by the feature pyramid network to obtain useful information; the feature fusion layer integrates and fuses these multi-dimensional features to generate a more comprehensive feature representation; finally, the fused feature data is passed to the traditional convolution layer for deeper processing and feature extraction. These convolution layers gradually extract higher-order features, such as texture and shape, through hierarchical superposition, providing strong feature support for subsequent detection and recognition tasks.

[0115] The feature fusion module in the present invention can capture the relationship between shallow features and deep features at the pixel level, and form a new feature map in the channel dimension. After the final C3_EMA module adjustment, the feature map is output to enhance or weaken the original input features, and the final features are output through the detection head.

[0116] Step S2.3, optimization of the head network part.

[0117] The head network consists of three probes, each for detecting objects of different sizes.

[0118] The first probe is used to receive the highest resolution feature image, such as 320x320, to detect larger target objects.

[0119] The second probe is used to receive a feature image with a medium resolution, such as 160x160.

[0120] The third probe is used to receive a feature map with a lower resolution, such as 80x80. The processing module may include: a convolution layer, an activation function and a linear layer.

[0121] Specifically, each probe performs small target detection through the following steps:

[0122] Step S2.3.1 generates prediction boxes:

[0123] For an image containing any target center point in the N×N grid in the image to be detected after preprocessing in step S1.2, a corresponding number of predicted bounding boxes are generated according to the number of preset anchor boxes in the N×N grid;

[0124] Step S2.3.2 calculates the bounding box confidence:

[0125] The confidence of each predicted bounding box is calculated by the probability of the target existing and the cross ratio of the predicted bounding box and the true bounding box. The probability of the target existing is a binary variable.

[0126] Step S2.3.3 Generate grid prediction result vector: organize the prediction results of each grid into vector y i ,

[0127] y i =[b x ,b y ,b w ,b h ,c]

[0128] Among them, (b x , b y ) is the target center coordinate, (b w , b h ) is the size of the true border, c is the border confidence;

[0129] Step S2.3.4 integrates the global detection results, summarizes all grid prediction result vectors, and forms the result of the entire image to be detected. The detection results include: the bounding box of the target, the probability category, and the confidence information.

[0130] Comparative experiment 1: Comparative experiment on DB_Licenta dataset:

[0131] In order to evaluate the effectiveness of the target detection model of the present invention, the DB_Licenta dataset is used to compare the current more innovative FFCA-YOLO and GSC-YOLO models as well as yolov5s, yolov7-tiny, and yolov9-c.

[0132] Figure 5 This is a comparison chart of the box_loss and obj_loss tests. Box_loss is used to measure the difference between the bounding box predicted by the model and the true bounding box. Obj_loss is used to measure the difference between the box predicted by the model (that is, the rectangle containing the object) and the true box. The closer the curve is to zero, the smaller the difference with the true value.

[0133] from Figure 5 a-5b It can be observed that the loss of the present invention is closer to zero, which indicates that the training effect is better.

[0134] from Figure 5 It can be seen from the curves shown in c-5f that, over time, the target detection model of the present invention maintains higher evaluation index values ​​than the other five models in four different indicators (precision, recall rate, mAP 50 and mAP 50-95).

[0135] The mAP 50 value refers to the average accuracy of the model in correctly identifying the true target when the intersection over union (IoU) threshold is set to 50%.

[0136] The mAP 50-95 value is the average of the mean average precision calculated at different IoU thresholds, typically ranging from 50% to 95% in 5% increments.

[0137] F1-score balances the performance of precision and recall by calculating the harmonic mean of these two indicators, avoiding the misleading effect of a single indicator. The higher the F1-score, the better the model is at accurately identifying positive samples while misclassifying negative samples as positive as possible, showing a good compromise between accuracy and comprehensiveness.

[0138] For specific data, see Table 1. Therefore, the target detection model of the present invention achieves a higher detection effect on this data set.

[0139] Table 1 Comparison of test data between five comparison models and the target detection model of this application on the DB Licenta dataset

[0140]

[0141] Figure 6A detailed comparison of the recognition capabilities of six models, including CBGS-YOLO, for small targets (with a particular focus on pedestrian detection) in complex and changing scenarios.

[0142] From left to right, the scenes are: highly complex street background, densely treed forest environment, complex scene with overlapping multi-task targets, and ultra-low pixel challenge. The models arranged from top to bottom are FFCA-YOLO, GSC-YOLO, yolov5s, yolov7-tiny, yolov9-c, and the object detection model of this application.

[0143] Through analysis, the comparison in the first three groups of scenes is particularly significant: other models have encountered problems of false detection and missed detection to varying degrees, while the CBGS-YOLO model has demonstrated better detection capabilities, with no false detection or missed detection and a high confidence level. This fully demonstrates the superiority and robustness of our model in complex environments. In the detection of the fourth group of low-pixel targets, all models involved in the comparison successfully identified the target, but it is worth noting that the CBGS-YOLO model is not only accurate, but also has a detection confidence level of 0.93, the highest level. Therefore, the advancement and effectiveness of the model of this application in handling weak target detection tasks are further verified.

[0144] Comparative experiment 2: Comparative experiment on USOD dataset:

[0145] In order to more comprehensively verify the effectiveness and robustness of the target detection model of the present invention, a new dataset USOD with different characteristics from the DB_Licenta dataset was selected for in-depth comparison. The notable feature of this new dataset is that the image clarity is low and all are presented in grayscale form, rather than color images in DB_Licenta. By systematically evaluating the latest YOLO variants including FFCA-YOLO and GSC-YOLO, as well as classic models such as YOLOv5s, YOLOv7-tiny and YOLOv9-c on the new dataset, we can more objectively demonstrate the excellent detection capabilities and optimization effects of the CBGS-YOLO model in complex and low-quality image environments. This study not only verifies the versatility of the model of the present invention, but also highlights its significant advantages in processing challenging grayscale and low-definition images.

[0146] Figure 7 Figures 7a and 7b intuitively show the downward trend of box_loss and obj_loss, where the loss curve of the target detection model of the present invention is closer to zero. This significant feature directly reflects the high efficiency of its training process.

[0147] Further observation Figure 7From the performance curves in c to 7f, over time, the object detection model continues to show significant advantages over the other five comparison models (including FFCA-YOLO, GSC-YOLO, YOLOv5s, YOLOv7-tiny and YOLOv9-c) in terms of precision, recall, mAP 50 and mAP 50-95. For specific data, see Table 2.

[0148] Table 2 Comparison of test data between five comparison models and the target detection model of this application on the USOD dataset

[0149]

[0150] The experimental results described in Table 2 show that the target detection model outperforms other models in all five evaluation indicators (accuracy, recall, F1 score, mAP50 and mAP50-95), and shows 1.7%, 2.2%, 2.1%, 1.0% and 1.1% enhancements respectively compared with the best indicators in the comparison model. It can be seen that this embodiment has effectively improved the model, and the model can not only effectively detect small targets in color images, but also accurately detect small targets in grayscale images.

[0151] Furthermore, the number of parameters refers to the sum of all trainable weights and biases in the model. These parameters are spread across network structures such as convolutional layers and fully connected layers, and are key indicators for measuring model size, complexity, and computing requirements. The size of the number of parameters is directly related to the model's memory usage, training time, and inference speed, and also affects the model's performance, such as accuracy and generalization ability, to a certain extent.

[0152] It can be seen from the parameter amounts in Table 2 and Table 1 that the target detection model of this embodiment has a lower parameter amount while taking into account the excellent performance and accuracy of the previous items, thereby achieving a lightweight model.

[0153] In summary, the target detection model proposed in the present invention significantly improves the accuracy of small target detection while maintaining a lightweight design.

[0154] Figure 8 The six models are compared in detail in terms of their ability to detect and identify small targets in four different scenarios. The scenarios involved in this experiment are: multi-target scattered scenes, moving target detection, targets occluded by multiple objects, and multi-target stacking. The models arranged from top to bottom are FFCA-YOLO, GSC-YOLO, yolov5s, yolov7-tiny, yolov9-c, and the target detection model of the present invention.

[0155] Through analysis, in the four groups of scenes, other models encountered false detection and missed detection problems to varying degrees, while the target detection model showed good detection capabilities, with no false detection or missed detection and high confidence. This fully proves the superiority and robustness of our model in complex environments.

[0156] The target detection model of the present invention can not only achieve accurate detection, but also has the best detection confidence index among all models, which further verifies its advancement and effectiveness in handling weak target detection tasks.

[0157] Therefore, by using the method of the present invention, under the condition of meeting normal working conditions, the probability of sensing the state change of infrared point-shaped targets can reach more than 95%, thus providing a reliable solution for the current field of weak and small target detection.

[0158] Comparative Experiment 3: Comparison of Different Attention Mechanisms

[0159] As a comparative experiment, Table 3 shows the comparison of the precision, recall, mAP50, and F1 scores of the models using different attention mechanisms.

[0160] Table 3 Comparison of various attention mechanisms

[0161]

[0162] It can be seen that in this embodiment, introducing the EMA attention mechanism module in the C3 module has a significant effect compared to adopting other attention mechanisms.

[0163] Example 2

[0164] The present invention also provides a device for implementing the method of the above embodiment, which is used to implement the steps of the method described in the above embodiment. The explanation based on the same name meaning is the same as the above embodiment, and has the same technical effect as the above embodiment, which will not be repeated here.

[0165] The present invention discloses a small target detection device based on YOLOv5, comprising:

[0166] A data acquisition unit generates a feature image according to an input image to be inspected;

[0167] The target detection unit uses the target detection model based on the YOLOv5 weak target detection method to predict the weak targets in the image to be detected, and outputs the target bounding box, probability category and confidence information of all detected weak targets in the entire image to be detected according to the prediction results.

[0168] Specifically, the data acquisition unit uses an N×N grid system to adaptively resize the image to be detected to obtain a 640x640 input feature image.

[0169] The target detection unit includes: a backbone network, a neck network, and a head network.

[0170] The backbone network includes: 4 SPD-Conv layers, 3 Ghost-Conv layers, 3 C3-EMA layers, and 1 SPPF layer;

[0171] In this embodiment, CSPDarknet is used as the backbone network, and the SPD-Conv layer is used to replace the Conv layer to extract shallow features. The Ghost-Conv layer is introduced to reduce the number of parameters to reduce the amount of calculation. The feature image is first processed at multiple scales by the SPD-Conv layer, which can more effectively generate redundant feature maps, improve computational efficiency and maintain performance. The Ghost-Conv layer is then used to generate feature maps, which can more accurately capture and retain key information, thereby improving the overall performance of the model, improving the detection of low-resolution images and reducing subsequent calculations. The EMA attention mechanism is introduced in the C3 layer after the Ghost-Conv layer to form a C3-EMA layer to emphasize key channels and spatial positions, and suppress unimportant information, thereby further enhancing the recognition ability of small targets.

[0172] The neck network includes: 2 feature pyramid networks and 2 path aggregation networks;

[0173] The feature pyramid network includes: 1 Ghost-Conv layer, 1 upsampling layer and a feature fusion layer;

[0174] The path aggregation network includes: a cross-dimensional interaction module, which is used to splice the features extracted by the SPD-Conv layer to form a new feature map in the channel dimension to capture the pairwise relationship at the pixel level. ;

[0175] The head network includes three detection heads, which are used to detect objects with different resolutions.

[0176] Furthermore, the cross-dimensional interaction module includes, in order of processing, the following: SPD convolution layer, feature fusion layer, and convolution layer;

[0177] The SPD convolution layer is used to further extract the deep features extracted by the Ghost-Conv layer, and fuse them with the shallow features extracted by the Ghost-Conv layer of the feature pyramid network through the feature fusion layer, and then use the convolution layer to further extract common features. The extracted features are integrated by the C3_EMA layer and output by the detection head.

[0178] This embodiment optimizes the YOLOv5 network model to improve the overall performance of the network model, overcomes the problem that the features extracted by the original model are too single, and enables the newly constructed target detection model to have higher recognition accuracy for small targets.

Claims

1. A small target detection method based on YOLOv5, characterized in that: include: Preprocess the image to be detected to obtain a feature image; Inputting the feature image into an optimized YOLOv5 target detection model, performing small target detection using the optimized YOLOv5 target detection model, and obtaining a small target detection result; The optimization of the target detection model includes: Introduce the SPD-Conv module into the YOLOv5 neural network; Using a Ghost-Conv module to replace the Conv module of the YOLOv5 neural network, and using the Ghost-Conv module to further extract features from the features extracted by the SPD-Conv module; The EMA attention mechanism module is introduced into the C3 module of the YOLOv5 neural network to form the C3_EMA module, which suppresses invalid information by segmenting feature images and cross-stage connections.

2. The method according to claim 1, characterized in that The step of preprocessing the image to be detected to obtain a feature image comprises: Adaptively resize the acquired image to be detected; The adjusted image to be detected is evenly divided into blocks using an N×N grid system to obtain the feature image.

3. The method according to claim 1, characterized in that The optimization of the target detection model also includes: in the feature fusion network of the YOLOv5 neural network, a cross-dimensional interaction module combining an SPD-Conv module, a feature fusion module and a convolution module is used to fuse the extracted features to capture the relationship between shallow features and deep features at the pixel level.

4. The method according to claim 1, characterized in that: The implementation of the C3_EMA module is as follows: The input feature images enter the first branch and the second branch respectively; The feature image is subjected to one-dimensional global pooling in the first branch to obtain channel attention weights, and a 3x3 convolution is performed in the second branch to obtain spatial attention weights; The channel attention weight and the spatial attention weight are combined to generate a final attention weight map, and the final attention weight map is applied to the feature image to obtain a final output.

5. The method according to claim 4, characterized in that The final output expression is: Output_Features=Input_Features⊙(Channel_Attention×Spatial_Attention) Among them, ⊙ represents element-by-element multiplication; Output_Features is the output features; Input_Features is the input features; Channel_Attention is the channel attention weight; Spatial_Attention is the spatial attention weight.

6. The method according to claim 3, characterized in that The optimization of the target detection model also includes: extracting features from the fused features of the cross-dimensional interaction module through the C3_EMA module, and outputting the obtained feature images of different sizes through probes of different resolutions.

7. The method according to claim 1, characterized in that The step of detecting small and weak targets includes: Generate prediction boxes: for a feature image containing any target center point in an N×N grid, generate a corresponding number of prediction boxes according to the number of preset anchor boxes in the N×N grid; Calculating the confidence of the border: the confidence of each predicted border is calculated by the probability of the target existing and the cross ratio of the predicted border and the real border, and the probability of the target existing is a binary variable; Generate grid prediction result vector: organize the prediction results of each grid into vector y i , y i =[b x ,b y ,b w ,b h ,c] Among them, (b x , b y ) is the target center coordinate, (b w , b h ) is the size of the real border, and c is the confidence of the border; Integrate the global detection results, summarize all the grid prediction result vectors, and form the result of the entire image to be detected.

8. A small target detection device based on YOLOv5, characterized in that: include: A data acquisition unit generates a feature image according to an input image to be inspected; The target detection unit predicts the small and weak targets in the feature image using the target detection model of the method described in any one of claims 1 to 7, and outputs the detection result.

9. The device according to claim 8, characterized in that The target detection model includes: The backbone network consists of 4 SPD-Conv layers, 3 Ghost-Conv layers, 3 C3-EMA layers, and 1 SPPF layer; Neck network, including: 2 feature pyramid networks and 2 path aggregation networks; The feature pyramid network includes: 1 Ghost-Conv layer, 1 upsampling layer and a feature fusion layer; The path aggregation network includes: a cross-dimensional interaction module, which is used to splice the features extracted by the SPD-Conv layer to capture the relationship between shallow features and deep features at the pixel level; The head network includes three detection heads, which are used to detect objects of different sizes.

10. The device according to claim 9, characterized in that The cross-dimensional interaction module includes, in order of processing, an SPD convolution layer, a feature fusion layer, and a convolution layer; The SPD convolution layer is used to extract deep features of the Ghost-Conv layer, which are fused with shallow features extracted by the Ghost-Conv layer of the feature pyramid network through the feature fusion layer, and then the convolution layer is used to further extract common features. The extracted common features are output by the head network after passing through the C3_EMA layer.

Citation Information

Patent Citations

  • Litchi fruit growth period identification method based on improved YOLOv5

    CN115984698A

  • Model training method and detection method for floating residual bait

    CN117274676A

  • Multi-layer feature information fusion small target detection system of double encoders and single decoder

    CN118115842A

  • Infrared weak and small target detection method based on crossing connection and fusion attention mechanism

    CN118172634A

  • Millimeter wave radar target detection method based on lightweight network

    CN118425911A

Cited By

  • Power transmission tower bolt detection method based on improved yov5s, electronic equipment and storage medium

    CN120563938A

  • Insulator defect detection method and device based on lightweight feature extraction network

    CN121544614A