Lightweight night target detection method and system based on deep learning
By building a lightweight night object detection model based on deep learning, the problem of reduced accuracy and reliability in night object detection is solved, and accurate object detection and computing resources are achieved in low-light environments.
Patent Information
- Application Number
- CN202411789501.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-28
AI Technical Summary
The prior art has problems of reduced accuracy and reliability in night object detection, especially in low-light environments, the generalization ability of traditional object detection algorithms is poor and the computing resource consumption is large, making it difficult to achieve lightweight object detection.
A lightweight night object detection method based on deep learning is adopted, and a lightweight night object detection model is built through the image enhancement module, feature extraction module, feature fusion module, hybrid channel attention module and result output module to reduce the calculation complexity and improve the detection accuracy.
Accurate object detection is achieved in low-light environments, improving detection accuracy and reliability, while reducing the consumption of computing resources and meeting the needs of lightweight.
Smart Images

Figure CN119723045A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of target detection and relates to a lightweight nighttime target detection method and system based on deep learning. Background Art
[0002] Nighttime object detection is an important research direction in the field of computer vision, especially in the fields of autonomous driving, video surveillance, military reconnaissance and nighttime security monitoring. Traditional object detection algorithms are usually based on manually designed features and classifiers. The models are relatively simple, easy to understand and implement, but the generalization ability is poor. Due to the limitations of feature expression ability and classifier ability, the accuracy is usually lower than that of deep learning-based algorithms.
[0003] At present, the theory of deep learning is developing rapidly, the computing power of hardware is constantly improving, and a large number of excellent target detection frameworks have been developed and widely used in various industries. Compared with the traditional target detection method based on manual feature operators, the target detection method based on deep learning has significant advantages in detection accuracy and detection speed, which is mainly due to the advantages of convolutional neural networks.
[0004] Since nighttime traffic images often have problems such as low brightness and contrast, narrow dynamic range, prominent noise, and missing target details, the performance of general target detection frameworks is poor. This results in a significant reduction in the accuracy and reliability of nighttime target detection. In addition, target detection neural networks often contain a large number of parameters and complex calculations, requiring a large amount of computing resources. For portability and cost considerations, the need for lightweighting is imminent. Summary of the invention
[0005] In order to solve the above problems, the present invention provides a lightweight nighttime target detection method and system based on deep learning, aiming to achieve accurate target detection with low computational complexity in harsh lighting environments at night.
[0006] The technical bill to achieve the purpose of the present invention is:
[0007] A lightweight nighttime target detection method based on deep learning, comprising:
[0008] Acquire the night target image to be detected;
[0009] The obtained night target image is input into the pre-built night target detection model, and image enhancement, feature extraction, and feature fusion at different levels are performed in sequence to output the detection result;
[0010] The nighttime target detection model includes:
[0011] An image enhancement module is used to perform image enhancement and exposure correction on the input image to obtain an enhanced target image;
[0012] A feature extraction module is used to extract features from the enhanced target image obtained by the image enhancement module to obtain feature maps of different scales;
[0013] A feature fusion module is used to fuse feature maps of different scales output by the feature extraction module;
[0014] The hybrid channel attention module combines the information of local and global features as well as channel and spatial features for image fusion in the feature fusion module;
[0015] The result output module processes the fused feature map and outputs the detection results of the model.
[0016] Furthermore, the nighttime target detection model is based on a neural network, and the construction process includes:
[0017] Obtain a dataset of nighttime low-light target images, annotate the dataset, and use the annotated dataset for model training;
[0018] Based on the loss between the predicted results of the nighttime target detection model and the labeled real results, the neural network parameters are updated, and the model is trained for multiple iterations. During the iterative training, the model parameters are dynamically updated through back propagation and parameter optimizer to minimize the loss value and obtain the optimal neural network parameters.
[0019] After reaching the set maximum number of iterations and the loss value has not decreased, the training is stopped and the optimal model parameters are saved to obtain a trained lightweight nighttime target detection model.
[0020] Furthermore, the image enhancement module adopts an IAT network structure.
[0021] Furthermore, the feature extraction module adopts the yolov8n network model, including:
[0022] Local feature extractor, which uses standard convolutional layers to learn local features;
[0023] A surrounding context extractor that uses dilated / atrous convolutions to learn surrounding context with a larger receptive field;
[0024] The joint feature extractor fuses local features and surrounding contexts through concatenated layers, batch normalization, and parameterized ReLU operations to obtain joint features;
[0025] Global context extractor, which aggregates global context using global average pooling and further extracts global context through multi-layer perception;
[0026] Scaling layer to weight the joint features with the extracted global context.
[0027] Furthermore, the feature fusion module uses a pyramid network to fuse the three feature maps p1, p2, and p3 output by the feature extraction module. The specific fusion process includes:
[0028] The feature map p3 is upsampled and fused with the feature map P2 to obtain image F1, image F1 is fused with the feature map P1 after a residual layer and upsampling once to obtain image T1, image T1 is fused with image F1 after passing through a convolution layer once to obtain image F2, image F2 is passed through a residual layer once to obtain image T2, image T2 is fused with image P3 after passing through a convolution layer once to obtain image F3, image F3 is passed through a residual layer once to obtain image T3, and finally three feature images T1, T2, and T3 are obtained.
[0029] 6. A lightweight nighttime target detection method based on deep learning according to claim 5, characterized in that: the input of the hybrid channel attention module is the output of the feature fusion module, and the image processing process includes:
[0030] The input feature images T1, T2, and T3 are first processed by local average pooling and global average pooling;
[0031] The local pooled features are rearranged after a 1D convolution and then combined with the original input features through a multiplication operation;
[0032] The global pooled features are rearranged after 1D convolution and combined with the local pooled features through addition operation;
[0033] The feature map processed by local and global attention is restored to its original spatial dimension through unpooling operation again.
[0034] Further: the image processing process of the result output module includes:
[0035] The output feature maps of the hybrid channel attention module are input into the decoupling head for prediction, and the regression head outputs a four-dimensional vector, which represents the upper left corner coordinates x, y and the lower right corner coordinates x, y of the target box respectively;
[0036] The classification head performs regional pooling and convolution operations on each candidate box extracted by Anchor-Free to obtain a classifier, and outputs the value at each position of the tensor, indicating the probability that the candidate box belongs to each category;
[0037] Finally, the final detection results are screened out by maximum value suppression.
[0038] A lightweight nighttime target detection system based on deep learning, comprising:
[0039] An acquisition unit, used for acquiring images of nighttime targets to be detected;
[0040] The data processing unit inputs the obtained night target image into a pre-built night target detection model, performs image enhancement, feature extraction, feature fusion at different levels in sequence, and outputs the detection result; the night target detection model includes:
[0041] An image enhancement module is used to perform image enhancement and exposure correction on the input image to obtain an enhanced target image;
[0042] A feature extraction module is used to extract features from the enhanced target image obtained by the image enhancement module to obtain feature maps of different scales;
[0043] A feature fusion module is used to fuse feature maps of different scales output by the feature extraction module;
[0044] The hybrid channel attention module combines the information of local and global features as well as channel and spatial features for image fusion in the feature fusion module;
[0045] The result output module processes the fused feature map and outputs the detection results of the model.
[0046] Compared with the prior art, the present invention has the following significant advantages:
[0047] The present invention introduces a hybrid channel attention mechanism and adopts a lightweight downsampling module to improve the backbone network, which can effectively improve the accuracy of target detection while achieving lightweight.
[0048] The present invention adds an image enhancement network before the target detection network, which can effectively avoid missed detection and false detection due to poor lighting environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A flowchart of a lightweight nighttime target detection method based on deep learning is provided for an example of the present invention.
[0050] Figure 2 The network structure diagram of the image enhancement algorithm IAT constructed for the example of the present invention.
[0051] Figure 3 The architecture diagram of the lightweight downsampling method ContextedGuidedBlock constructed for the example of the present invention.
[0052] Figure 4 This is a diagram of the improved backbone network structure of the lightweight nighttime target detection model used in the example of the present invention.
[0053] Figure 5 This is a graph of the loss function during training of the lightweight nighttime target detection model used in the example of the present invention.
[0054] Figure 6 This is a map curve diagram of the lightweight night target detection model after training used in the example of the present invention.
[0055] Figure 7 This is a diagram showing the training effect of the lightweight nighttime target detection model used in the example of the present invention. DETAILED DESCRIPTION
[0056] This embodiment provides a lightweight nighttime target detection method based on deep learning, and the specific steps are as follows:
[0057] Acquire the night target image to be detected;
[0058] The obtained night target image is input into the pre-built night target detection model, and image enhancement, feature extraction, and feature fusion at different levels are performed in sequence to output the detection results.
[0059] The nighttime target detection model includes:
[0060] An image enhancement module is used to perform image enhancement and exposure correction on the input image to obtain an enhanced target image;
[0061] The feature extraction module extracts features from the enhanced target image obtained in the previous step to obtain feature maps of different scales;
[0062] The feature fusion module inputs the feature maps of different scales output by the feature extraction network into the feature fusion network, so that the feature maps of multiple scales are fused;
[0063] The hybrid channel attention module combines local and global features as well as channel and spatial features, which can increase the number of parameters and improve detection accuracy.
[0064] The result output module processes the fused feature map generated by the above steps to generate the output result of the model.
[0065] Step 1: Pre-build a lightweight nighttime target detection model. The specific implementation method is as follows:
[0066] Construct a lightweight neural network for nighttime target detection, which includes the following modules: image enhancement module, feature extraction module, feature fusion module, hybrid channel attention module and prediction module, and set the model parameters;
[0067] Obtain a dataset of nighttime low-light target images, annotate the dataset, and use the annotated dataset for model training;
[0068] Based on the loss between the model's predicted results and the labeled true results, the neural network parameters will be updated, and the model will be trained multiple times. In the iterative training, the model parameters are dynamically updated through back propagation and parameter optimizer to minimize the loss value and obtain the optimal neural network parameters.
[0069] After reaching the set maximum number of iterations and the loss value has not decreased, the training is stopped and the optimal model parameters are saved to obtain a trained lightweight nighttime target detection model.
[0070] Step 2: Input the input image into the constructed lightweight night object detection network, and first enter the IlluminationAdaptive Transformer (IAT) image enhancement network for image enhancement and exposure correction. The basic principle is to restore the normal illumination sRGB image (It) under low light or over / under exposure conditions by decomposing the image signal processor (ISP) pipeline into local and global image components;
[0071] IAT has a lightweight transformer architecture with 90k parameters, which makes the module very efficient in processing speed and resource consumption, suitable for real-time and resource-constrained application scenarios. The IAT network is mainly divided into two parts: local branch and global branch. The local branch processes the local features of the image. This branch extracts local features by using parameter enhancement modules multiple times, and further processes these features through convolutional layers;
[0072] The global branch processes the global information of the image and also contains multiple pixel enhancement modules (PEMs) and convolutional layers to process the global image content. It also contains a cross-attention mechanism to integrate the information of the local and global branches in order to more accurately adjust the color matrix and gamma value. Finally, through a reshaping operation and convolutional layer processing, the local and global adjustments are applied to the original input image, and the enhanced image is finally output;
[0073] The pixel-level enhancement module process is to input a feature map of size B×C×H×W, where B represents the batch size, C represents the number of channels, and H×W represents the height and width of the feature map. The input image passes through a series of 1×1 convolutional layers to perform a point-by-point linear transformation on the feature map to enhance or adjust the characteristics of the pixels to be determined. After each 1×1 convolutional layer, element-wise multiplication is performed. After the operation, the feature map is reshaped into a B×C×H×W shape;
[0074] The global prediction module process is that the feature map first passes through a fully connected layer to generate V, which represents the value vector of global information. Another fully connected layer connects K, which represents the key vector. K and V are combined with the query Q through a cross-attention mechanism, and the query Q comes from the local features. The result is reshaped to form a color correction matrix and a gamma correction value;
[0075] The image signal processor is simplified into a 3×3 color matrix WCi, Cj and a gamma parameter, and then a multiplication graph M and an addition graph A are used to complete the fitting with a least squares method. The overall formula is as follows:
[0076] I t =(max(∑ cj w ci,cj (I i ⊙M+A)),0) γ .
[0077] Step 3: Input the output image into the improved yolov8n network model. The improved network model includes a backbone network, a feature pyramid network, an attention mechanism, and a detection head connected in sequence.
[0078] For the backbone network, in order to achieve the effect of lightweight nighttime target detection, a lightweight downsampling method is used to replace the original convolution module;
[0079] The basic principle of this module is to simulate the human visual system's reliance on contextual information to understand the scene. It consists of the following parts:
[0080] Local feature extractor: learns local features using standard convolutional layers;
[0081] Surrounding context extractor: Use dilated / atrous convolutions to learn surrounding context with larger receptive fields;
[0082] Joint feature extractor: The joint features are obtained by fusing the output of local features and surrounding context through concatenation layers and batch normalization and parameterized ReLU operations.
[0083] Global context extractor: Global context is aggregated using global average pooling and further extracted through multi-layer perception. Then, a scaling layer is used to weight the joint features with the extracted global context to emphasize useful components.
[0084] like Figure 4 As shown, after the input image data is processed by the backbone network, three feature maps P1, p2, and p3 are output to the neck network at the 5th, 7th, and 10th layers of the backbone network respectively. The hierarchical structure of the yolov8n network model is well known in the art and will not be described in detail here.
[0085] Step 4: Input the three feature maps p1, p2, and p3 output by the backbone network into the feature pyramid network to fuse feature maps of multiple scales;
[0086] After upsampling, p3 is fused with P2 to obtain F1. After F1 passes through the C2f layer and an upsampling, it is fused with P1 to obtain T1. After T1 passes through an improved convolution layer and F1, it is fused to obtain F2. After F2 passes through a C2f layer once, it is obtained T2. After T2 passes through an improved convolution layer and P3, it is fused to obtain F3. After F3 passes through a C2f layer once, it is obtained T3. Finally, T1, T2, and T3 are obtained.
[0087] Step 5: Input it into the mixed channel attention network, the process is as follows:
[0088] The input T1, T2, T3 feature maps (C, WH) are first processed by local average pooling (LAP) and global average pooling (GAP). Local pooling focuses on the features of the local area, while global pooling captures the statistical information of the entire feature map;
[0089] The local pooled features and the global pooled features are transformed through a 1D convolution (Conv1d). The 1D convolution here is used to compress the feature channel while keeping the spatial dimension unchanged;
[0090] After 1D convolution, the features are rearranged to make them suitable for subsequent operations;
[0091] The local pooled features are rearranged after 1D convolution and then combined with the original input features through a "multiplication" operation (X). This process is equivalent to a feature selection, which strengthens the focus on useful features.
[0092] After 1D convolution and rearrangement, the global pooled features are combined with the local pooled features through an "addition" operation. This step incorporates global context information into the feature map.
[0093] The feature maps processed by local and global attention are restored to their original spatial dimensions through the unpooling (UNAP) operation again.
[0094] Step 6: Input the feature maps finally obtained by the network into the decoupling head for prediction. The decoupling head is divided into a regression head and a classification head. The target frame detection method adopts the Anchor-free method, which is divided into two sub-problems, namely determining the center of the object and predicting the four borders. The regression head outputs a four-dimensional vector, which represents the upper left corner coordinates x, y and the lower right corner coordinates x, y of the target frame. The classification head performs regional pooling and convolution operations on each target frame extracted by Anchor Free to obtain a classifier output tensor. The value at each position represents the probability that the target frame belongs to each target category. Finally, the final detection result is screened out by maximum value suppression.
[0095] The effect diagram of the method is as follows: Figure 7 As shown, this example not only achieves lightweight algorithm, but also has high accuracy of night target detection. It can identify objects in low illumination conditions and can also achieve accurate detection of multiple targets in complex environments.
[0096] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A lightweight nighttime target detection method based on deep learning, characterized in that: include: Acquire the night target image to be detected; The obtained night target image is input into the pre-built night target detection model, and image enhancement, feature extraction, and feature fusion at different levels are performed in sequence to output the detection result; The nighttime target detection model includes: An image enhancement module is used to perform image enhancement and exposure correction on the input image to obtain an enhanced target image; A feature extraction module is used to extract features from the enhanced target image obtained by the image enhancement module to obtain feature maps of different scales; A feature fusion module is used to fuse feature maps of different scales output by the feature extraction module; The hybrid channel attention module combines the information of local and global features as well as channel and spatial features for image fusion in the feature fusion module; The result output module processes the fused feature map and outputs the detection results of the model.
2. According to the light-weight nighttime target detection method based on deep learning in claim 1, it is characterized in that: The nighttime target detection model is based on a neural network, and the construction process includes: Obtain a dataset of nighttime low-light target images, annotate the dataset, and use the annotated dataset for model training; Based on the loss between the predicted results of the nighttime target detection model and the annotated true results, the neural network parameters are updated, and the model is trained iteratively for multiple times. During the iterative training, the model parameters are dynamically updated through back propagation and parameter optimizer to minimize the loss value and obtain the optimal neural network parameters. After reaching the set maximum number of iterations and the loss value has not decreased, the training is stopped and the optimal model parameters are saved to obtain a trained lightweight nighttime target detection model.
3. According to claim 2, a lightweight nighttime target detection method based on deep learning is characterized in that: The image enhancement module adopts an IAT network structure.
4. The method for lightweight nighttime target detection based on deep learning according to claim 3 is characterized in that: The feature extraction module adopts the yolov8n network model, including: Local feature extractor, which uses standard convolutional layers to learn local features; A surrounding context extractor that uses dilated / atrous convolutions to learn surrounding context with a larger receptive field; The joint feature extractor fuses local features and surrounding contexts through concatenated layers, batch normalization, and parameterized ReLU operations to obtain joint features; Global context extractor, which aggregates global context using global average pooling and further extracts global context through multi-layer perception; Scaling layer to weight the joint features with the extracted global context.
5. A lightweight nighttime target detection method based on deep learning according to claim 4, characterized in that: The feature fusion module uses a pyramid network to fuse the three feature maps p1, p2, and p3 output by the feature extraction module. The specific fusion process includes: The feature map p3 is upsampled and fused with the feature map P2 to obtain image F1, image F1 is fused with the feature map P1 after a residual layer and upsampling once to obtain image T1, image T1 is fused with image F1 after passing through a convolution layer once to obtain image F2, image F2 is passed through a residual layer once to obtain image T2, image T2 is fused with image P3 after passing through a convolution layer once to obtain image F3, image F3 is passed through a residual layer once to obtain image T3, and finally three feature images T1, T2, and T3 are obtained.
6. A lightweight nighttime target detection method based on deep learning according to claim 5, characterized in that: The input of the hybrid channel attention module is the output of the feature fusion module, and the image processing process includes: The input feature images T1, T2, and T3 are first processed by local average pooling and global average pooling; The local pooled features are rearranged after a 1D convolution and then combined with the original input features through a multiplication operation; The global pooled features are rearranged after 1D convolution and combined with the local pooled features through addition operation; The feature map processed by local and global attention is restored to its original spatial dimension through unpooling operation again.
7. A lightweight nighttime target detection method based on deep learning according to claim 6, characterized in that: The image processing process performed by the result output module includes: The output feature maps of the hybrid channel attention module are input into the decoupling head for prediction, and the regression head outputs a four-dimensional vector, which represents the upper left corner coordinates x, y and the lower right corner coordinates x, y of the target box respectively; The classification head performs region pooling and convolution operations on each candidate box extracted by the anchor-free method to obtain a classifier, and outputs the value at each position of the tensor, indicating the probability that the candidate box belongs to each category; Finally, the final detection results are screened out by maximum value suppression.
8. A light-weight nighttime target detection system based on deep learning for implementing any of the methods described in claims 1-7, characterized in that: include: An acquisition unit, used for acquiring images of nighttime targets to be detected; The data processing unit inputs the obtained night target image into the pre-built night target detection model, performs image enhancement, feature extraction, feature fusion at different levels in sequence, and outputs the detection result; The nighttime target detection model includes: An image enhancement module is used to perform image enhancement and exposure correction on the input image to obtain an enhanced target image; A feature extraction module is used to extract features from the enhanced target image obtained by the image enhancement module to obtain feature maps of different scales; A feature fusion module is used to fuse feature maps of different scales output by the feature extraction module; The hybrid channel attention module combines the information of local and global features as well as channel and spatial features for image fusion in the feature fusion module; The result output module processes the fused feature map and outputs the detection results of the model.
Citation Information
Patent Citations
Night pedestrian detection method and device based on deep learning
CN118298463A
Target detection method under bad weather based on multi-scale mixed attention module
CN118334413A
Target detection method based on improved YOLOv8
CN118485822A
Underwater moving target detection method and system based on lightweight improved Yolov8
CN118968274A
Cited By
Night anomaly detection method and device for ordinary speed railway, electronic equipment and medium
CN120931538A
Multi-scale pedestrian detection method based on information fusion in night scene
CN121170854A
Multi-scale pedestrian detection method based on information fusion in night scene
CN121170854B
Target detection method, target detection network training method and related device
CN121236357A
Text-fused multi-scale edge information multi-target detection method
CN121582546A
