A small and weak target detection method and device based on YOLOv5

By introducing SPD-Conv, Ghost-Conv modules and EMA attention mechanism into the YOLOv5 neural network, feature extraction and fusion are optimized, solving the problem of low accuracy in weak target detection in the traditional YOLOv5 algorithm, and achieving efficient and accurate weak target recognition.

CN119478342BActive Publication Date: 2025-11-04CHANGCHUN INST OF OPTICS FINE MECHANICS & PHYSICS CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The traditional YOLOv5 algorithm has low detection accuracy in detecting small targets due to limited feature information and susceptibility to interference from factors such as noise, lighting changes, and occlusion.

Method used

The SPD-Conv and Ghost-Conv modules are introduced into the YOLOv5 neural network. Combined with the EMA attention mechanism, invalid information is suppressed through the C3_EMA module, feature extraction and fusion are optimized, an N×N grid system is used for image segmentation, prediction boxes are generated and confidence is calculated, and global detection results are integrated.

Benefits of technology

It significantly improves the recognition accuracy and robustness of small targets, enabling it to quickly and accurately identify small, low-contrast targets in complex and variable environments, while reducing computational load and maintaining high performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478342B_ABST
    Figure CN119478342B_ABST
Patent Text Reader

Abstract

The application provides a small weak target detection method and device based on YOLOv5, comprising: pre-processing a to-be-detected image to obtain a feature image; inputting the feature image into an optimized YOLOv5 target detection model to obtain a small weak target detection result; the optimization of the target detection model comprises: introducing an SPD-Conv module into a YOLOv5 neural network; replacing a Conv module of the YOLOv5 neural network with a Ghost-Conv module, further extracting features from the features extracted by the SPD-Conv module by using the Ghost-Conv module; introducing an EMA attention mechanism module into a C3 module of the YOLOv5 neural network to form a C3_EMA module, and the C3_EMA module suppresses invalid information by segmenting a feature image and cross-stage connection. The application replaces the original Conv module with the Ghost-Conv module, introduces the EMA attention mechanism into the C3 module, and introduces the SPD-Conv module into the feature fusion module to improve the recognition accuracy of small weak targets and overcome the problem that the features extracted by the original model are too single.
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 in particular, to a red weak small target detection method and device based on YOLOv5. BACKGROUND

[0002] Weak small target detection is an important part of target detection. Weak small target detection is a highly challenging task with wide and 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 quickly and accurately identify small, low-contrast, and noise-sensitive weak small targets in complex and variable environments.

[0003] With the rapid development of deep learning technology, especially the wide application of convolutional neural networks (CNN) in image recognition, new solutions have been provided for weak small target detection. The YOLO (You Only Look Once) series algorithm, as a representative of real-time target detection, has received widespread attention for its speed and accuracy.

[0004] However, the traditional yolov5 algorithm has limited feature information of weak small targets in images, and is easily disturbed by noise, light changes, and occlusions, resulting in low detection accuracy. SUMMARY

[0005] The present disclosure aims to provide a red weak small target detection method and device based on YOLOv5, a medium, and an electronic device, which can solve at least one of the technical problems mentioned above. The specific scheme is as follows:

[0006] According to the specific embodiment of the present disclosure, a first aspect provides a weak small target detection method based on YOLOv5, comprising: pre-processing a to-be-detected image to obtain a feature image;

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

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

[0009] Introducing a SPD-Conv module in 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 a C3_EMA module, which suppresses invalid information through segmentation of feature images and cross-stage connection.

[0012] Preferably, the step of obtaining a feature image by preprocessing the image to be detected comprises: performing adaptive size adjustment on the obtained 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 further comprises: in the feature fusion network of the YOLOv5 neural network, using a cross-dimension interaction module combining SPD-Conv, a feature fusion module and a convolution module to perform feature fusion on the extracted features to capture the mutual relationship between pixel-level shallow features and deep features.

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

[0015] The input feature image enters a first branch and a second branch respectively;

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

[0017] The channel attention weights and the spatial attention weights 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 expression of the final output is:

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

[0020] Wherein, represents element-wise multiplication;

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

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

[0023] Preferably, the optimization further comprises: the feature fused by the cross-dimension interaction module is further extracted by the C3_EMA module to obtain feature images of different sizes, which are respectively output by probes of different resolutions.

[0024] Preferably, the step of weak and small target detection comprises:

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

[0026] Calculating the confidence of the box: the confidence of each prediction box is calculated by the target existence probability and the intersection ratio of the prediction box and the real box, and the target existence probability is a binary variable;

[0027] Generating a grid prediction result vector: arranging the prediction results of each grid into a vector y i ,

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

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

[0030] Integrating the global detection results, all the grid prediction result vectors are summarized to form the results of the entire image to be detected.

[0031] According to the specific embodiment of the present application, the second aspect, the present application provides a weak and small target detection device based on YOLOv5, comprising: a data acquisition unit for generating a feature image according to an input image to be detected;

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

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

[0034] Preferably, the target detection model comprises:

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

[0036] The neck network comprises 2 feature pyramid networks and 2 path aggregation networks;

[0037] The feature pyramid network comprises a Ghost-Conv layer, an up-sampling layer and a feature fusion layer.

[0038] The path aggregation network comprises a cross-dimension interaction module, which is configured to splice the features extracted by the SPD-Conv layer to form a new feature mapping in the channel dimension.

[0039] The head network comprises three detection heads configured to detect targets of different sizes, respectively.

[0040] Preferably, the cross-dimension interaction module comprises, in sequence according to a processing order, an SPD convolution layer, a feature fusion layer and a convolution layer.

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

[0042] Compared with the prior art, the above scheme of the embodiment of the present application has at least the following beneficial effects:

[0043] The Ghost-Conv module is introduced to replace the original Conv module on the YOLOv5 network model, 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 small weak targets, and the problem of single features extracted by the original model is overcome. BRIEF DESCRIPTION OF DRAWINGS

[0044] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure. It is apparent that the accompanying drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative labor. In the drawings:

[0045] Figure 1 A flowchart of a small weak target detection method based on YOLOv5 according to the present application;

[0046] Figure 2 A structure diagram of a target detection model according to the present application;

[0047] Figure 3 A schematic diagram of a Ghost_Conv module according to the present application;

[0048] Figure 4A schematic diagram of the C3_EMA module of the present application;

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

[0050] Figure 6 A comparison chart of the recognition ability of small and weak targets of six models in complex and variable scenes using the DB_Licenta dataset;

[0051] Figure 7 A comparison chart of six models on the box_loss, obj_loss, precision, recall, mAP 50 and mAP 50-95 evaluation indexes using the USOD dataset;

[0052] Figure 8 A comparison chart of the recognition ability of small and weak targets of six models in complex and variable scenes using the DB_Licenta dataset. DETAILED DESCRIPTION

[0053] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0054] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "an" and "the" used in the embodiments of the present application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise. "Multiple" generally includes at least two.

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

[0056] The optional embodiments of the present application will be described in detail below with reference to the drawings.

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

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

[0059] Step S2. Inputting the feature image into an optimized YOLOv5 target detection model to obtain a weak and small target detection result;

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

[0061] An SPD-Conv module is introduced into the YOLOv5 neural network;

[0062] A Ghost-Conv module is used to replace the Conv module of the YOLOv5 neural network, and the SPD-Conv module is used to perform feature fusion on the features extracted by the Ghost-Conv module;

[0063] An EMA attention mechanism module is introduced into the C3 module of the YOLOv5 neural network to form a C3_EMA module, which suppresses invalid information through segmentation of the feature image and cross-stage connection.

[0064] The present application introduces an SPD-Conv module, a Ghost-Conv module and an EMA attention mechanism module into the YOLOv5 (You Only Look Once Version5) network model, which improves the performance of the network model as a whole, overcomes the problem of single feature extraction of the original model, and makes the newly constructed target detection model have high recognition accuracy for weak and small 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, and the weak and small target in the present application can be an infrared image with a target pixel less than 10*10 pixels.

[0067] Step S1.2 performs adaptive size adjustment on the obtained image to be detected, and uses an N*N grid system to uniformly divide the adjusted image to be detected to generate a plurality 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 a backbone network, a neck network and a head network. Figure 2 The structure of the optimized target detection model 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 by step S1 is adjusted to a specific size, such as 640x640, and after normalization processing, shallow and deep features are extracted through multiple convolution layers. After each convolution layer, Batch Normalization (Batch Normalization) and activation function (such as Leaky ReLU) are usually followed to enhance the non-linear expression ability of the model.

[0072] In this embodiment, SPD-Conv modules are used in the backbone network of YOLOv5 to replace Conv modules to extract shallow features, which can improve the detection performance of the model on low-resolution images.

[0073] Specifically, for an intermediate original feature map X with size SxSxC1, when slicing it through the SPD-Conv structure, a series of sub-feature maps will be sequentially extracted, each of which is derived from a different part of the original feature map X.

[0074] When downsampling the 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 sub-maps, denoted as X 0,0 , X 1,0 , X 0,1 , X 1,1 , each of which has 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 4 times that of the original feature map X, but its spatial size is reduced by half, i.e. thereby improving the detection performance on low-resolution images.

[0075] Further, a Ghost-Conv module is introduced into the backbone network of YOLOv5, which can reduce the parameter amount and computational complexity, and can use 3*3, 5*5 or 7*7 convolution.

[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 n x k x k convolution kernel, the feature map The calculation amount thereof is

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

[0078] In this embodiment, the feature image is first subjected to multi-scale processing by the SPD-Conv module, which can more effectively generate redundant feature maps, improve the calculation efficiency while maintaining the performance. Then, the Ghost-Conv module is 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 while reducing the subsequent calculation amount.

[0079] Further, the EMA attention mechanism module is introduced into the C3 module of the YOLOv5 neural network, that is, the C3_EMA module is formed, 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 a relatively low calculation complexity and model size. Its information compensation mechanism and receptive field expansion capability enhance the global consistency, which can capture more rich detailed features. The introduction of the EMA attention mechanism (Exponential Moving Average) simulates the focusing mechanism of the human brain, helping the model to pay more attention to the key areas in the image and ignore irrelevant information, thereby improving the detection efficiency and accuracy.

[0081] The present application fuses the C3 module with the attention mechanism, so that the two form a complementary advantage, fully exerting their respective abilities in feature extraction, fusion and key information focusing, and improving the performance of the model.

[0082] The processing process and working principle of the C3_EMA module are as shown in Figure 4

[0083] The C3_EMA adopts a parallel subnetwork structure, including: a first branch adopting 1x1 convolution and a second branch adopting 3x3 convolution, which are used 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 different parallel subnetworks to learn different semantic information. The specific processing flow includes the following:

[0085] Step one, obtain the channel attention weight Channel_Attention of the first branch:

[0086] ​The input CxHxW dimensional feature image is globally averaged pooled 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 the global average pooling is processed by a 1x1 convolution to learn the relationship between different channels;

[0088] The outputs of each part after convolution are fused using a concat module;

[0089] Then, respectively through the Sigmoid function for activation, get the channel attention weight Channel_Attention, expression as follows:

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

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

[0092] EMA update: at each time length t, the current attention weight is updated by the EMA mechanism, the expression is:

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

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

[0095] Step two, synchronously obtain the second part of the spatial attention weight Spatial_Attention:

[0096] The input CxHxW dimensional feature image is simultaneously applied to a 3x3 convolution, and the output of the 3x3 convolution is globally averaged pooled to capture local cross-channel interaction and spatial context information.

[0097] The data processed by the above method is output through the Sigmoid function for activation to obtain the spatial attention weight, the expression is as follows:

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

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

[0100] Step three, cross-space feature aggregation and final output

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

[0102] The final output is obtained as:

[0103] Output_Features = Input_Features 0 (Channel_Attention x Spatial_Attention)

[0104] wherein 0 represents element-wise multiplication.

[0105] In this embodiment, the element-wise multiplication manner can fuse different subspace features, improve the performance and computational efficiency of the model in image processing, and significantly reduce the computational overhead.

[0106] After the feature image is extracted by the C3_EMA module three times, the spatial pyramid pooling layer SPPF (Spatial Pyramid Pooling Fast) is used to fuse feature information of different scales 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 (FPN) and two path aggregation networks (PAN) to extract features of different levels.

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

[0110] The path aggregation network (PAN) comprises a C3_EMA module, a Ghost-Conv layer and a cross-dimension interaction module. The path aggregation network enhances the semantic information of the shallow features by further processing the feature images, while maintaining the spatial information of the deep features. This process uses bottom-up feature transmission to make the detection more accurate.

[0111] Specifically, the multi-scale feature maps output by the backbone network are extracted by multiple convolution layers, and the resolution of the feature maps is adjusted by the up-sampling layer to capture image details. In this process, the Ghost-Conv module and the C3_EMA module are introduced to detect at different feature map levels and achieve effective fusion of features 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 the features.

[0112] After these processes, the feature maps output by the neck network not only change in resolution and channel number, but also contain richer information, providing a basis for subsequent target detection. Finally, these feature maps are transmitted to the output end of the head network to generate final detection results such as target bounding boxes, probability categories and confidence.

[0113] Further, the cross-dimension interaction module is added to the path aggregation network, which is composed of an SPD convolution layer, a feature fusion layer and a convolution layer connected in sequence in the feature transmission 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; and finally the fused feature data is transmitted to the traditional convolution layer for deeper processing and feature extraction. These convolution layers gradually refine higher-order features such as texture and shape through hierarchical stacking, providing strong feature support for subsequent detection and recognition tasks.

[0115] The feature fusion module in the present application can capture the mutual relationship between pixel-level shallow features and deep features, forming a new feature mapping in the channel dimension. After adjustment by the final C3_EMA module, the output feature mapping is enhanced or weakened to obtain the final feature through the detection head.

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

[0117] The head network is composed of three probes for detecting targets of different sizes.

[0118] The first probe is used to receive a feature image with the highest resolution, 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 image with a lower resolution, such as 80x80. The processing module can include a convolution layer, an activation function, and a linear layer.

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

[0122] Step S2.3.1 generates a prediction box:

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

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

[0125] The confidence of each prediction box is calculated by the target existence probability and the intersection ratio of the prediction box and the true box. The target existence probability is a binary variable.

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

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

[0128] Where (b x , b y ) is the target center coordinate, (b w , b h ) is the size of the true box, and c is the box confidence.

[0129] Step S2.3.4 integrates the global detection results, and all grid prediction result vectors are summarized to form the results of the entire image to be detected. The detection results include: the boundary 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 application, the relatively innovative FFCA-YOLO and GSC-YOLO models and yolov5s, yolov7-tiny, yolov9-c were compared using the DB_Licenta data set.

[0132] Figure 5 The comparison graphs for box_loss and obj_loss testing are shown in Figures 1 and 2. The box_loss is used to measure the difference between the predicted bounding box and the true bounding box, and the obj_loss is used to measure the difference between the predicted box (i.e. the rectangle containing the object) and the true box. The closer the curve is to zero, the smaller the difference from the true value.

[0133] From Figure 5 As can be observed from Figure 3, the loss of the present application is closer to zero, indicating better training results.

[0134] From Figure 5 As can be seen from the curves shown in Figures 4 to 8, over time, the target detection model of the present application maintains higher evaluation index values than the other five models in four different indicators (precision, recall, mAP 50 and mAP 50-95).

[0135] Among them, the mAP 50 value refers to the average precision of the model correctly identifying the real target when the intersection over union (IoU) threshold is set to 50%.

[0136] The mAP 50-95 value is the average of the average precision values calculated at different IoU thresholds, usually from 50% to 95% with an increment of 5%.

[0137] The F1-score balances the performance of precision and recall by calculating the harmonic mean, avoiding the misleading that a single indicator may bring. The higher the F1-score, the more likely the model accurately identifies positive class samples while minimizing the misclassification of negative class samples as positive, demonstrating a good trade-off between accuracy and comprehensiveness.

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

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

[0140]

[0141] Figure 6The recognition abilities of six models including CBGS-YOLO in complex and variable scenes are compared in detail, especially focusing on pedestrian detection.

[0142] The scenes from left to right are: highly complex street background, densely wooded 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 target detection model of the 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 shown good detection ability, without false detection and missed detection and with high confidence. This fully proves the superiority and robustness of our model in complex environments. In the fourth group of low pixel target detection, all the models participating in the comparison successfully identified the target, but it is worth noting that the CBGS-YOLO model is not only accurate, but also has the highest detection confidence of 0.93. Therefore, the advanced nature and effectiveness of the model in processing small target detection tasks are further verified.

[0144] Comparison experiment two, comparison experiment on USOD dataset:

[0145] In order to more comprehensively verify the effectiveness and robustness of the target detection model of the application, a new dataset USOD different in characteristics from DB_Licenta dataset is selected for in-depth comparison. The significant 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. Through systematic evaluation of the latest YOLO variants including FFCA-YOLO, GSC-YOLO, and classic YOLOv5s, YOLOv7-tiny and YOLOv9-c models on the new dataset, we can more objectively show the excellent detection ability and optimization effect of the CBGS-YOLO model in complex, low-quality image environments. This research not only verifies the universality of the model of the application, but also highlights its significant advantages in processing challenging grayscale, low clarity images.

[0146] Figure 7 a and 7b directly reflect the efficiency of the training process.

[0147] Further observation Figure 7The performance curves in c to 7f show that, over time, the target detection model continuously exhibits significant advantages compared to the other five comparative models (including FFCA-YOLO, GSC-YOLO, YOLOv5s, YOLOv7-tiny, and YOLOv9-c) in terms of precision, recall, mAP 50, and mAP 50-95, and the specific data can be seen in Table 2.

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

[0149]

[0150] The experimental results described in Table 2 show that the target detection model is superior to other models in all five evaluation indicators (accuracy, recall, F1 score, mAP50, and mAP50-95), and compared to the best indicators in the comparative models, it exhibits an increase of 1.7%, 2.2%, 2.1%, 1.0%, and 1.1%, respectively. It can be seen that the model is effectively improved in this embodiment, and the model not only can effectively detect small weak targets in color images, but also can accurately detect small weak targets in grayscale images.

[0151] Further, the parameter amount (Parameters) refers to the sum of all trainable weights and biases in the model, which are distributed in network structures such as convolutional layers and fully connected layers, and is a key indicator for measuring the size, complexity, and computational requirements of the model. The size of the parameter amount is directly related to the memory occupation, training time, and inference speed of the model, and also affects the performance of the model, such as accuracy and generalization ability, to some extent.

[0152] As can be seen from the parameter amount in Table 2 and Table 1, the target detection model of the present embodiment has a low parameter amount while taking into account the excellent performance and accuracy of the previous items, realizing the lightweight design of the model.

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

[0154] Figure 8 The small weak target detection and recognition capabilities of the six models in four different scenarios are compared in detail. The scenarios involved in this experiment are: multi-target dispersion scene, moving target detection, target with multiple object occlusion, 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 application.

[0155] Through analysis, in the four groups of scenes, other models encounter false detection and missed detection problems to different degrees, and the target detection model shows good detection capability, and no false detection and missed detection occurs and the confidence is high. This fully proves the superiority and robustness of the model in the complex environment.

[0156] The target detection model of the application not only can accurately detect, but also has the best index of detection confidence among all models. Further verify its advancement and effectiveness in processing weak and small target detection task.

[0157] Therefore, using the method of the application, under the condition of meeting the conventional working condition, the perception probability of the state change of the infrared point target can be realized to be more than 95%, which provides a reliable scheme for the current weak and small target detection field.

[0158] Comparison experiment three, comparison of different attention mechanisms

[0159] As a comparison experiment, Table 3 shows the comparison of precision, recall, mAP50 and F1 score of the model under different attention mechanisms.

[0160] Table 3 Comparison of various attention mechanisms

[0161]

[0162] It can be known that in the embodiment, compared with using other attention mechanisms, the EMA attention mechanism module introduced in the C3 module has a significant effect.

[0163] Embodiment 2

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

[0165] The application discloses a kind of weak and small target detection device based on YOLOv5, comprising:

[0166] Data acquisition unit generates feature image according to inputted image to be detected;

[0167] Target detection unit uses the target detection model of weak and small target detection method based on YOLOv5 to predict weak and small target in image to be detected, according to prediction result, the target bounding box, probability class and confidence information of all detected weak and small targets in whole image to be detected are output.

[0168] Specifically, the data acquisition unit uses an N×N grid system to adaptively adjust the size of the image to be detected, obtaining an input feature image of 640x640.

[0169] The target detection unit comprises a trunk network, a neck network and a head network.

[0170] The trunk network comprises four SPD-Conv layers, three Ghost-Conv layers, three C3-EMA layers and one SPPF layer.

[0171] In this embodiment, CSPDarknet is used as the trunk network, SPD-Conv layers are used to replace Conv layers to extract shallow features, and Ghost-Conv layers are introduced to reduce the parameter quantity and thus the calculation amount. The feature image is first processed by the SPD-Conv layer for multi-scale processing, which can more effectively generate redundant feature maps and improve the calculation efficiency while maintaining the performance. Then, the Ghost-Conv layer is 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 subsequent calculation amount. The EMA attention mechanism is introduced in the C3 layer after the Ghost-Conv layer to form the C3-EMA layer for emphasizing key channels and spatial positions and suppressing unimportant information, thereby further enhancing the recognition ability of small targets.

[0172] The neck network comprises two feature pyramid networks and two path aggregation networks.

[0173] The feature pyramid network comprises one Ghost-Conv layer, one up-sampling layer and one feature fusion layer.

[0174] The path aggregation network comprises a cross-dimension interaction module, which is used to splice the features extracted by the SPD-Conv layer to form a new feature mapping in the channel dimension to capture the pixel-level pair relationship.

[0175] The head network comprises three detection heads for detecting targets of different resolutions.

[0176] Furthermore, the cross-dimension interaction module comprises, in order of processing, an SPD convolution layer, a feature fusion layer and a convolution layer.

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

[0178] The embodiment optimizes the YOLOv5 network model, improves the performance of the network model as a whole, overcomes the problem that the extracted features of the original model are too single, and makes the newly constructed target detection model have high recognition precision for small weak targets.

Claims

1. A small weak target detection method based on YOLOv5, characterized in that, The method comprises the following steps: performing preprocessing on a to-be-detected image to obtain a feature image; inputting the feature image into an optimized YOLOv5 target detection model, performing weak and small target detection by using the optimized YOLOv5 target detection model, and obtaining a weak and small target detection result; the optimization of the target detection model comprises: introducing an SPD-Conv module into a YOLOv5 neural network; replacing a Conv module of the YOLOv5 neural network with a Ghost-Conv module, and further extracting features of the SPD-Conv module by using the Ghost-Conv module; introducing an EMA attention mechanism module into a C3 module of the YOLOv5 neural network to form a C3_EMA module, and the C3_EMA module suppresses invalid information by segmenting a feature image and cross-stage connection; the optimization of the target detection model further comprises: in a feature fusion network of the YOLOv5 neural network, using a cross-dimension interaction module combined with an SPD-Conv module, a feature fusion module and a convolution module to fuse the extracted features, and capturing the mutual relationship between pixel-level shallow features and deep features; the features fused by the cross-dimension interaction module are further extracted by the C3_EMA module, and different sizes of feature images obtained are output by different resolution probes.

2. The method of claim 1, wherein, The step of preprocessing the to-be-detected image to obtain the feature image comprises: performing adaptive size adjustment on the to-be-detected image; using an N×N grid system to uniformly block the adjusted to-be-detected image to obtain the feature image.

3. The method of claim 1, wherein, The C3_EMA module is implemented as follows: the input feature image enters a first branch and a second branch respectively; the feature image is one-dimensional global pooled in the first branch to obtain channel attention weights, and is 3x3 convolved in the second branch to obtain spatial attention weights; the channel attention weights and the spatial attention weights 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.

4. The method of claim 3, wherein, The expression of the final output is as follows: Output_Features=Input_Features⊙(Channel_Attention×Spatial_Attention) wherein, ⊙ represents element-wise multiplication; Output_Features is the output feature; Input_Features is the input feature; Channel_Attention is the channel attention weight; Spatial_Attention is the spatial attention weight.

5. The method of claim 1, wherein, The step of weak and small target detection comprises: generating a prediction box: for a feature image containing any target center point in an N×N grid, generating a corresponding number of prediction boxes according to the number of preset anchor boxes of the N×N grid; calculating the confidence of the box: the confidence of each prediction box is calculated by the target existence probability and the intersection ratio of the prediction box and the real box, and the target existence probability is a binary variable; Generating a grid prediction result vector: arranging the prediction result of each of the grids into a vector y i , y i = [b x ,b y ,b w ,b h ,c] Among them, (b) x b y (b) represents the coordinates of the target center. w b h ) represents the size of the actual border, and c represents the confidence level of the border; Integrating the global detection result, all the grid prediction result vectors are summarized to form a result of the whole image to be detected.

6. A small weak target detection device based on YOLOv5, characterized in that, The application relates to a method for detecting a small target in an image. The data acquisition unit generates a feature image according to an input image to be detected. The target detection unit uses a target detection model of the method to predict a small target in the feature image and outputs a detection result.

7. The apparatus of claim 6, wherein, The target detection model comprises: The backbone network comprises four SPD-Conv layers, three Ghost-Conv layers, three C3-EMA layers and one SPPF layer. The neck network comprises two feature pyramid networks and two path aggregation networks. The feature pyramid network comprises one Ghost-Conv layer, one up-sampling layer and one feature fusion layer. The path aggregation network comprises a cross-dimension interaction module for splicing features extracted by the SPD-Conv layer to capture the mutual relationship between pixel-level shallow features and deep features. The head network comprises three detection heads for detecting targets of different sizes.

8. The apparatus of claim 7, wherein, The cross-dimension interaction module comprises, in processing order, 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, and the extracted deep features are fused with shallow features extracted by the Ghost-Conv layer of the feature pyramid network through the feature fusion layer, and then the fused features are further extracted by the convolution layer to obtain common features, and the common features are output by the head network after passing through the C3-EMA layer.