Weak light image real-time vehicle detection method, device, equipment and medium
By constructing a joint detection model and combining image enhancement and target detection synergistic optimization, the problems of accuracy and real-time performance in UAV vehicle detection under low light conditions were solved, achieving efficient vehicle positioning and recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-13
- Publication Date
- 2026-03-27
AI Technical Summary
Existing UAV vehicle target detection algorithms have low accuracy in low light environments, with high rates of missed detections and false detections, making it difficult to meet real-time requirements. Furthermore, the lack of deep integration between image enhancement and target detection leads to information loss and high computational complexity.
A joint detection model is constructed. Through the collaborative optimization of the image enhancement module and the target detection module, the model is trained using a preset joint loss function. The model is combined with a multi-scale Gaussian pyramid, an illumination perception network, and a YOLOv8 target detection network to achieve deep integration of image enhancement and target detection.
It improves the accuracy and reliability of vehicle detection using UAV images in low-light environments, and achieves real-time and efficient vehicle positioning and identification.
Smart Images

Figure CN121746961A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, device, and medium for real-time vehicle detection in low-light images. Background Technology
[0002] Unmanned aerial vehicle (UAV) vehicle target detection is a key technology for intelligent management of urban traffic systems. Its performance is related to the reliability of functions such as traffic flow statistics and violation monitoring. Under normal lighting conditions, target detection algorithms such as YOLO series and Faster R-CNN can achieve high-precision and real-time detection. However, urban traffic scenarios are complex, and low-light environments (such as at night, at dawn, and in tunnels) are common. In these situations, UAV images have increased noise, reduced contrast, and blurred target details, causing the accuracy of existing algorithms to plummet and the rates of missed detections and false detections to rise, making it difficult to meet the needs of practical applications.
[0003] Existing technologies typically employ image enhancement algorithms to preprocess images before inputting them into a target detection network. Multi-scale enhancement and target detection are processed as independent modules, failing to achieve deep integration. This results in information loss during feature transfer and high overall computational complexity, making it difficult to meet real-time requirements. Therefore, how to deeply integrate image enhancement and target detection to construct an integrated network that improves vehicle detection accuracy in low-light environments while ensuring real-time performance has become a pressing technical problem to be solved in this field. Summary of the Invention
[0004] This invention provides a real-time vehicle detection method for low-light images, which can achieve synergistic optimization of image enhancement and target detection, effectively solve the problem of vehicle detection in UAV images under low-light conditions, and improve the accuracy, reliability and real-time performance of vehicle detection in UAV images under low-light conditions.
[0005] In a first aspect, embodiments of the present invention provide a real-time vehicle detection method for low-light images, comprising: Preprocess the initial UAV images acquired in low-light environments; A joint detection model including an image enhancement module and an object detection module is constructed and trained. During the training process, a preset joint loss function is used to optimize the joint detection model. The preprocessed initial UAV imagery is input into the trained joint detection model, so that the image enhancement module enhances the initial UAV imagery, and the target detection module locates and identifies vehicles in the enhanced imagery and outputs the vehicle detection results.
[0006] Furthermore, the preprocessing of the acquired initial UAV images in low-light environments includes: Acquire initial drone images in low-light conditions, and adjust the resolution of the initial drone images to a preset resolution; The pixel values of the adjusted initial UAV image are logarithmic and then normalized to the mean.
[0007] Furthermore, the training process of the joint detection model includes: With the goal of co-optimizing the enhancement module and the detection module, a joint loss function is defined, which consists of category cross-entropy loss, confidence binary cross-entropy loss, and CIoU regression loss. Based on the joint loss function value calculated from the joint loss function, the parameters of the joint detection model are updated using the SGD optimizer until the joint loss function value converges.
[0008] Furthermore, the image enhancement module enhances the initial UAV imagery by including: The initial UAV imagery is input into a pre-constructed four-layer multi-scale Gaussian pyramid, and each layer of the Gaussian pyramid outputs an image of a corresponding scale. The image output from each layer of the Gaussian pyramid is decomposed into reflection and illumination components using an illumination sensing network. The reflection component is enhanced in detail and low frequency to obtain the final enhanced reflection component. The enhanced reflection component is fused with the illumination component to reconstruct the enhanced UAV image.
[0009] Furthermore, the step of performing detail enhancement and low-frequency enhancement on the reflection component to obtain the final enhanced reflection component includes: A convolutional neural network with attention mechanism is used to extract high-level semantic features of the reflection component, and an edge detection operator and residual connection are used to extract low-level detail features of the reflection component. The high-level semantic features and the low-level detail features are concatenated to obtain the enhanced reflection component. The low-frequency component of the reflection component was extracted using four different sized pooling layers. The low-frequency component is concatenated with the enhanced reflection component, and the final enhanced reflection component is output after passing through a convolutional layer.
[0010] Furthermore, the target detection module performs vehicle localization and recognition on the enhanced image, including: The enhanced UAV imagery is input into the YOLOv8 target detection network to extract low-level texture information and high-level semantic information, and output feature maps at multiple scales. Feature fusion is performed on the feature maps at each scale, and vehicle detection is performed on the fused feature maps through regression branch, classification branch and target confidence branch; The final inspection result is obtained by integrating the vehicle inspection results from all scales.
[0011] Furthermore, the process of performing vehicle detection on the fused feature map through regression branch, classification branch, and target confidence branch includes: Predict the bounding box coordinates of vehicles in the fused feature map by using regression branches; The probability distribution of categories is predicted by classification branches, and the categories include vehicle category and background category; The target confidence score is predicted by the target confidence branch, and the target confidence score is used to represent the probability that a real vehicle exists in the currently predicted bounding box.
[0012] Secondly, embodiments of the present invention provide a real-time vehicle detection device for low-light images, comprising: The image preprocessing module is used to preprocess the initial UAV images acquired in low-light environments. The joint detection model training module is used to construct and train a joint detection model including an image enhancement module and an object detection module. During the training process, a preset joint loss function is used to optimize the joint detection model. The joint detection model application module is used to input the preprocessed initial UAV image into the trained joint detection model, so that the image enhancement module can enhance the initial UAV image, and the target detection module can locate and identify vehicles in the enhanced image and output the vehicle detection results.
[0013] Thirdly, embodiments of the present invention provide an electronic device, comprising: Memory, used to store computer programs; A processor for executing the computer program; Wherein, when the processor executes the computer program, it implements the real-time vehicle detection method for low-light images as described in any of the first aspects above.
[0014] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed, implements the real-time vehicle detection method for low-light images as described in any of the first aspects.
[0015] Compared with existing technologies, the real-time vehicle detection method for low-light images provided by this invention has the following advantages: Preprocessing the initial UAV imagery acquired in a low-light environment; constructing and training a joint detection model including an image enhancement module and a target detection module, optimizing the joint detection model using a preset joint loss function during training; inputting the preprocessed initial UAV imagery into the trained joint detection model, so that the image enhancement module enhances the initial UAV imagery, and the target detection module locates and identifies vehicles in the enhanced imagery, outputting vehicle detection results; this invention achieves synergistic optimization of image enhancement and target detection, effectively solving the problem of vehicle detection in UAV images under low-light conditions, and improving the accuracy and reliability of vehicle detection in UAV images under low-light conditions. Attached Figure Description
[0016] To more clearly illustrate the technical features of the embodiments of the present invention, the drawings used in the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating a real-time vehicle detection method for low-light images provided in an embodiment of the present invention. Figure 2 This is a schematic diagram of the joint detection model provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of the lighting sensing network (IE) provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of the detail enhancement module (DPM) provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the low-frequency enhancement module (LEM) provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of the YOLOv8 target detection network provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of a real-time vehicle detection device for low-light imaging provided in an embodiment of the present invention; Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to limit the invention.
[0021] In a first aspect, embodiments of the present invention provide a real-time vehicle detection method for low-light images, see [link to relevant documentation]. Figure 1 This is a flowchart illustrating an embodiment of a real-time vehicle detection method for low-light images provided by the present invention.
[0022] like Figure 1 As shown, the method includes the following steps: S1: Preprocess the initial UAV images acquired in low-light environments; S2: Construct and train a joint detection model including an image enhancement module and an object detection module. During the training process, the joint detection model is optimized using a preset joint loss function. S3: Input the preprocessed initial UAV image into the trained joint detection model so that the image enhancement module enhances the initial UAV image, and the target detection module locates and identifies vehicles in the enhanced image and outputs the vehicle detection results.
[0023] In practice, initial UAV images in low-light environments are first acquired and preprocessed to construct a joint detection model, including an image enhancement module and a target detection module. Through a joint loss function and end-to-end training, the two modules are optimized collaboratively. The enhancement module provides high-quality input to the detection module, and the detection module in turn guides the feature learning of the enhancement module. The preprocessed images are input into the trained joint detection model. The image enhancement module first improves the quality, and then the target detection module completes the vehicle localization and recognition, finally outputting the detection results.
[0024] For example, see Figure 2 The image shown is a schematic diagram of the joint detection model. Figure 2 This section demonstrates the multi-scale enhancement logic of the image enhancement module and its collaborative relationship with the detection module. The upper part shows the multi-scale Gaussian pyramid and the enhancement module. The Gaussian pyramid (G0-G3) decomposes the preprocessed image into four multi-scale images, covering the feature requirements of vehicles of different sizes. The enhancement module independently enhances each pyramid image, and then fuses the multi-scale enhancement features through upsampling and feature concatenation (C). Finally, the enhanced image is output through a 3×3 convolutional layer. The lower part shows the details of the enhancement module. Based on Retinex theory, the enhancement module performs "detail + low frequency" dual enhancement on the reflection component. The IE (Illumination Perception Network) decomposes the input image into illumination and reflection components. The DPM (Detail Enhancement Module) enhances the details and semantic features of the vehicle through attention and edge detection. The LEM (Low Frequency Enhancement Module) enhances the overall contour of the vehicle through multi-scale pooling. The outputs of the cascaded DPM and LEM are passed through convolutional layers and residual connections to obtain the enhanced reflection component, which is then fused with the illumination component to complete the single-scale image enhancement. The enhanced image is input into the YOLOv8 detection module, and the final output is the vehicle detection result.
[0025] In summary, this invention proposes an innovative solution for initial UAV image processing in low-light environments, offering significant technical benefits: Preprocessing steps can initially improve image quality, laying a solid foundation for subsequent processing. A joint detection model, comprising an image enhancement module and a target detection module, is constructed and trained. Optimization using a preset joint loss function allows the model to simultaneously handle image enhancement and target detection tasks during training, improving overall performance. Inputting the preprocessed image into the trained model allows the image enhancement module to effectively improve the visual effect of low-light images, enhancing details and contrast. The target detection module then performs vehicle localization and recognition on the enhanced, clear image, ultimately outputting accurate vehicle detection results. This achieves synergistic optimization of image enhancement and target detection, effectively solving the problem of vehicle detection in UAV images under low-light conditions and improving the accuracy and reliability of vehicle detection in UAV images in low-light environments.
[0026] In one optional implementation, the preprocessing of the acquired initial UAV imagery in low-light conditions includes: Acquire initial drone images in low-light conditions, and adjust the resolution of the initial drone images to a preset resolution; The pixel values of the adjusted initial UAV image are logarithmic and then normalized to the mean.
[0027] Specifically, the core of preprocessing is to standardize the input, ensuring that the subsequent enhancement and detection modules process images of the same specifications, reducing model instability caused by differences in resolution and brightness distribution. The resolution of UAV images may vary due to different flight altitudes and camera parameters (such as 512×512, 2048×2048). Adjusting the resolution of all initial UAV images to a preset resolution, such as 1024×1024, can adapt to the input requirements of YOLOv8 and balance detection accuracy and real-time performance.
[0028] Low-light images typically have grayscale values concentrated in the low range, resulting in an extremely uneven grayscale distribution. To address this, the initial drone image's pixel values are logarithmically adjusted to stretch the low grayscale range, increasing the difference in detail in dark areas. Then, mean standardization is performed to further unify global features. The formula is as follows: ; in, The image after standardization processing. Images that have not undergone standardization processing. To obtain the mean of the logarithmic image, The standard deviation is denoted as .
[0029] By subtracting the mean, the grayscale center of the image is aligned to near 0, eliminating the influence of global brightness shift. Dividing by the standard deviation normalizes the grayscale distribution of the image to the same fluctuation range, avoiding inconsistent subsequent enhancement effects due to different grayscale variation amplitudes in different images.
[0030] The preprocessing steps of this invention standardize the initial UAV imagery from multiple dimensions such as resolution and grayscale distribution, laying a solid foundation for subsequent image enhancement and target detection, and effectively improving the accuracy and stability of vehicle target detection in UAV images under low-light conditions.
[0031] In one optional implementation, the training process of the joint detection model includes: With the goal of co-optimizing the enhancement module and the detection module, a joint loss function is defined, which consists of category cross-entropy loss, confidence binary cross-entropy loss, and CIoU regression loss. Based on the joint loss function value calculated from the joint loss function, the parameters of the joint detection model are updated using the SGD optimizer until the joint loss function value converges.
[0032] Specifically, if the enhancement module and the detection module are trained separately (enhancement first, then detection), the output of the enhancement module may be human-friendly, but not human-friendly for the detection model. This embodiment of the invention uses a joint training strategy to align the goals of the two modules and improve vehicle detection accuracy. First, the model training parameters are initialized. The training optimizer can use SGD, with an initial learning rate set to 0.01. During training, the entire network aims at collaborative optimization between the enhancement and detection modules, designing a unified joint loss function. This joint loss function consists of class cross-entropy loss, confidence binary cross-entropy loss, and CIoU regression loss, as shown below: ; in, For category cross-entropy loss, For confidence level binary cross-entropy loss, For CIoU regression loss, , , These are the weighting coefficients corresponding to each loss, ensuring balanced optimization of the three losses.
[0033] The three modules address the core tasks of bounding box localization, category determination, and target existence, ensuring a high degree of consistency in the optimization direction of the enhancement and detection modules. This prevents the enhancement module from blindly pursuing visual clarity and instead focuses on customizing enhancement features for the detection task, thereby improving detection accuracy from the root. Specifically, the category cross-entropy loss measures the difference between the predicted category (whether it is a vehicle) and the true category, ensuring accurate vehicle category determination; the confidence binary cross-entropy loss measures the difference between the probability that the predicted target is a real vehicle and the true label (1 = vehicle, 0 = background), reducing false background detections; and the CIoU regression loss measures the difference between the predicted bounding box and the true bounding box, ensuring accurate vehicle localization.
[0034] The training set is input into the joint detection model, the loss value is calculated according to the joint loss function, and the model parameters are updated using the SGD optimizer. During training, the model is evaluated using the validation set after a certain number of training iterations, and hyperparameters such as the learning rate are adjusted according to the evaluation results. Training is stopped when the joint loss function value no longer decreases significantly on the validation set or reaches the preset maximum number of iterations. The trained joint detection model is then used for the detection and recognition of target images (drone images in low-light environments). In practical applications, the vehicle detection results can be obtained quickly simply by inputting the image to be detected into the model.
[0035] The embodiments of this invention, through "joint loss + collaborative training", output images that are not only visually clear, but also contain vehicle semantic, edge, and localization features required by the detection model. This breaks down the module barriers between enhancement and detection, upgrading the two from sequential execution to collaborative optimization, and ultimately significantly improving the accuracy, real-time performance, and robustness of vehicle detection in low-light UAV images.
[0036] In one optional implementation, the image enhancement module enhances the initial UAV imagery by: The initial UAV imagery is input into a pre-constructed four-layer multi-scale Gaussian pyramid, and each layer of the Gaussian pyramid outputs an image of a corresponding scale. The image output from each layer of the Gaussian pyramid is decomposed into reflection and illumination components using an illumination sensing network. The reflection component is enhanced in detail and low frequency to obtain the final enhanced reflection component. The enhanced reflection component is fused with the illumination component to reconstruct the enhanced UAV image.
[0037] Specifically, the image enhancement module improves the quality of low-light images through multi-scale Gaussian pyramids, Retinex component decomposition and enhancement, and multi-scale feature reconstruction. First, the initial UAV image is input into a pre-constructed four-layer multi-scale Gaussian pyramid. For example, the hierarchical generation logic of the Gaussian pyramid is as follows: ; in, This represents the image of the nth level Gaussian pyramid (i.e., the image data of the nth level). This indicates a Gaussian filtering operation, the purpose of which is to eliminate image noise and avoid edge distortion during subsequent downsampling. This indicates a downsampling operation, which deletes even-numbered rows and columns of an image, reducing the image size to half its original size (e.g., a 1024×1024 image becomes 512×512 after downsampling).
[0038] Each Gaussian pyramid layer outputs an image at a corresponding scale to cover the multi-scale features of vehicles (large, medium, and small vehicles) in the UAV imagery. Each layer corresponds as follows: First layer : ,in This is the input raw image (resolution 1024×1024). This layer is the base layer of the pyramid, without filtering or downsampling. Second floor :right First, a 5×5 Gaussian filter is applied, then downsampling is performed to obtain a size of 512×512. ; Third layer :right Repeat the Gaussian filtering and downsampling operations to obtain a size of 256×256. ; Fourth floor :right Repeat the Gaussian filtering and downsampling operations to obtain a size of 128×128. .
[0039] Furthermore, for each layer of the Gaussian pyramid image, it is decomposed into reflection and illumination components using an illumination sensing network (IE), as shown in the following formula: ; in, This represents the image of the nth level Gaussian pyramid. It is the logarithmic form of the reflection component of the nth level image, reflecting the inherent details of objects (such as vehicle details) in that layer of image. This is the logarithmic form of the illumination component of the nth-level image, reflecting the illumination distribution of that layer of the image. For lighting sensing networks (IE) The output is the logarithmic form of the illumination component.
[0040] For example, Figure 3 This is a schematic diagram of the lighting perception network (IE). It consists of convolutional layers (1×1, 64 channels), activation functions (ReLU), depthwise separable convolutional layers (9×9, 64 channels), activation functions (ReLU), convolutional layers (1×1, 3 channels), and activation functions (Sigmoid) stacked in sequence. This network is the core module of Retinex component decomposition. Through the design of "lightweight convolution + large receptive field depthwise separable convolution", it can accurately capture the global illumination features of low-light images while ensuring computational efficiency, laying a key foundation for subsequent reflection component enhancement (restoring vehicle details).
[0041] The reflection component of each layer is enhanced in detail and low frequency to obtain the final enhanced reflection component. The enhanced reflection component is added to the illumination component, and the results of each layer are upsampled layer by layer (e.g., 128×128→256×256→512×512→1024×1024). At the same time, multi-scale features are cascaded, and finally the enhanced UAV image is reconstructed by fusing through convolutional layers.
[0042] This invention constructs a four-layer multi-scale Gaussian pyramid to decompose initial UAV images into images of different scales, comprehensively capturing multi-level features of the images. It utilizes an illumination perception network to decompose images at each scale into reflection and illumination components, accurately separating the essential information of the images. The reflection component is enhanced in terms of detail and low frequency, preserving rich details while improving overall quality, resulting in enhanced high-quality reflection components. Finally, the enhanced reflection components are fused and reconstructed, organically combining with the illumination components. This effectively improves the clarity, contrast, and information richness of UAV images in complex environments such as low light, providing a high-quality image foundation for subsequent tasks such as target detection.
[0043] In one optional implementation, the step of performing detail enhancement and low-frequency enhancement on the reflection component to obtain the final enhanced reflection component includes: A convolutional neural network with attention mechanism is used to extract high-level semantic features of the reflection component, and an edge detection operator and residual connection are used to extract low-level detail features of the reflection component. The high-level semantic features and the low-level detail features are concatenated to obtain the enhanced reflection component. The low-frequency component of the reflection component was extracted using four different sized pooling layers. The low-frequency component is concatenated with the enhanced reflection component, and the final enhanced reflection component is output after passing through a convolutional layer.
[0044] Specifically, for each layer's reflection component, the detail enhancement module (DPM) and low-frequency enhancement module (LEM) are processed in parallel to enhance details and contour features. The detail enhancement module includes a context enhancement branch and an edge enhancement branch. The context enhancement branch uses a convolutional neural network with an attention mechanism to focus on the vehicle region and extract semantic features. The edge enhancement branch uses edge detection operators (such as Sobel and Canny) combined with residual connections to preserve detailed features such as vehicle edges. The output features of the two branches are concatenated and then compressed in dimensionality through a convolutional layer to obtain the detail-enhanced reflection component.
[0045] For example, see Figure 4The diagram shows the structure of the Detail Enhancement Module (DPM). The goal of DPM is to enhance the edge, texture, and semantic details of the vehicle. The context enhancement branch includes residual linking blocks (used to extract high-level semantic features and capture vehicle category-level information, such as "front" and "wheels"), convolutional layers + Softmax (generating attention weights to weight semantic features, focusing on the vehicle region and ignoring the background), convolutional layers + Leaky ReLU (further refining features), and residual linking blocks (avoiding gradient vanishing in deep networks and ensuring the integrity of feature propagation). The edge enhancement branch includes two Sobel edge detections (directly capturing the vehicle's contour edges along the horizontal w and vertical h directions, respectively) and convolutional layers (used to fuse edge features). The feature concatenation (C) + final convolutional layer is used to output the edge-enhanced features. After fusing the outputs of the two branches, a reflection component feature with rich details and clear edges is obtained.
[0046] The low-frequency enhancement module uses four different pooling layers (1×1, 2×2, 3×3, 6×6) to extract low-frequency components, covering the contour requirements of vehicles of different sizes. For example, see [link to example]. Figure 5 The diagram shows the structure of the Low Frequency Enhancement Module (LEM). The goal of the LEM is to enhance the overall contour of the vehicle (low-frequency features). Its structure adopts a parallel design of multi-scale pooling and upsampling. The convolutional layer first extracts features from the input reflection components. The four pooling layers aggregate local pixel information and extract low-frequency components at different scales. Upsampling restores the small-sized features after pooling to the original input size. Finally, the features are cascaded and fused to achieve multi-scale low-frequency features. After passing through the convolutional layer, the reflection component features with a complete contour are output.
[0047] The output features of the detail enhancement module (DPM) and the low-frequency enhancement module (LEM) are concatenated and then output as the final enhanced reflection component through a convolutional layer.
[0048] This invention employs a convolutional neural network with an attention mechanism to extract high-level semantic features, focusing on regions with key semantic information in the image and accurately grasping the overall content. It utilizes edge detection operators and residual connections to extract low-level detail features, effectively preserving subtle information such as edges and textures, preventing detail loss. The two are then stitched together to enhance detail, balancing the overall semantics and local details of the image. Simultaneously, four different pooling layers of varying sizes are used to extract low-frequency components, capturing low-frequency information across different ranges and enhancing the smoothness and overall consistency of the image. Finally, the low-frequency components are cascaded with the enhanced reflection components and processed through convolutional layers, resulting in a high-quality, information-complete enhanced reflection component while simultaneously enriching the image's details.
[0049] In one optional implementation, the target detection module performs vehicle localization and recognition on the enhanced image, including: The enhanced UAV imagery is input into the YOLOv8 target detection network to extract low-level texture information and high-level semantic information, and output feature maps at multiple scales. Feature fusion is performed on the feature maps at each scale, and vehicle detection is performed on the fused feature maps through regression branch, classification branch and target confidence branch; The final inspection result is obtained by integrating the vehicle inspection results from all scales.
[0050] For example, see Figure 6 This is a schematic diagram of the YOLOv8 object detection network, including the Backbone, Neck module, Head (decoupled detection head), and Loss function. The Backbone receives enhanced UAV imagery and outputs multi-scale feature maps (P1, P2, P3, P4, P5) (the size decreases layer by layer, and the semantic information is enhanced layer by layer). The Neck module receives P3, P4, and P5 output from the Backbone and outputs fused multi-scale feature maps. The Head module receives the feature maps output from the Neck. Each scale feature map corresponds to a Decoupled Head. The Loss function is jointly optimized by class cross-entropy loss, confidence binary cross-entropy loss, and CIoU regression loss to drive network parameter updates. The final detection results, Bbox and Cls, are output after filtering out redundant boxes using Non-Maximum Suppression (NMS).
[0051] Specifically, the enhanced image already possesses the characteristics of uniform lighting and clear vehicle details. It still needs to pass through a target detection module to achieve vehicle localization and recognition. First, the enhanced UAV image is input into the YOLOv8 target detection network. The improved CSP-DarkNet backbone of YOLOv8 integrates the lightweight Bottleneck, CBS, and C2f modules to extract low-level texture features (such as vehicle edges and headlights) and high-level semantic features (such as "vehicle" category information) from the enhanced image, generating feature maps of different scales to adapt to vehicles of different sizes. This is denoted as: ; in, , , These represent the feature representations of the image at different spatial scales, with dimensions of respectively. , , ( (The height of the input image), with the number of channels increasing layer by layer.
[0052] Feature fusion is performed on the feature maps at each scale, and vehicle detection is performed on the fused feature maps through regression branch, classification branch and target confidence branch. The vehicle detection results of all scales are integrated to obtain the final detection result.
[0053] This invention uses the YOLOv8 network to locate and identify vehicles in enhanced UAV images. Through feature extraction, feature fusion, and target detection, it can accurately locate vehicle positions, determine vehicle categories, and assess detection reliability, significantly improving the accuracy and reliability of vehicle location and identification.
[0054] In one optional implementation, the process of performing vehicle detection on the fused feature map through regression branch, classification branch, and target confidence branch includes: Predict the bounding box coordinates of vehicles in the fused feature map by using regression branches; The probability distribution of categories is predicted by classification branches, and the categories include vehicle category and background category; The target confidence score is predicted by the target confidence branch, and the target confidence score is used to represent the probability that a real vehicle exists in the currently predicted bounding box.
[0055] Specifically, the Neck module of the YOLOv8 network borrows ideas from FPN and PAN to fuse multi-scale backbone features along uplink and downlink paths. By fusing shallow (containing rich texture and edge information) and deep (containing abstract semantic information) features, the Neck module generates a more discriminative multi-scale fused feature map. ; in, The fused feature map at the i-th scale will be used for the recognition of targets of different sizes (small, medium, and large). The feature fusion adopts a combination of lateral residual connection and upsampling / downsampling modules to maximize information flow.
[0056] The YOLOv8 network's decoupled detection head processes the "classification task," "localization task," and "confidence task" separately, with the fused feature map at each scale processed through three parallel branches: Regression branch: The bounding box coordinates (x, y, w, h) corresponding to each grid cell, where x and y are the offsets relative to the grid center, and w and h are the width and height of the predicted target box (using a log scale to make the numerical distribution more uniform and facilitate training). Classification branch: Predicts the probability distribution of categories, including vehicle category and background category; Target confidence branch: Predicts the probability of target existence (determines whether the location is a real vehicle and filters out false background detections). After integrating the outputs from all scales, the predicted results of all candidate boxes are obtained. YOLOv8 adopts an anchor-free mechanism, which no longer relies on preset anchor boxes, but achieves flexible detection through center point prediction and width and height regression, reducing redundant calculations and parameter count, while improving the flexibility of detection. After the candidate boxes from all scales are integrated, a non-maximum suppression (NMS) strategy is used to remove redundant detection results. For all candidate boxes, their intersection-over-union (IoU) ratio is calculated. For candidate boxes with high IoU overlap, only the predicted box with the highest confidence is retained, and the rest are deleted, finally obtaining a redundant and accurate vehicle detection box.
[0057] The final target detection result is as follows: ; in, This represents the set of all detected vehicle targets. The bounding box location of the vehicle target. For vehicle category labels, The confidence score for this objective. This represents the total number of vehicle targets detected.
[0058] This invention achieves efficient detection through an anchor-free mechanism, and then filters redundant boxes using NMS to finally output vehicle detection results containing "location, category, and confidence level", ensuring the accuracy and simplicity of vehicle detection in low-light scenes.
[0059] Secondly, embodiments of the present invention provide a real-time vehicle detection device for low-light images, see [link to relevant documentation]. Figure 2 This is a schematic diagram of one embodiment of a real-time vehicle detection device for low-light imaging provided by the present invention.
[0060] like Figure 2 As shown, the device includes: Image preprocessing module 21 is used to preprocess the initial UAV images acquired in low-light environments. The joint detection model training module 22 is used to construct and train a joint detection model including an image enhancement module and an object detection module. During the training process, a preset joint loss function is used to optimize the joint detection model. The joint detection model application module 23 is used to input the preprocessed initial UAV image into the trained joint detection model, so that the image enhancement module can enhance the initial UAV image, and the target detection module can locate and identify vehicles in the enhanced image and output the vehicle detection results.
[0061] In one optional implementation, the preprocessing of the acquired initial UAV imagery in low-light conditions includes: Acquire initial drone images in low-light conditions, and adjust the resolution of the initial drone images to a preset resolution; The pixel values of the adjusted initial UAV image are logarithmic and then normalized to the mean.
[0062] In one optional implementation, the training process of the joint detection model includes: With the goal of co-optimizing the enhancement module and the detection module, a joint loss function is defined, which consists of category cross-entropy loss, confidence binary cross-entropy loss, and CIoU regression loss. Based on the joint loss function value calculated from the joint loss function, the parameters of the joint detection model are updated using the SGD optimizer until the joint loss function value converges.
[0063] In one optional implementation, the image enhancement module enhances the initial UAV imagery by: The initial UAV imagery is input into a pre-constructed four-layer multi-scale Gaussian pyramid, and each layer of the Gaussian pyramid outputs an image of a corresponding scale. The image output from each layer of the Gaussian pyramid is decomposed into reflection and illumination components using an illumination sensing network. The reflection component is enhanced in detail and low frequency to obtain the final enhanced reflection component. The enhanced reflection component is fused with the illumination component to reconstruct the enhanced UAV image.
[0064] In one optional implementation, the step of performing detail enhancement and low-frequency enhancement on the reflection component to obtain the final enhanced reflection component includes: A convolutional neural network with attention mechanism is used to extract high-level semantic features of the reflection component, and an edge detection operator and residual connection are used to extract low-level detail features of the reflection component. The high-level semantic features and the low-level detail features are concatenated to obtain the enhanced reflection component. The low-frequency component of the reflection component was extracted using four different sized pooling layers. The low-frequency component is concatenated with the enhanced reflection component, and the final enhanced reflection component is output after passing through a convolutional layer.
[0065] In one optional implementation, the target detection module performs vehicle localization and recognition on the enhanced image, including: The enhanced UAV imagery is input into the YOLOv8 target detection network to extract low-level texture information and high-level semantic information, and output feature maps at multiple scales. Feature fusion is performed on the feature maps at each scale, and vehicle detection is performed on the fused feature maps through regression branch, classification branch and target confidence branch; The final inspection result is obtained by integrating the vehicle inspection results from all scales.
[0066] In one optional implementation, the process of performing vehicle detection on the fused feature map through regression branch, classification branch, and target confidence branch includes: Predict the bounding box coordinates of vehicles in the fused feature map by using regression branches; The probability distribution of categories is predicted by classification branches, and the categories include vehicle category and background category; The target confidence score is predicted by the target confidence branch, and the target confidence score is used to represent the probability that a real vehicle exists in the currently predicted bounding box.
[0067] Thirdly, embodiments of the present invention provide an electronic device, see [link to previous document]. Figure 3 The diagram shown is a structural schematic of an electronic device provided in an embodiment of the present invention.
[0068] like Figure 3 As shown, the device includes: Memory 31 is used to store computer programs; Processor 32 is used to execute the computer program; When the processor 32 executes the computer program, it implements the real-time vehicle detection method for low-light images as described in any of the above embodiments.
[0069] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 31 and executed by the processor 32 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.
[0070] The processor 32 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0071] The memory 31 can be used to store the computer programs and / or modules. The processor 32 implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory 31 and calling the data stored in the memory 31. The memory 31 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 31 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital card (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0072] It should be noted that the aforementioned electronic devices include, but are not limited to, processors and memory, as will be understood by those skilled in the art. Figure 3 The structural diagram is merely an example of the electronic device described above and does not constitute a limitation on the electronic device. It may include more components than shown in the diagram, or combine certain components, or use different components.
[0073] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program that, when executed, implements the real-time vehicle detection method for low-light images described in any of the above embodiments.
[0074] It should be understood that all or part of the processes in the above-described real-time vehicle detection method for low-light images can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium. When executed by a processor, the computer program can implement the steps of the above-described real-time vehicle detection method for low-light images. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
[0075] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. It should be noted that, for those skilled in the art, several equivalent obvious modifications and / or equivalent substitutions can be made without departing from the technical principles of the present invention, and these obvious modifications and / or equivalent substitutions should also be considered within the scope of protection of the present invention.
Claims
1. A real-time vehicle detection method for low-light images, characterized in that, include: Preprocess the initial UAV images acquired in low-light environments; A joint detection model including an image enhancement module and an object detection module is constructed and trained. During the training process, a preset joint loss function is used to optimize the joint detection model. The preprocessed initial UAV imagery is input into the trained joint detection model, so that the image enhancement module enhances the initial UAV imagery, and the target detection module locates and identifies vehicles in the enhanced imagery and outputs the vehicle detection results.
2. The real-time vehicle detection method for low-light images as described in claim 1, characterized in that, The preprocessing of the initial UAV images acquired in low-light environments includes: Acquire initial drone images in low-light conditions, and adjust the resolution of the initial drone images to a preset resolution; The pixel values of the adjusted initial UAV image are logarithmic and then normalized to the mean.
3. The real-time vehicle detection method for low-light images as described in claim 1, characterized in that, The training process of the joint detection model includes: With the goal of co-optimizing the enhancement module and the detection module, a joint loss function is defined, which consists of category cross-entropy loss, confidence binary cross-entropy loss, and CIoU regression loss. Based on the joint loss function value calculated from the joint loss function, the parameters of the joint detection model are updated using the SGD optimizer until the joint loss function value converges.
4. The real-time vehicle detection method for low-light images as described in claim 1, characterized in that, The image enhancement module enhances the initial UAV imagery, including: The initial UAV imagery is input into a pre-constructed four-layer multi-scale Gaussian pyramid, and each layer of the Gaussian pyramid outputs an image of a corresponding scale. The image output from each layer of the Gaussian pyramid is decomposed into reflection and illumination components using an illumination sensing network. The reflection component is enhanced in detail and low frequency to obtain the final enhanced reflection component. The enhanced reflection component is fused with the illumination component to reconstruct the enhanced UAV image.
5. The real-time vehicle detection method for low-light images as described in claim 4, characterized in that, The process of performing detail enhancement and low-frequency enhancement on the reflection component to obtain the final enhanced reflection component includes: A convolutional neural network with attention mechanism is used to extract high-level semantic features of the reflection component, and an edge detection operator and residual connection are used to extract low-level detail features of the reflection component. The high-level semantic features and the low-level detail features are concatenated to obtain the enhanced reflection component. The low-frequency component of the reflection component was extracted using four different sized pooling layers. The low-frequency component is concatenated with the enhanced reflection component, and the final enhanced reflection component is output after passing through a convolutional layer.
6. The real-time vehicle detection method for low-light images as described in claim 1, characterized in that, The target detection module performs vehicle localization and recognition on the enhanced image, including: The enhanced UAV imagery is input into the YOLOv8 target detection network to extract low-level texture information and high-level semantic information, and output feature maps at multiple scales. Feature fusion is performed on the feature maps at each scale, and vehicle detection is performed on the fused feature maps through regression branch, classification branch and target confidence branch; The final inspection result is obtained by integrating the vehicle inspection results from all scales.
7. The real-time vehicle detection method for low-light images as described in claim 1, characterized in that, The process of vehicle detection using the fused feature map through regression, classification, and target confidence branches includes: Predict the bounding box coordinates of vehicles in the fused feature map by using regression branches; The probability distribution of categories is predicted by classification branches, and the categories include vehicle category and background category; The target confidence score is predicted by the target confidence branch, and the target confidence score is used to represent the probability that a real vehicle exists in the currently predicted bounding box.
8. A real-time vehicle detection device for low-light imaging, characterized in that, include: The image preprocessing module is used to preprocess the initial UAV images acquired in low-light environments. The joint detection model training module is used to construct and train a joint detection model including an image enhancement module and an object detection module. During the training process, a preset joint loss function is used to optimize the joint detection model. The joint detection model application module is used to input the preprocessed initial UAV image into the trained joint detection model, so that the image enhancement module can enhance the initial UAV image, and the target detection module can locate and identify vehicles in the enhanced image and output the vehicle detection results.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program; Wherein, when the processor executes the computer program, it implements the real-time vehicle detection method for low-light images as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed, implements the real-time vehicle detection method for low-light images as described in any one of claims 1 to 7.