Night small target detection method based on improved YOLOv9c model
The Nst-YOLOv9c model enhances nighttime small target detection by integrating CFEB, SPD-Adown, and FBM-CBAM modules to improve feature extraction and representation, achieving a 7.41% accuracy boost over YOLOv9c in low-light conditions.
Patent Information
- Application Number
- CN202411434584.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2024-12-31
AI Technical Summary
Existing methods for nighttime small target detection, particularly using YOLOv9, face challenges in accurately identifying and locating objects under low-light conditions due to high image noise, blurred edges, and low contrast, which affect detection accuracy and robustness.
An improved YOLOv9c model, named Nst-YOLOv9c, incorporates a comprehensive feature extraction module (CFEB), a spatial depth conversion downsampling module (SPD-Adown), and a feature boost module (FBM-CBAM) with channel and spatial attention mechanisms to enhance feature representation and capture detailed spatial information.
The Nst-YOLOv9c model significantly improves small target detection accuracy by 7.41 percentage points compared to YOLOv9c, effectively addressing issues of noise, blurred edges, and low contrast in night environments.
Smart Images

Figure CN119229295A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection under insufficient light or complex lighting conditions, and in particular to a method for detecting small targets at night based on an improved YOLOv9c model. Background Art
[0002] As a cutting-edge challenge in the field of computer vision, small target detection at night aims to accurately identify and locate objects in low-light or dark environments. It is of great significance to fields such as security monitoring, unmanned driving and ecological protection. With the advancement of technology, small target detection at night is not only related to the improvement of safety, but also becomes the key to promoting the intelligent development of related fields. However, the lack of light in the night environment brings a series of challenges such as high image noise, blurred target edges and low contrast, which seriously restricts the detection effect. To solve these problems, researchers are constantly exploring new technologies, including image enhancement, multimodal imaging and edge detection. Image enhancement technology significantly improves the clarity and visibility of night images by adjusting contrast and brightness and removing noise. Infrared imaging technology uses the principle of heat radiation to achieve effective detection of targets in low-light environments. Although these methods have improved the detection performance to a certain extent, the blurred image details and unclear target outlines in low-light environments are still a major problem.
[0003] With the rise of deep learning technology, especially the rapid development of target detection algorithms, new hope has been brought to the detection of small targets at night. Detection methods based on deep learning, such as faster regional convolutional neural networks, cascaded regional convolutional neural networks and YOLO series, can efficiently extract image features and achieve high-precision target detection by building complex neural network models. However, these methods still face the problems of missing image details and high noise interference in night environments, which affects the accuracy and robustness of detection. To this end, YOLOv9 came into being, with its advanced image enhancement and noise suppression mechanism, showing excellent detection performance in low-light environments. YOLOv9 captures key features at different resolutions through multi-scale feature fusion technology, enhancing the detection ability under low contrast and high noise conditions. At the same time, its optimized feature extraction module and the mechanism of dynamically adjusting image brightness further improve the detection accuracy. However, the existing YOLOv9 method is still insufficient in detecting low contrast, blurred edges and small targets, especially in complex night backgrounds, and accurate detection of small targets is still a major challenge. Summary of the invention
[0004] Purpose of the invention: The present invention aims to propose a nighttime small target detection method based on an improved YOLOv9c model, so as to effectively improve the small target detection accuracy under insufficient light or complex lighting conditions.
[0005] In order to solve the above technical problems, the present invention discloses a method for detecting small targets at night based on an improved YOLOv9c model, comprising the following steps:
[0006] Construct a nighttime small target detection model (referred to as Nst-YOLOv9c), which uses the YOLOv9c model as the benchmark network. The backbone network includes a comprehensive feature extraction module (Comprehensive Feature Extraction Block, CFEB) and a SPD-Adown downsampling module (Space-to-Depth Conventional-Adown), and the head includes a FBM-CBAM attention module (FeatureBoost Module-Convolutional Block Attention Module);
[0007] Iteratively training the nighttime small target detection model to obtain a trained nighttime small target detection model;
[0008] The trained nighttime small target detection model is used to detect the target to be detected to obtain a detection result.
[0009] Furthermore, the comprehensive feature extraction module is used to extract features from the input initial feature map to obtain the extracted feature map; the SPD-Adown downsampling module is used to process the extracted feature map, capture spatial information, and obtain an expressive feature representation. First, the CFEB module is designed in the feature extraction part, which can extract rich features and enhance the image representation ability, and comprehensively optimize the model's ability to capture and represent diverse and multi-scale features in complex scenes. Secondly, the SPD-Adown module is introduced in the downsampling part to help capture more detailed spatial information.
[0010] Furthermore, the FBM-CBAM attention module is located in the output head of the YOLOv9c model and is used to enhance the feature representation through the channel and spatial attention mechanism to obtain an enhanced feature map. The introduction of the FBM-CBAM module can capture more meaningful information, thereby improving the ability of image classification and detection.
[0011] Furthermore, the comprehensive feature extraction module includes a squeeze and excitation submodule (Squeeze-and-Excitation Block, SEBlock), a gradient enhancement submodule (Gradient Enhancement Module, GEModule) and a spatial pyramid convolution submodule (Spatial Pyramid Convolution, SPConv), and the comprehensive feature extraction module is used to extract features from the input initial feature map, and the extracted feature map includes:
[0012] The input initial feature map is passed through multiple convolutional layers to generate an intermediate feature map, and the input initial feature map and the intermediate feature map generated by each convolutional layer are spliced to obtain a spliced feature map;
[0013] Compress the number of channels from the total number of channels of the concatenated feature map to half to one-quarter of the dimension;
[0014] Expand the number of channels from the compressed dimension to the desired number of channels;
[0015] The extracted feature map is outputted through the squeezing and excitation submodule, the gradient enhancement submodule and the spatial pyramid convolution submodule in sequence.
[0016] Furthermore, SEBlock is an attention mechanism module consisting of global average pooling and two fully connected layers, which is used to enhance the response of important areas in the feature map. By learning the correlation between feature map channels, the response strength of the network in the area of interest is improved, and the interdependence between channels is enhanced through the squeezing and excitation modules, thereby improving the representation ability of the network.
[0017] The input of the squeeze and excitation submodules is characterized Figure X , from the characteristics Figure X First, extract image features and map them into U. Assuming that the feature map dimension of the current feature layer U is [C, H, W], the mapping process can be expressed as:
[0018] X→U,X∈R H′×W′×C′ ,U∈R H×W×C (1)
[0019] Among them, H′, W′ and C′ represent the height, width and number of channels of the input before mapping, respectively. H, W and C represent the height, width and number of channels after mapping, R is a real number set, R H′×W′×C′ and R H×W×CIt is represented as a three-dimensional tensor. Secondly, the [H, W] dimension of the feature map is globally averaged pooled, and the size of the feature map after pooling changes from [C, H, W] to [C, 1, 1]. Then, the vector after global pooling passes through a multilayer perceptron (MLP) to obtain the weight of each channel. Finally, the weight of each channel obtained in the above steps is applied to the feature map U, that is, each channel is multiplied by its own weight to obtain the weighted feature map U′.
[0020] Furthermore, GEModule is a gradient enhancement module that enhances the edge information of the feature map in dark scenes and improves the discrimination and representation capabilities of the features by calculating and adding the gradient to the input features. Specifically, the gradient of the input feature map U′ is first calculated by performing a 3×3 convolution operation on the weighted feature map U′. Then, the calculated gradient is added to the original input feature map U′ to obtain a feature map U″ with added gradient information. The purpose is to enhance the expressiveness of the original feature map by adding the gradient information back to the original feature map. Finally, a linear rectification function is applied to the feature map U″ with added gradient information to obtain the final enhanced feature map U″′. The gradient enhancement submodule calculates the feature gradient through the convolution layer and adds it to the original feature map. Combined with the application of the linear rectification function, it effectively overcomes the problems of gradient disappearance, insufficient feature extraction ability and weak model robustness in deep neural networks, significantly enhances the details in the feature map, and improves the model's recognition ability and robustness for complex scenes. This submodule promotes feature learning and representation, optimizes the feature extraction process, improves model performance, and provides richer feature information for subsequent modules, while enhancing the interpretability and robustness of the model.
[0021] Furthermore, SPConv is a multi-scale convolution module, which is special in that it combines convolution operations with different dilation rates to capture multi-scale information, thereby enhancing the spatial resolution and semantic information of the feature map. Its design purpose is to enhance the receptive field through different dilation rates, thereby capturing contextual information of different scales, and transform and integrate the features through two 1×1 convolutional layers, and finally output enhanced feature representation. The spatial pyramid convolution submodule is used to capture multi-scale information and enhance the spatial resolution and semantic information of the feature map U″′, including: processing the input feature map U″′ through a 1×1 convolution layer conv1 to adjust its number of channels without changing the spatial size; processing the input feature map U″′ through a 3×3 convolution layer conv2 with an expansion rate of [1,2,3,5] to capture contextual information of different scales, and splicing the output feature maps of these convolution layers with different expansion rates in the channel dimension; splicing the output of conv1 with the output of all convolution layers in conv2 again in the channel dimension to form a feature map with multiple channels; processing the spliced feature map through a 1×1 convolution layer conv3 to obtain a processed feature map; finally, applying a linear rectification function to add nonlinearity to the processed feature map to obtain a final output feature map; adding the final output feature map and the input initial feature map to obtain the extracted feature map x.
[0022] Furthermore, the SPD-Adown module is introduced in the downsampling part of the YOLOv9c model to help capture more detailed spatial information; the SPD-Adown module first performs an average pooling operation on the extracted feature map x, and then divides the average pooled tensor into two parts x1 and x2. x1 is processed by the spatial depth conversion convolution SPDConv (Space-to-DepthConventional), and x2 is processed by the maximum pooling and convolution. Finally, the number of receiving channels C of each part of the processed x1 and x2 is 1 The output is divided by 2 and concatenated together. This process can retain different types of features or resolutions in separate branches before merging the data, thereby retaining more local information and achieving better information fusion.
[0023] Furthermore, the FBM-CBAM attention module includes a convolutional attention module CBAM and a feature enhancement module FBM. The introduction of the FBM-CBAM module can capture more meaningful information, thereby improving the ability of image classification and detection;
[0024] The CBAM attention module (Convolutional Block Attention Module) contains two independent submodules, namely the Channel Attention Module (CAM) and the Spatial Attention Module (SAM). Among them, CAM is used to calculate channel attention, which enhances the network's attention to important channels by applying an attention mechanism to each channel of the input tensor; SAM is responsible for calculating spatial attention, which enhances the attention to important spatial locations by considering the spatial information of the feature map. In order to improve the discriminative ability of CBAM extracted features, a new feature enhancement FBM module is proposed in its structure.
[0025] The FBM-CBAM module uses the channel relationship of features to generate a channel attention map, which is input into the FBM module to output an enhanced channel attention map. Then, the spatial relationship between features is used to generate a spatial attention map, and the attention maps are fused to generate a redefined feature.
[0026] Furthermore, the FBM module includes the first convolution layer and the batch normalization layer, as well as the second convolution layer and the batch normalization layer. The function of the FBM module is to enhance and transform the input feature map through the two convolution layers and the batch normalization layer. In order to enhance the feature expression ability, it can be used at different levels in the deep neural network to improve the model's expression ability and generalization ability for the input data. Assume that the input of the FBM module is n, and the output of the first convolution layer and the batch normalization layer is out 1 It can be expressed as:
[0027] out 1 =σ(BN(Conv(n))) (6)
[0028] Among them, Conv(·) represents convolution and BN(·) represents batch normalization. The second convolution layer and batch normalization are similar to the above, and its output out 2 It is expressed as:
[0029] out 2 =σ(BN(Conv(out 1 ))) (7)
[0030] Finally, the feature map output by the FBM module is the result of processing by the second convolutional layer.
[0031] Beneficial effects:
[0032] Aiming at the challenges of increased image noise, blurred target edges and reduced contrast under low-light conditions, this paper proposes an improved model, Nst-YOLOv9c, based on the YOLOv9c model to improve the accuracy of small target detection. First, a novel comprehensive feature extraction module (CFEB) is introduced to significantly enhance the feature extraction capability. Secondly, the spatial depth conversion convolution (SPDConv) is integrated into the new downsampling module SPD-Adown to optimize the downsampling process, which not only reduces the feature dimension but also retains more key information and improves the feature fusion effect. In addition, a feature enhancement module (FBM) based on a convolutional neural network is designed and combined with a convolutional attention module (CBAM) to form a new FBM-CBAM attention module, which more accurately enhances the expression of important features through channel and spatial attention mechanisms. Experimental results show that compared with the YOLOv9c model, the accuracy of the Nst-YOLOv9c model in the nighttime small target detection task of the Exdark dataset is improved by 7.41 percentage points. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more clear.
[0034] Figure 1 A flowchart of a method for detecting small targets at night based on an improved YOLOv9c model proposed in an embodiment of the present application.
[0035] Figure 2 This is the structure diagram of the Nst-YOLOv9c model.
[0036] Figure 3 This is the CFEB module structure diagram.
[0037] Figure 4 This is the SEBlock structure diagram.
[0038] Figure 5 This is the GEModule structure diagram.
[0039] Figure 6 This is an example of a convolution kernel of 3×3 and a dilation rate of 2.
[0040] Figure 7 This is the SPD-Adown module structure diagram.
[0041] Figure 8 This is the FBM-CBAM module structure diagram.
[0042] Fig. 9 Comparison of PR curves of Nst-YOLOv9c and YOLOv9c models.
[0043] Fig.10 Comparison of F1 curves of Nst-YOLOv9c and YOLOv9c models.
[0044] Fig.11a and 11c are the detection results of YOLOv9c.
[0045] Fig.11b and 11d are the detection results of the Nst-YOLOv9c model. DETAILED DESCRIPTION
[0046] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0047] The present application embodiment discloses a method for detecting small targets at night based on an improved YOLOv9c model. Figure 1 As shown, the following steps are included:
[0048] A nighttime small target detection model (referred to as Nst-YOLOv9c model) is constructed. The nighttime small target detection model uses the YOLOv9c model as the benchmark network. The backbone network includes a comprehensive feature extraction module and an SPD-Adown downsampling module, and the head includes an FBM-CBAM attention module. Figure 2 As shown; Figure 2 It is a structural diagram of the Nst-YOLOv9c model proposed in this embodiment based on the existing YOLOv9c model.
[0049] The comprehensive feature extraction module is used to extract features from the input initial feature map to obtain the extracted feature map; the SPD-Adown downsampling module is used to process the extracted feature map to capture spatial information and obtain an expressive feature representation.
[0050] The FBM-CBAM attention module is located in the output head of the YOLOv9c model and is used to enhance the feature representation through the channel and spatial attention mechanism to obtain the enhanced feature map.
[0051] The CFEB module is designed in the feature extraction part of the YOLOv9c model, which can extract rich features and enhance the representation ability of the image. The comprehensive feature extraction module includes a squeeze and excitation submodule SEBlock, a gradient enhancement submodule GEModule, and a spatial pyramid convolution submodule SPConv. Figure 3As shown in the figure, in the CFEB module, the input initial feature map is passed through a series of convolution layers (3×3 convolution) to generate an intermediate feature map, and the input initial feature map and the intermediate feature map generated by each convolution layer are spliced to obtain the spliced feature map; the number of channels is compressed from the total number of channels of the spliced feature map to a smaller dimension (1×1 convolution); then, the number of channels is extended from the compressed dimension to the expected number of channels (ESE, Extend-Squeeze to Expected); finally, the extracted feature map is output through the squeeze and excitation sub-module, the gradient enhancement sub-module and the spatial pyramid convolution sub-module in sequence.
[0052] SEBlock is an attention mechanism module consisting of global average pooling and two fully connected layers. It is used to enhance the response of important areas in feature maps. It improves the response strength of the network in the area of interest by learning the correlation between feature map channels, and enhances the interdependence between channels through squeezing and excitation modules to improve the representation ability of the network.
[0053] like Figure 4 As shown, the input of the extrusion and excitation submodules is characterized Figure X , starting from a single image X, extract image features, and map the image features to U. Assuming that the feature map dimension of the current feature layer U is [C, H, W], the mapping process can be expressed as:
[0054] X→U,X∈R H′×W′×C′ ,U∈R H×W×C (1)
[0055] Among them, H′, W′ and C′ represent the height, width and number of channels of the input before mapping, respectively. H, W and C represent the height, width and number of channels after mapping, R is a real number set, R H′×W′×C′ and R H×W×C It is represented as a three-dimensional tensor. Secondly, the [H, W] dimension of the feature map is globally averaged pooled, and the size of the feature map after pooling changes from [C, H, W] to [C, 1, 1]. Then, the vector after global pooling passes through a multilayer perceptron (MLP) to obtain the weight of each channel. Finally, the weight of each channel obtained in the above steps is applied to the feature map U, that is, each channel is multiplied by its own weight to obtain the weighted feature map U′.
[0056] In formula (1), it is assumed that the convolution kernel is V = [v 1 ,v 2 ,...,v c ], where v c represents the cth convolution kernel, then a single image X is mapped to U = [u 1 ,u2 ,...,u c ], where u c represents the c-th two-dimensional matrix in U. The process is specifically expressed as:
[0057]
[0058] Among them, * represents the convolution operation, X=[x 1 ,x 2 ,...,x C′ ], Represents a 2D spatial kernel, acting on the convolution kernel of the channel corresponding to the input X, x s represents the sth input, s represents the number of inputs, 1≤s≤C′. Since the convolution operation is only performed in the local area, the receptive field of the front layer in the convolutional neural network is small, and it is difficult to capture the relationship between different channels, which makes it more difficult to extract global information and the association between channels. Therefore, by taking the squeezing operation, the entire spatial feature encoding on a channel is used as a global feature, and u obtained in formula (2) is c Perform global average pooling to obtain the local description operator z of the feature information distribution c , the process can be expressed as:
[0059]
[0060] Among them, F sq (·) is the extrusion operation, z=[z 1 ,z 2 ,…,z c ] is the global information of C feature maps obtained by formula (3).
[0061] In order to utilize the information gathered in the squeeze operation, the next step is to fully capture the channel dependency through the excitation operation. To this end, a simple gate mechanism is adopted and the S-type activation function is used to obtain the attention weight m, where m is the weight of the C feature maps in U, which can be expressed as:
[0062] m=F ex (z,W)=σ(g(z,W))=σ(W 2 σ(W 1 z)) (4)
[0063] Among them, F ex (·) is the excitation operation, σ(·) refers to the linear rectification function, g(·) is the S-type activation function, and r is a scaling parameter, the purpose of this parameter is to reduce the number of channels and thus reduce the amount of calculation.
[0064] GEModule is a gradient enhancement module that enhances the edge information of feature maps in dark scenes by calculating and adding gradients to input features, thereby improving the ability to distinguish and represent features. Specifically, Figure 5 As shown, first, a 3×3 convolution operation is performed on the weighted feature map U′ to calculate the gradient of the input feature map U′. Then, the calculated gradient is added to the original input feature map U′ to obtain a feature map U″ with added gradient information. The purpose is to enhance the expressiveness of the original feature map by adding the gradient information back to the original feature map. Finally, a linear rectification function is applied to the feature map U″ with added gradient information to obtain the final enhanced feature map U″′ to enhance the sparsity of the feature.
[0065] The spatial pyramid convolution submodule SPConv is a multi-scale convolution module. Its special feature is that it combines convolution operations with different dilation rates to capture multi-scale information, thereby enhancing the spatial resolution and semantic information of the feature map. Its design purpose is to enhance the receptive field through different dilation rates to capture contextual information of different scales, and transform and integrate the features through two 1×1 convolution layers, and finally output enhanced feature representation. First, the input feature map U″′ is processed through a 1×1 convolution layer conv1 to adjust its number of channels without changing the spatial size; then, the input feature map U″′ is processed through a 3×3 convolution layer conv2 with a dilation rate of [1,2,3,5] to capture contextual information of different scales, and the output feature maps of these convolution layers with different dilation rates are spliced in the channel dimension; then, the output of conv1 and the output of all convolution layers in conv2 are spliced again in the channel dimension to form a feature map with multiple channels; this spliced feature map is processed through a 1×1 convolution layer conv3 to obtain a processed feature map; finally, a linear rectification function is applied to add nonlinearity to the processed feature map to obtain a final output feature map; the final output feature map and the input initial feature map are added to obtain the extracted feature map x. In this embodiment, the convolution kernel size and dilation rate are set to 3×3 and [1,2,3,5] respectively. Figure 6 The convolution kernel size is 3×3, and the dilation rate of the atrous convolution receptive field is 2 as an example.
[0066] Since the dilated convolution can actually be regarded as filling "0" in the standard convolution kernel, it can be imagined as a standard convolution kernel with a larger size, so the receptive field size of the dilated convolution can be calculated using the method of calculating the receptive field of the standard convolution kernel. For a dilated convolution with a convolution kernel size of k and a dilation rate of r', the calculation formula for the receptive field F is:
[0067] F=k+(k-1)(r′-1) (5)
[0068] The SPD-Adown module is introduced in the downsampling part of the YOLOv9c model to help capture more detailed spatial information; Figure 7 This is the structural diagram of the SPD-Adown module. By introducing SPDConv on the basis of Adown to form a new SPD-Adown module, it can effectively capture local and multi-scale features and enhance feature fusion capabilities, thereby improving the understanding and expression of complex image scenes.
[0069] The SPD-Adown module first performs an average pooling operation on the input tensor x, and then divides the average pooled tensor into two parts, x1 and x2. x1 is processed by SPDConv (Space-to-Depth Conventional), x2 is processed by maximum pooling and convolution, and finally the number of receiving channels C of each part of the processed x1 and x2 is calculated. 1 The output is divided by 2 and concatenated together. This process can retain different types of features or resolutions in separate branches before merging the data, thereby retaining more local information and achieving better information fusion.
[0070] The FBM-CBAM module is introduced into the head part of the Nst-YOLOv9c model, which can capture more meaningful information, thereby improving the ability of image classification and detection;
[0071] The CBAM attention module contains two independent submodules, namely the channel attention module and the spatial attention module. Among them, CAM is used to calculate the channel attention, which enhances the network's attention to important channels by applying the attention mechanism to each channel of the input tensor; SAM is responsible for calculating the spatial attention, which enhances the attention to important spatial positions by considering the spatial information of the feature map. In order to improve the discriminative ability of CBAM extracted features, a new feature enhancement FBM module is proposed in its structure, such as Figure 8 shown.
[0072] The FBM-CBAM module uses the channel relationship of the features to generate a channel attention map, which is input into the FBM module to output an enhanced channel attention map. Then, the spatial relationship between the features is used to generate a spatial attention map, and the enhanced channel attention map and the spatial attention map are fused to generate a redefined feature. The input feature map F is generated through the channel attention and FBM module to generate an enhanced channel attention map A. c , A c Perform element-wise multiplication operation with the input feature map F to generate the input feature A required by the spatial attention module. A passes through the spatial attention module to generate the spatial attention map A s , A and A sPerform element-wise multiplication to obtain the final redefined features, Figure 8 middle Represents element-wise multiplication.
[0073] The FBM module includes the first convolution layer and batch normalization layer, as well as the second convolution layer and batch normalization layer. The function of the FBM module is to enhance and transform the input feature map through two convolution layers and batch normalization layers. In order to enhance the feature expression ability, it can be used at different levels in the deep neural network to improve the model's expression and generalization ability of the input data. Assume that the input of the FBM module is n, and the output of the first convolution layer and batch normalization is out 1 It can be expressed as:
[0074] out 1 =σ(BN(Conv(n))) (6)
[0075] Among them, Conv(·) represents convolution and BN(·) represents batch normalization. The second convolution layer and batch normalization are similar to the above, and its output out 2 It is expressed as:
[0076] out 2 =σ(BN(Conv(out 1 ))) (7)
[0077] Finally, the feature map output by the FBM module is the result of processing by the second convolutional layer.
[0078] The nighttime small target detection model is iteratively trained using the ExDark dataset, and the model is optimized using the SGD (Stochastic Gradient Descent) optimizer, with a batch normalization size of 8 and a total number of training cycles of 200 times, to obtain a trained nighttime small target detection model;
[0079] The trained nighttime small target detection model is used to detect the target to be detected to obtain a detection result.
[0080] Fig. 9 The PR curve (Precision-Recall Curve) of the Nst-YOLOv9c and YOLOv9c models is compared. As can be seen from the figure, the PR curve of the proposed Nst-YOLOv9c is closer to the upper right corner of the figure than the PR curve of YOLOv9c. This result shows that under the same recall rate, the accuracy of Nst-YOLOv9c is higher than that of YOLOv9c.
[0081] Fig.10The figure shows the comparison of the F1 curves of the Nst-YOLOv9c and YOLOv9c models. As can be seen from the figure, the F1-Confidence curve of the proposed Nst-YOLOv9c is above the F1-Confidence curve of the YOLOv9c, indicating that the comprehensive performance of the Nst-YOLOv9c model at different confidence thresholds is better than that of the YOLOv9c model, which means that the Nst-YOLOv9c model better balances precision and recall, and is more stable at multiple confidence levels.
[0082] Table 1 shows a comparative experiment using the ExDark dataset. The experimental results in Table 1 show that the model proposed in this embodiment leads all other models with an accuracy of 0.812, indicating that it performs best in correctly identifying positive samples. In contrast, the YOLOv8n model has the lowest accuracy (0.756). The mAP@0.5 of the model proposed in this embodiment is 0.781, which is better than other models.
[0083] Table 1
[0084]
[0085] Figure 11 shows the detection results under the condition of insufficient light at night and small and dense targets. The results show that the traditional YOLOv9c model fails to accurately identify the ship selected by the yellow box. Fig.11b It shows that the proposed Nst-YOLOv9c model successfully captures this imperceptible target. Fig.11c In the complex scene of vehicle occlusion and overlap, the traditional YOLOv9c model missed some vehicles framed by the red box, while Fig.11d The proposed model fully detects all vehicles. The comparison results intuitively reveal that the Nst-YOLOv9c model has significant advantages over the traditional YOLOv9c model in target recognition and detection of tiny objects and overlapping objects in night environments.
[0086] In a specific implementation, the present application provides a computer storage medium and a corresponding data processing unit, wherein the computer storage medium can store a computer program, and when the computer program is executed by the data processing unit, the invention content of an improved method for detecting small targets at night based on a YOLOv9c model provided by the present invention and some or all of the steps in each embodiment can be executed. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0087] Those skilled in the art can clearly understand that the technical solutions in the embodiments of the present invention can be implemented by means of computer programs and their corresponding general hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention are essentially or partly contributed to the prior art can be embodied in the form of a computer program, i.e., a software product, which can be stored in a storage medium and includes several instructions for enabling a device including a data processing unit (which can be a personal computer, a server, a single-chip microcomputer, a MUU or a network device, etc.) to execute the methods described in various embodiments of the present invention or certain parts of the embodiments.
[0088] The present invention provides a method for detecting small targets at night based on an improved YOLOv9c model. There are many methods and ways to implement the technical solution. The above is only a preferred implementation of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention. All components not specified in this embodiment can be implemented using existing technologies.
Claims
1. A nighttime small target detection method based on an improved YOLOv9c model, characterized in that: The following steps are involved: Construct a nighttime small target detection model, wherein the nighttime small target detection model uses the YOLOv9c model as the benchmark network, the backbone network includes a comprehensive feature extraction module and an SPD-Adown downsampling module, and the head includes an FBM-CBAM attention module; Iteratively training the nighttime small target detection model to obtain a trained nighttime small target detection model; The trained nighttime small target detection model is used to detect the target to be detected to obtain a detection result.
2. According to claim 1, a nighttime small target detection method based on an improved YOLOv9c model is characterized in that: The comprehensive feature extraction module is used to extract features from the input initial feature map to obtain the extracted feature map; the SPD-Adown downsampling module is used to process the extracted feature map to capture spatial information and obtain an expressive feature representation.
3. According to claim 2, a method for detecting small targets at night based on an improved YOLOv9c model, characterized in that: The FBM-CBAM attention module is located in the output head of the YOLOv9c model and is used to enhance the feature representation through the channel and spatial attention mechanism to obtain the enhanced feature map.
4. The method for detecting small targets at night based on the improved YOLOv9c model according to claim 3, characterized in that: The comprehensive feature extraction module includes a squeezing and excitation submodule, a gradient enhancement submodule and a spatial pyramid convolution submodule. The comprehensive feature extraction module is used to extract features from the input initial feature map. The extracted feature map includes: The input initial feature map is passed through multiple convolutional layers to generate an intermediate feature map, and the input initial feature map and the intermediate feature map generated by each convolutional layer are spliced to obtain a spliced feature map; Compress the number of channels from the total number of channels of the concatenated feature map to half to one-quarter of the dimension; Expand the number of channels from the compressed dimension to the desired number of channels; The extracted feature map is outputted through the squeezing and excitation submodule, the gradient enhancement submodule and the spatial pyramid convolution submodule in sequence.
5. The method for detecting small targets at night based on the improved YOLOv9c model according to claim 4, characterized in that: The squeeze and excitation submodule is an attention mechanism module consisting of a global average pooling and two fully connected layers, performing the following steps: The input of the squeeze and excitation submodule is the feature map X. Starting from the feature map X, the image features are extracted and mapped into the feature map U, U∈R H×W×C , where H, W and C represent the height, width and number of channels of the mapped image respectively, R is a real number set, R H×W×C Represented as a three-dimensional tensor; Perform global average pooling on the [H, W] dimension of the feature map U, and the size of the feature map after pooling becomes [C, 1, 1]; Pass the globally pooled vector through a multi-layer perceptron to obtain the weight of each channel; Apply the weight of each channel to the feature map U to obtain the weighted feature map U′.
6. The method for detecting small targets at night based on the improved YOLOv9c model according to claim 5, characterized in that: The gradient enhancement submodule is used to enhance the edge information of the feature map in the dark scene, including: A 3×3 convolution operation is performed on the weighted feature map U′ to calculate the gradient of the input feature map U′; the calculated gradient is added to the weighted feature map U′ to obtain a feature map U″ with added gradient information; a linear rectification function is applied to the feature map U″ with added gradient information to obtain the final enhanced feature map U″′.
7. The method for detecting small targets at night based on the improved YOLOv9c model according to claim 6, characterized in that: The spatial pyramid convolution submodule is used to capture multi-scale information and enhance the spatial resolution and semantic information of the feature map U″′, including: processing the input feature map U″′ through a 1×1 convolution layer conv1 to adjust its number of channels without changing the spatial size; processing the input feature map U″′ through a 3×3 convolution layer conv2 with an expansion rate of [1,2,3,5] to capture contextual information of different scales, and splicing the output feature maps of these convolution layers with different expansion rates in the channel dimension; splicing the output of conv1 with the output of all convolution layers in conv2 again in the channel dimension to form a feature map with multiple channels; processing the spliced feature map through a 1×1 convolution layer conv3 to obtain a processed feature map; finally, applying a linear rectification function to add nonlinearity to the processed feature map to obtain a final output feature map; adding the final output feature map and the input initial feature map to obtain the extracted feature map x.
8. The method for detecting small targets at night based on the improved YOLOv9c model according to claim 7, characterized in that: The SPD-Adown downsampling module is used to process the extracted feature map, capture spatial information, and obtain an expressive feature representation, including: first, performing an average pooling operation on the extracted feature map x, and then dividing the average pooled tensor into two parts, x1 and x2; x1 is processed by spatial depth conversion convolution SPDConv, and x2 is processed by maximum pooling and convolution. Finally, the number of receiving channels C1 of each part of the processed x1 and x2 is divided by 2 and spliced together as output.
9. The method for detecting small targets at night based on the improved YOLOv9c model according to claim 8, characterized in that: The FBM-CBAM attention module includes a convolutional attention module CBAM and a feature enhancement module FBM. The FBM-CBAM attention module is used to enhance feature representation through channel and spatial attention mechanisms. Obtaining an enhanced feature map includes: utilizing the channel relationship between features to generate a channel attention map, inputting the channel attention map into the FBM module, and outputting an enhanced channel attention map; then, utilizing the spatial relationship between features to generate a spatial attention map, and fusing the attention maps to generate a redefined feature.
10. A nighttime small target detection method based on an improved YOLOv9c model according to claim 9, characterized in that: The FBM module includes the first convolution layer and batch normalization layer, as well as the second convolution layer and batch normalization layer. The input of the FBM module is n, and the output out1 of the first convolution layer and batch normalization is expressed as: out1=σ(BN(Conv(n))) (6) Among them, Conv(·) represents convolution, BN(·) represents batch normalization; The output out2 of the second convolutional layer and batch normalization is expressed as: out2=σ(BN(Conv(out1))) (7) Finally, the feature map output by the FBM module is the result of processing by the second convolutional layer and the batch normalization layer.
Citation Information
Cited By
YOLOv9-based wind turbine blade small target detection method
CN119963499A
A wind turbine blade small target detection method based on YOLOv9
CN119963499B
Bank account bill automatic processing method and system based on OCR (Optical Character Recognition)
CN120296070A
