Vehicle identification method and device and electronic equipment
By enhancing and reconstructing nighttime vehicle images, and combining the backbone network, neck network, and prediction head, the accuracy of vehicle recognition is improved, solving the problem of low vehicle recognition accuracy in nighttime environments and achieving robustness and accuracy of intelligent transportation systems under low-light conditions.
Patent Information
- Application Number
- CN202511440628.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2025-12-30
AI Technical Summary
In nighttime environments, vehicle recognition accuracy is low. Existing technologies, such as infrared devices, are expensive and low-light enhancement algorithms are prone to image detail distortion. Traditional visible light-based cameras suffer from deteriorated imaging quality, blurred vehicle outlines, and significant noise interference, leading to a decrease in recognition rate.
By acquiring original vehicle images from traffic routes, image enhancement and reconstruction are performed. Feature extraction and enhancement are then carried out using the backbone network, neck network, and prediction head in the vehicle recognition model, ultimately yielding vehicle recognition results, including vehicle location and category information.
It improves the accuracy of vehicle image recognition at night, enhances the robustness and accuracy of vehicle recognition in intelligent transportation systems under low-light conditions, and solves the problem of low vehicle recognition accuracy in nighttime environments.
Smart Images

Figure CN121236715A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing, and more specifically, to a vehicle recognition method, apparatus, and electronic device. Background Technology
[0002] In recent years, with the rapid development of intelligent transportation systems and autonomous driving technologies, vehicle detection and recognition technologies based on artificial intelligence and deep learning have become a research hotspot in the field of computer vision. These technologies, through core tools such as convolutional neural networks (CNNs) and object detection algorithms (e.g., YOLO, Faster R-CNN), have been widely applied in traffic management, autonomous driving, and security monitoring.
[0003] Despite significant advancements in deep learning for vehicle detection and recognition, limitations remain. For instance, the dim background at night leads to a substantial drop in recognition rates. In low-light or nighttime conditions, the image quality of traditional visible light-based cameras deteriorates severely, resulting in blurred vehicle outlines and increased noise interference. While some systems incorporate infrared imaging techniques or low-light enhancement algorithms, infrared equipment is expensive, and these algorithms are prone to distorting image details. Therefore, the low accuracy of vehicle recognition in images acquired at night remains a challenge in these technologies.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This application provides a vehicle recognition method, apparatus, and electronic device to at least solve the technical problem of low accuracy in vehicle recognition in images collected in nighttime environments in related technologies.
[0006] According to one aspect of the embodiments of this application, a vehicle recognition method is provided, comprising: acquiring an original vehicle image in a traffic road, wherein the original vehicle image includes a vehicle image in a nighttime environment; performing image enhancement on the original vehicle image to obtain a first vehicle image, and reconstructing the first vehicle image to obtain a second vehicle image; extracting features from the second vehicle image using a backbone network in a vehicle recognition model to obtain a first feature map of the second vehicle image; enhancing the first feature map using a neck network in a vehicle recognition model to obtain a second feature map; and recognizing the second feature map using a prediction head in a vehicle recognition model to obtain a vehicle recognition result.
[0007] Optionally, image enhancement is performed on the original vehicle image to obtain a first vehicle image, including: converting the original vehicle image from a first color space to a second color space, and extracting the luminance value, hue value, and saturation value of the luminance channel of the original vehicle image in the second color space; determining the target illuminance value corresponding to each pixel in the original vehicle image based on the luminance value; determining the reflection value of each pixel in the original vehicle image based on the target illuminance value and the luminance value; determining the enhanced luminance value based on the reflection value and the target illuminance value; normalizing the enhanced luminance value to obtain the target luminance value; and converting the target luminance value, hue value, and saturation value corresponding to each pixel in the original vehicle image back to the first color space to obtain the first vehicle image.
[0008] Optionally, based on the brightness value, the target illuminance value corresponding to each pixel in the original vehicle image is determined, including: convolving the brightness value with a Gaussian kernel to obtain the initial illuminance value corresponding to each pixel in the original vehicle image; determining the global illuminance mean based on the initial illuminance values corresponding to all pixels in the original vehicle image; determining the gamma coefficient based on the initial illuminance value and the global illuminance mean; and adjusting the initial illuminance value based on the gamma coefficient to obtain the adjusted target illuminance value.
[0009] Optionally, the enhanced brightness value is determined based on the reflectance value and the target illuminance value, including: smoothing and denoising the reflectance value through guided filtering to obtain a filtering result; determining a residual map based on the reflectance value and the filtering result; fusing the residual map and the filtering result to obtain a first fusion result; and determining the enhanced brightness value based on the target illuminance value and the first fusion result.
[0010] Optionally, reconstructing the first vehicle image to obtain the second vehicle image includes: performing initial convolution on the first vehicle image using a convolutional layer of a convolutional neural network to obtain a shallow feature map; performing multi-level feature compression on the shallow feature map using the lower channel branch of the convolutional neural network to obtain a first feature map sequence; fusing the feature maps in the first feature map sequence to obtain a first fused feature map; performing hierarchical channel expansion on the first fused feature map using the upper channel branch of the convolutional neural network to obtain a second feature map sequence; fusing the second feature map sequence and the shallow feature map to obtain a second fused feature map; and performing reconstruction convolution on the second fused feature map to obtain the second vehicle image.
[0011] Optionally, the feature maps in the first feature map sequence are fused to obtain a first fused feature map, including: performing max pooling and compensated convolution on the feature maps of each level in the first feature map sequence to obtain a third feature map after processing at each level; and performing channel concatenation and fusion operations on the third feature maps of all levels to obtain the first fused feature map.
[0012] Optionally, the upper channel branch of the convolutional neural network is used to perform hierarchical channel expansion on the first fused feature map to obtain the second feature map sequence, including: obtaining the fourth feature map of each level in the first feature map sequence; after each channel expansion of the first fused feature map, channel concatenation is performed with the fourth feature map of the corresponding level to obtain the fifth feature map of each level; and the second feature map sequence is obtained based on the fifth feature maps of all levels.
[0013] Optionally, the backbone network includes a convolutional batch normalization activation module, a cross-stage partial connection module, and a multi-branch context preservation module. The backbone network in the vehicle recognition model is used to extract features from the second vehicle image to obtain a first feature map of the second vehicle image. This includes: normalizing the pixel values in the second vehicle image to obtain a third vehicle image; performing a first-stage processing on the third vehicle image through the convolutional batch normalization activation module to obtain a first processed feature map; performing a second-stage processing on the first processed feature map through the multi-branch context preservation module and the cross-stage partial connection module to obtain a second processed feature map; performing a third-stage processing on the second processed feature map through a custom feature processing module and the cross-stage partial connection module to obtain a third processed feature map; and determining the first feature map based on the second and third processed feature maps.
[0014] Optionally, the third vehicle image is processed in the first stage by the convolutional batch normalization activation module to obtain a first processed feature map, including: acquiring the third vehicle image, the first convolutional kernel, and the first step length; in the convolutional batch normalization activation module, the third vehicle image is subjected to convolution operation and batch normalization operation based on the first convolutional kernel and the first step length to obtain a sixth feature map; and the sixth feature map is processed by an activation function to obtain the first processed feature map.
[0015] Optionally, the first processed feature map is processed in a second stage through a multi-branch context preservation module and a cross-stage partial connection module to obtain a second processed feature map. This includes: obtaining the first processed feature map, a second convolutional kernel, and a second stride; in the multi-branch context preservation module, performing depthwise separable convolution, max pooling, and ordinary convolution operations on the first processed feature map according to the second convolutional kernel and the second stride to obtain a first intermediate feature map, a second intermediate feature map, and a third intermediate feature map; performing concatenation and channel reduction operations on the first intermediate feature map, the second intermediate feature map, and the third intermediate feature map to obtain a fourth intermediate feature map; and in the cross-stage partial connection module, performing channel concatenation based on the fourth intermediate feature map and the third vehicle image to obtain the second processed feature map.
[0016] Optionally, the second processed feature map is processed in a third stage through a custom feature processing module and a cross-stage partial connection module to obtain a third processed feature map, including: obtaining the second processed feature map, a third convolution kernel, and a third stride; in the custom feature processing module, performing a convolution operation on the second processed feature map based on the third convolution kernel and the third stride to obtain a fifth intermediate feature map; in the cross-stage partial connection module, performing channel concatenation based on the fifth intermediate feature map and the third vehicle image to obtain the third processed feature map.
[0017] Optionally, the neck network in the vehicle recognition model is used to enhance the features of the first feature map to obtain the second feature map, including: obtaining a second processed feature map and a third processed feature map from the first feature map, wherein the third processed feature map includes sub-feature maps under multiple detection scales; performing layer-by-layer upsampling and fusion operations on the second processed feature map and the third processed feature map in a first order to obtain a sixth intermediate feature map; performing layer-by-layer downsampling on the second processed feature map and the third processed feature map in a second order to obtain a seventh intermediate feature map; and determining the second feature map based on the sixth intermediate feature map and the seventh intermediate feature map.
[0018] According to another aspect of the embodiments of this application, a vehicle recognition device is also provided, comprising: an acquisition module for acquiring original vehicle images in traffic roads, wherein the original vehicle images include vehicle images in a nighttime environment; a processing module for performing image enhancement on the original vehicle images to obtain a first vehicle image, and reconstructing the first vehicle image to obtain a second vehicle image; and a recognition module for performing feature extraction on the second vehicle image using a backbone network in a vehicle recognition model to obtain a first feature map of the second vehicle image, performing feature enhancement on the first feature map using a neck network in a vehicle recognition model to obtain a second feature map, and performing recognition on the second feature map using a prediction head in a vehicle recognition model to obtain a vehicle recognition result.
[0019] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the above-described vehicle identification method.
[0020] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored computer program, wherein the device containing the non-volatile storage medium executes the above-described vehicle identification method by running the computer program.
[0021] According to another aspect of the embodiments of this application, a computer program product is also provided, including computer instructions that, when executed by a processor, implement the above-described vehicle identification method.
[0022] In this embodiment, original vehicle images from traffic roads are acquired, including vehicle images in a nighttime environment. Image enhancement is performed on the original vehicle images to obtain a first vehicle image, and the first vehicle image is reconstructed to obtain a second vehicle image. The backbone network of a vehicle recognition model is used to extract features from the second vehicle image to obtain a first feature map. The neck network of the vehicle recognition model is then used to enhance the features of the first feature map to obtain a second feature map. Finally, the prediction head of the vehicle recognition model is used to identify the second feature map, resulting in a vehicle recognition result. This achieves the goal of improving the accuracy of nighttime vehicle image recognition, thereby enhancing the robustness and accuracy of vehicle recognition in intelligent transportation systems under low-light conditions. This also solves the technical problem of low accuracy in vehicle recognition in images acquired in nighttime environments in related technologies. Attached Figure Description
[0023] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0024] Figure 1 This is a hardware structure block diagram of a computer terminal for implementing a vehicle identification method according to an embodiment of this application;
[0025] Figure 2 This is a flowchart of a vehicle identification method according to an embodiment of this application;
[0026] Figure 3 This is a structural diagram of a vehicle identification device according to an embodiment of this application. Detailed Implementation
[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0029] First, some nouns or terms that appear in the explanation of the embodiments of this application shall be interpreted as follows:
[0030] CNN (Convolutional Neural Network): A deep learning model used to process data with a grid structure, such as images. It automatically detects key features in the input data through convolutional layers, reduces data dimensionality using pooling layers, and performs classification or regression using fully connected layers. It is widely used in fields such as image recognition and computer vision.
[0031] MB-CRM (Multi-Branch Context Retaining Module) is a module used in deep learning that enhances the model's ability to retain contextual information by processing multiple branches in parallel and fusing features at different scales. It is particularly effective in improving detection accuracy and model robustness when detecting small objects in images.
[0032] CBS (Conv–Bn–SiLU, Convolution-Normalization-SiLU Activation Function): is a combined layer in deep learning that includes convolution for feature extraction, batch normalization (BN) for accelerating training and stabilizing the model, and the SiLU activation function (Scaled Exponential Linear Unit) for introducing non-linearity.
[0033] Coordinate attention (CA) is a lightweight attention mechanism used in deep learning networks to optimize the channel and spatial information of feature maps. By learning attention weights for height and width separately and then fusing them, CA can highlight important features, suppress irrelevant information, and improve model efficiency and accuracy.
[0034] DPCNB (Dual-channel Pixel Channel Note Block) is a module in deep learning models that enhances the representation of key features in feature maps by processing pixel and channel information in parallel. It utilizes an attention mechanism to weight the spatial pixel and channel dimensions separately, enabling the network to focus more on target features and improve recognition accuracy, making it particularly suitable for target detection in complex backgrounds.
[0035] FPN (Feature Pyramid Network) is a multi-scale feature extraction structure used to enhance the performance of deep learning models in detecting objects of different sizes. It generates a series of feature maps at different scales through top-down feature fusion and bottom-up feature refinement, enabling the model to more effectively identify objects from large to small, significantly improving the accuracy and robustness of object detection.
[0036] BCE (Binary Cross-Entropy Loss) is a commonly used loss function for binary classification problems. It measures the difference between the predicted probability and the actual label, prompting the model to learn a more accurate classification boundary. In deep learning, BCE helps optimize the performance of binary classification tasks.
[0037] HCFWM (Hybrid Cavity Feeling Wild Module) is a mechanism in deep learning networks used to expand the receptive field while maintaining resolution. By combining dilated convolutions with standard convolutions, HCFWM can capture more contextual information without reducing the feature map size, enhancing the network's understanding of image details. It is suitable for tasks requiring fine feature extraction, such as semantic segmentation and object detection.
[0038] GAP (Global Average Pooling) is a pooling technique commonly used at the end of deep learning models to reduce feature dimensionality and extract global features. It generates a fixed-length vector by averaging the pixel values across the entire feature map, effectively avoiding excessive parameters in fully connected layers while maintaining the model's adaptability to different input image sizes.
[0039] GMP (Global Max Pooling) is a method used in deep learning for feature compression. It generates a fixed-size output by selecting the maximum value in the feature map, thus preserving the most prominent feature information. It is often used to reduce model complexity and the risk of overfitting, especially in image classification tasks, where it can effectively capture key local features of an image.
[0040] GIoU (Generalized IoU Loss) is a loss function used in object detection to optimize bounding box regression. It not only calculates the intersection-union ratio of the predicted and ground truth boxes, but also considers the smallest enclosing rectangle between the two boxes, providing a more comprehensive assessment of the box localization accuracy. This improves upon the shortcomings of traditional IoU loss in cases of small overlap, thereby enhancing the bounding box prediction accuracy of the detection model.
[0041] IoU (Intersection over Union) is a metric used to evaluate the accuracy of bounding box prediction in object detection algorithms. It calculates the ratio of the area of the intersection of the predicted bounding box and the ground truth bounding box to the area of their union. A ratio closer to 1 indicates a better match between the predicted bounding box and the ground truth bounding box. IoU is widely used in loss calculations during model training to help the model learn more accurate location information.
[0042] mAP (Mean Average Precision) is a comprehensive metric for evaluating model performance in object detection tasks. It calculates the average precision across different thresholds, reflecting the model's average detection accuracy and recall across various categories. A higher mAP indicates better model performance, which is particularly crucial when assessing the model's ability to detect small or overlapping targets.
[0043] PANet (Path Aggregation Networks) is a network architecture designed to improve feature propagation and enhance multi-scale feature fusion. It effectively transmits information through bottom-up side connections and a top-down path aggregation mechanism, enhancing the network's sensitivity to object boundaries and small targets. In object detection, PANet can improve the model's localization accuracy and detection performance, especially excelling in images with multi-layered structures.
[0044] PAB (Pixelated Attention Block) is a module in deep learning used to enhance attention to important pixels in feature maps. It assigns weights to each pixel, highlighting key local information while suppressing irrelevant areas, thereby improving the network's ability to capture details. In image recognition and segmentation tasks, PAB helps the model focus on object boundaries and textures, improving detection accuracy.
[0045] RNN (Recurrent Neural Network): A type of neural network that processes sequential data. It captures the temporal dependencies of data by establishing recurrent connections between neurons, allowing information to be passed between different points in time in the sequence.
[0046] Spatial Pyramid Pooling (SPP) is an image feature extraction technique for fixed-size outputs. It generates multi-scale feature representations by applying pooling windows of different sizes to the input feature map, and then concatenates these features to form a fixed-length output. SPP enhances the network's adaptability to targets of different sizes, eliminates the need for a fixed input image size, and improves the flexibility and accuracy of object detection and image classification.
[0047] DNFPM (Densely Networked Features Pyramid Module) is a network architecture used for object detection. It forms a multi-scale feature pyramid by densely connecting features across different layers, enhancing feature reuse and multi-path transmission of information, making it particularly suitable for detecting multi-scale targets. DNFPM can effectively fuse features from different levels, improving the model's ability to recognize small targets and complex backgrounds, thereby enhancing detection accuracy and robustness.
[0048] In intelligent transportation systems, deep learning models can analyze video streams captured by cameras in real time to perform tasks such as traffic flow statistics, illegal parking identification, and lane departure warnings. For example, the YOLO series of algorithms, with their high efficiency in single-stage detection, can process video data at a rate of tens of frames per second in intelligent traffic monitoring, providing decision support for traffic light optimization and congestion mitigation. In autonomous driving scenarios, two-stage detection models such as Faster R-CNN generate high-precision candidate boxes through Region Proposal Networks (RPNs), accurately identifying the position and motion state of surrounding vehicles and providing crucial environmental perception information for path planning. Furthermore, combined with multi-sensor fusion technology, vehicle detection systems can maintain high robustness under adverse weather conditions such as rain and fog.
[0049] Despite significant progress in traffic vehicle detection and recognition using deep learning, several challenges and limitations remain. Here are some key shortcomings and drawbacks: 1. Dark backgrounds at night lead to a significant drop in recognition rates. In nighttime or low-light conditions, the image quality of traditional visible light-based cameras deteriorates severely, resulting in blurred vehicle outlines and increased noise interference. While some systems incorporate infrared imaging technology or low-light enhancement algorithms, infrared equipment is expensive, and low-light enhancement algorithms easily distort image details. Experiments show that the average accuracy of existing mainstream models in nighttime scenes decreases by approximately 15%-20% compared to daytime, with a particularly high false negative rate for dark-colored vehicles and distant targets. Furthermore, headlight glare and streetlight shadows further interfere with feature extraction, making it difficult for RGB-based deep learning models to effectively distinguish vehicles from the background. 2. Camera image quality limitations cause feature extraction failures. In practical applications, many deployed surveillance cameras, limited by cost or environment, often operate in low-resolution or high-compression modes, leading to a loss of image details. For example, when a vehicle occupies less than 5% of the image, the small target detection accuracy of YOLO series models drops by more than 30%. Furthermore, motion blur and lens distortion can also damage the structural features of vehicles, rendering traditional detection methods based on handcrafted features completely ineffective. Although super-resolution reconstruction techniques can partially recover image details, they introduce additional computational latency, making it difficult to meet real-time requirements. 3. The detection algorithms lack scene adaptability; the model may struggle to learn the features of these signs, resulting in low recognition rates. 4. In real-world environments, existing deep learning models are typically trained on large-scale general datasets, but the diversity of real-world application scenarios far exceeds the coverage of these datasets. For example, urban roads have high vehicle density and complex vehicle types, while highway scenes mainly consist of long-distance, same-direction vehicles; the requirements for the scale sensitivity and feature generalization ability of the detection model differ significantly between the two. In addition, the lighting conditions and background complexity of special scenes (such as parking lots and tunnels) can lead to model overfitting. Although transfer learning and domain adaptation techniques can partially alleviate this problem, it is still necessary to re-label data and fine-tune the model for specific scenes, increasing deployment costs.
[0050] To address the problems existing in related technologies, such as unclear nighttime images, low image resolution, and low recognition rates of detection algorithms in specific scenarios, this application provides a vehicle recognition method that can operate in... Figure 1 The computer terminal shown is described below.
[0051] The vehicle recognition method embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal for implementing a vehicle recognition method is shown. Figure 1 As shown, the computer terminal 10 may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions connected via wired and / or wireless networks. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0052] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0053] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the vehicle recognition method in this embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the aforementioned vehicle recognition method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0054] The transmission module 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 106 may be a radio frequency (RF) module, used for wireless communication with the Internet.
[0055] The display can be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10.
[0056] It should be noted here that, in some optional embodiments, the above... Figure 1 The computer terminal shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 1 This is only one instance of a specific particular instance, and is intended to illustrate the types of components that may exist in the aforementioned computer terminal.
[0057] In the above operating environment, this application provides a vehicle identification method embodiment. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than that shown here.
[0058] Figure 2 This is a flowchart of a vehicle identification method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:
[0059] Step S202: Obtain original vehicle images in traffic roads, wherein the original vehicle images include vehicle images in nighttime environments.
[0060] In step S202 above, the original vehicle image can be a vehicle image to be identified in an autonomous driving environment, including vehicle images in a nighttime environment.
[0061] Step S204: Image enhancement is performed on the original vehicle image to obtain a first vehicle image, and the first vehicle image is reconstructed to obtain a second vehicle image.
[0062] In step S204 above, image enhancement is performed on the original vehicle image to improve the image quality in low-light environments. Through multi-step processing, comprehensive optimization of brightness, contrast, and detail is achieved to obtain a first vehicle image. This first vehicle image is then reconstructed to further improve image clarity, resulting in a second vehicle image. Specifically, in situations of insufficient lighting or low resolution, image enhancement and reconstruction of the original vehicle image are necessary to optimize image quality and improve the accuracy and robustness of subsequent vehicle detection and recognition. During the image enhancement stage, preprocessing of the original vehicle image significantly enhances it, making dark details clearer, suppressing overexposure in highlight areas, and improving the overall contrast and clarity, thus obtaining the enhanced first vehicle image. Furthermore, the original resolution of the enhanced first vehicle image needs to be confirmed. If its original resolution is low, insufficient detail will still exist, directly affecting the subsequent vehicle detection and recognition performance. Therefore, super-resolution reconstruction of the first vehicle image is required to further improve its clarity, resulting in the second vehicle image.
[0063] Step S206: The backbone network in the vehicle recognition model is used to extract features from the second vehicle image to obtain a first feature map of the second vehicle image. The neck network in the vehicle recognition model is used to enhance the features of the first feature map to obtain a second feature map. The prediction head in the vehicle recognition model is used to recognize the second feature map to obtain the vehicle recognition result.
[0064] In step S206 above, the backbone network of the vehicle recognition model (such as the MBCRM-YOLOv8 model) performs multi-layer feature abstraction on the image through a series of convolutional layers, pooling layers, and activation functions to obtain a first feature map. This first feature map is a multi-scale feature representation output by the backbone network, containing key information in the image, such as contours, textures, and color patterns. However, these features have not yet reached the optimal recognition state and need further enhancement. The neck network is used to connect the output of the backbone network and the input of the prediction head. By performing high-level feature enhancement on the first feature map, the model can better understand the target object. After processing by the neck network, a second feature map is obtained. The prediction head is used to transform the second feature map into the final vehicle recognition result, which includes information such as the vehicle's position (boundary box) and category.
[0065] Through steps S202 to S206 described above, the accuracy of vehicle image recognition at night is improved, thereby enhancing the robustness and accuracy of vehicle recognition in intelligent transportation systems under low-light conditions. This solves the technical problem of low vehicle recognition accuracy in images acquired in nighttime environments in related technologies. The following is a further explanation.
[0066] In step S204 of the above vehicle recognition method, image enhancement is performed on the original vehicle image to obtain a first vehicle image, including: converting the original vehicle image from a first color space to a second color space, and extracting the luminance value, hue value, and saturation value of the luminance channel of the original vehicle image in the second color space; determining the target illuminance value corresponding to each pixel in the original vehicle image based on the luminance value; determining the reflection value of each pixel in the original vehicle image based on the target illuminance value and the luminance value; determining the enhanced luminance value based on the reflection value and the target illuminance value; normalizing the enhanced luminance value to obtain the target luminance value; and converting the target luminance value, hue value, and saturation value corresponding to each pixel in the original vehicle image back to the first color space to obtain the first vehicle image.
[0067] In the above steps, the target illuminance value corresponding to each pixel in the original vehicle image is determined based on the brightness value, including: convolving the brightness value with a Gaussian kernel to obtain the initial illuminance value corresponding to each pixel in the original vehicle image; determining the global illuminance mean based on the initial illuminance values corresponding to all pixels in the original vehicle image; determining the gamma coefficient based on the initial illuminance value and the global illuminance mean; and adjusting the initial illuminance value based on the gamma coefficient to obtain the adjusted target illuminance value.
[0068] In the above steps, the enhanced brightness value is determined based on the reflectance value and the target illuminance value, including: smoothing and denoising the reflectance value through guided filtering to obtain the filtering result; determining the residual map based on the reflectance value and the filtering result; fusing the residual map and the filtering result to obtain the first fusion result; and determining the enhanced brightness value based on the target illuminance value and the first fusion result.
[0069] In some embodiments of this application, the image enhancement process can be implemented through an image enhancement module. This image enhancement module is designed based on Retinex theory and uses an illumination adaptive correction algorithm to address the image quality improvement problem in low-light environments. It achieves comprehensive optimization of brightness, contrast, and detail through multi-step processing. The specific process is as follows:
[0070] First, the input image (i.e., the original vehicle image) is converted from RGB space (i.e., the first color space) to HSV space (i.e., the second color space), and the luminance channel is extracted for focused illumination processing to avoid color distortion. Then, multi-scale Gaussian filtering (small scale 15, medium scale 80, large scale 250) is used to convolve the luminance channel, separating the illuminance component reflecting the overall illumination distribution. The filtering results from different scales are then weighted and fused to balance local details and global illumination information. Next, the global mean of the illuminance component is calculated, and an adaptive gamma correction function is designed based on this. The gamma coefficient is dynamically adjusted according to the difference between the local illuminance (i.e., the initial illuminance value) and the global mean: the coefficient is reduced in dark areas to enhance brightness, and the coefficient is increased in bright areas to suppress overexposure, thereby optimizing the brightness distribution and improving contrast. In the reflection component processing stage, the reflection component containing texture details is first separated from the illuminance component, and then denoised using a guided filter (window radius of 6) while preserving edge structure. By calculating the residual map of the reflection component and the filtering result, high-frequency edge information is extracted. Adaptive weights are designed based on the image's average gradient, and the residual map is fused with the filtering result. A larger gradient results in a higher detail enhancement ratio, achieving a balance between denoising and edge sharpening. Finally, the corrected illuminance component (i.e., the target illuminance value) is multiplied with the optimized reflection component (i.e., the first fusion result) to reconstruct the luminance channel and normalize its dynamic range. This is then combined with the original hue and saturation channels and converted back to RGB space to generate the enhanced image (i.e., the first vehicle image). This step, through multi-scale illuminance extraction, dynamic gamma correction, guided filtering denoising, and adaptive residual fusion, significantly improves the brightness uniformity and detail clarity of low-light images. It combines the advantages of adaptive illumination response, edge preservation, and color fidelity, making it suitable for real-time image enhancement in low-light scenarios such as automotive and security applications.
[0071] Specifically, the steps include the following:
[0072] Step 1.1: First, convert the original vehicle image from the RGB color space (i.e., the first color space) to the HSV color space (i.e., the second color space), separate the luminance channel to avoid color distortion, and focus on lighting processing. This involves processing the original vehicle image... Convert to HSV color space, extract the luminance channel B, and retain the hue channel H and saturation channel S. Image pixel coordinates, Represented as coordinates in HSV space The brightness value ranges from [0,1].
[0073] Step 1.2: Separate the illuminance component (or illuminance value) from the luminance channel to reflect the overall illumination distribution of the image, providing a basis for subsequent brightness adjustment. Multi-scale Gaussian filtering: Uses three Gaussian kernels of different scales. right Convolution is performed to extract multi-scale illumination information. Small-scale... Setting it to 15 is used to capture local details at a medium scale. Setting it to 80 is used to balance global and local details, for large scales. Set to 250 to capture global illumination. The Gaussian kernel expression is:
[0074]
[0075] The formula for multi-scale weighted summation is:
[0076]
[0077] in, It represents the first Weights for each scale (usually taken as...) (To ensure information balance across all scales). This is a convolution operation. The representation is the coordinates in the image. The initial illuminance value at a location reflects the distribution of light intensity in the scene and is low-frequency information.
[0078] Step 1.3: Next, adaptive gamma correction is performed, dynamically adjusting the gamma coefficient according to the image illumination distribution to enhance details in dark areas and suppress overexposure in bright areas, and calculating the global illumination mean. As a benchmark for light distribution:
[0079]
[0080] in, This represents the global mean calculation function. A two-dimensional adaptive gamma function is designed based on the local illuminance value (or initial illuminance value) E(u,v) and the mean. Difference Adjusted Gamma Coefficient :
[0081]
[0082] when << (Dark areas): Enhance the brightness of dark areas; when ≈ (Midtone area): Brightness remains constant; when >> (Highlighted area): To suppress overexposure.
[0083] Adjusting the illuminance component using the gamma correction formula:
[0084]
[0085] in, The corrected target illuminance component (or target illuminance value) is maintained in the range [0,1].
[0086] Step 1.4: Separate the reflection component from the luminance channel to remove noise and enhance texture details, thereby improving image sharpness. This is done by targeting the illuminance component. Separate the reflection component (or reflection value). The formula is as follows:
[0087]
[0088] in, Minimum constant, to avoid the denominator being zero. This represents the surface texture of an object, which is high-frequency information, ranging from [0, 1] to [0, 2]. ].
[0089] Use guided filtering right Perform smoothing and noise reduction while preserving edge structure:
[0090]
[0091] in, =5 represents the filter window radius, which controls the smoothing range. =0.1 represents the regularization parameter, which prevents singular denominators; This indicates the filtering result.
[0092] Calculate the residual image between the reflection component and the filtering result to extract edge details:
[0093]
[0094] in, This represents the residual map, containing high-frequency edges and texture information. Design weights. The fusion filtering result and the residual map show that the weights are positively correlated with the image gradient.
[0095]
[0096] in, This represents the average gradient of the channels, reflecting the richness of image detail.
[0097]
[0098] Where M and N represent the image width and height, respectively. The fusion formula is:
[0099]
[0100] in, This represents the first fusion result. The larger the gradient (the more obvious the edges), the higher the residual fusion ratio and the more significant the detail enhancement.
[0101] The processed luminance channel is then fused with the original hue and saturation channels to restore the color image and adjust the dynamic range. The enhanced luminance channel is generated by combining the corrected illuminance component (target illuminance value) with the optimized reflectance component (i.e., the first fusion result mentioned above). :
[0102]
[0103] in, This indicates the enhanced brightness value. Normalized to [0,1], range: ,in This represents the global minimum and maximum value functions. This indicates the target brightness value.
[0104] Will Convert back to RGB color space to obtain the final enhanced image. That is, the first vehicle image. Among them, Indicates the hue value. This indicates the saturation value.
[0105] In step S204 of the above vehicle recognition method, reconstructing the first vehicle image to obtain the second vehicle image includes: performing initial convolution on the first vehicle image using the convolutional layer of a convolutional neural network to obtain a shallow feature map; performing multi-level feature compression on the shallow feature map using the lower channel branch of the convolutional neural network to obtain a first feature map sequence; fusing the feature maps in the first feature map sequence to obtain a first fused feature map; performing hierarchical channel expansion on the first fused feature map using the upper channel branch of the convolutional neural network to obtain a second feature map sequence; fusing the second feature map sequence and the shallow feature map to obtain a second fused feature map; and performing reconstruction convolution on the second fused feature map to obtain the second vehicle image.
[0106] In some embodiments of this application, the reconstruction of the first vehicle image can be achieved through an image super-resolution reconstruction module. This module is based on an improved U-Net network architecture and a multi-level information compensation mechanism to achieve image super-resolution reconstruction. The U-Net network architecture adopts a U-Net-like structure, consisting of a lower channel branch, a bottom cross-channel fusion module, and an upper channel branch. The lower channel branch uses multi-layer residual attention blocks combined with channel compression operations to perform multi-scale hierarchical extraction and channel dimension compression of the input features, generating multi-resolution feature representations from high-dimensional details to low-dimensional semantics layer by layer. The bottom cross-channel fusion module fuses the compressed features output by the lower channel branch through cross-channel convolution, capturing the semantic correlation between different channels and enhancing the integrity of feature expression and cross-modal interaction capabilities. The upper channel branch and the lower channel branch form a symmetrical structure, recovering feature dimensions layer by layer through channel recovery operations, and using a skip connection mechanism to fuse shallow detail features of the corresponding layer of the lower channel, effectively alleviating the detail blurring problem caused by insufficient semantic information during upsampling, and achieving progressive reconstruction of multi-scale features.
[0107] The multi-level information compensation mechanism addresses the loss of detail information during channel compression and restoration in U-Net by employing a bidirectional compensation strategy. During compression, before channel compression in each lower channel module, pooling is performed on the feature map to preserve spatial detail. Then, a 1×1 convolutional layer unifies the channel dimension. Finally, the compensated features from each level are concatenated along the channel dimension to the input of the bottom cross-channel fusion module. This mechanism effectively compensates for high-frequency details (such as texture and edge loss) lost during channel compression, ensuring the integrity of the underlying information. During restoration, before channel restoration in the upper channel module, the cross-channel fusion features output from the bottom cross-channel fusion module are concatenated with the compressed features of the corresponding lower channel layer via skip connections. This enhances the representation of details difficult to reconstruct during channel restoration and reduces artifacts and blurring introduced by upsampling interpolation.
[0108] Deep semantic features extracted using a U-Net-like network are fused with shallow initial features through element-wise addition, achieving multi-scale feature fusion while preserving both original pixel details and high-level semantic structure. The fused feature map is upsampled using sub-pixel convolution or transposed convolution, and then reconstructed through a convolutional layer to map the feature space into pixel values of a high-resolution image. The entire reconstruction process employs end-to-end training, using the L1 loss function as the optimization objective and the Adam optimizer for parameter updates to ensure the accuracy of feature transformation and the structural realism of the reconstructed image. This method effectively improves the texture sharpness and semantic consistency of the super-resolution reconstructed image through multi-level feature interaction and bidirectional information compensation, significantly outperforming traditional single-scale feature extraction algorithms while maintaining computational efficiency.
[0109] Specifically, the steps include the following:
[0110] Step 2.1: Construct an initial mapping from the low-resolution (LR) image to the feature space. This transformation from pixel space to feature space is achieved through lightweight convolutional layers. The specific formula is as follows:
[0111]
[0112] in, This represents the input image, specifically the image of the first vehicle. , For the dimensions of the image, The number of channels is the input. This represents the initial convolution operation, which contains D 3×3 convolution kernels, using the same padding to keep the spatial size of the feature map unchanged. This represents the output shallow feature map, where D is the initial number of channels. Basic features such as edges and textures are extracted through local receptive field scanning. Simultaneously, batch normalization and the ReLU activation function enhance the non-linearity of feature representation, thereby reducing the complexity of the original pixel data and compressing redundant pixel spatial information into a compact feature representation.
[0113] Step 2.2: Feature compression and semantic encoding are performed using the lower channel branch. Through hierarchical channel compression and multi-scale convolution, a feature pyramid is constructed from low-level details to high-level semantics. The lower channel branch consists of a cascade of K-level feature extraction units and K-1-level channel compression units. The mathematical model is as follows:
[0114]
[0115] in, It represents the first The level feature extraction unit consists of L residual attention blocks, with the number of input channels being... The output is , The channel compression unit employs deconvolution or average pooling operations with a stride of 2 to compress the number of channels to half of the input, simultaneously halving the spatial size. This represents the output features of the lower channel branch, i.e., the first feature map sequence mentioned above. The residual attention block alleviates the gradient vanishing problem in deep networks through skip connections, while dynamically adjusting the weights of each channel using the channel attention mechanism to enhance the response of key features. The channel compression operation forces the network to learn a more compact semantic representation by gradually reducing the dimensionality.
[0116] Step 2.3: The bottom cross-channel fusion module breaks down information barriers between channels and extracts cross-channel semantic relationships. Layer normalization accelerates network convergence and improves feature generalization ability by standardizing feature distribution. Cross-channel interaction is achieved through 1×1 convolution and layer normalization, as shown in the formula:
[0117]
[0118] in, This indicates the bottom merging operation, which includes a 1×1 convolution (output channels are D / 2) and layer normalization. This represents the fused features, namely the first fused feature map mentioned above.
[0119] Step 2.4: The upper channel branch is used for feature recovery and detail decoding. Through hierarchical channel recovery and skip connections, high-level semantic features are restored to high-resolution detail features. The upper channel branch is symmetrical to the lower channel branch and consists of K-level feature recovery units and K-1-level channel expansion units.
[0120]
[0121] in, This represents the channel expansion unit, which uses transposed convolution or subpixel convolution to restore the number of channels to twice the input, thus doubling the spatial size. This represents the output features of the upper channel branch, i.e., the second feature map sequence mentioned above, which is fused with the features of the corresponding layer of the lower channel through skip connections. .
[0122] In the above steps, the feature maps in the first feature map sequence are fused to obtain the first fused feature map, including: performing max pooling and compensated convolution on the feature maps of each level in the first feature map sequence to obtain the third feature map after processing at each level; and performing channel concatenation and fusion operations on the third feature maps of all levels to obtain the first fused feature map.
[0123] In the above steps, the first fused feature map is expanded hierarchically by the upper channel branch of the convolutional neural network to obtain the second feature map sequence, including: obtaining the fourth feature map of each level in the first feature map sequence; after each channel expansion of the first fused feature map, channel concatenation is performed with the fourth feature map of the corresponding level to obtain the fifth feature map of each level; and the second feature map sequence is obtained based on the fifth feature maps of all levels.
[0124] In some embodiments of this application, the following steps are also included:
[0125] Step 2.5: Utilize a multi-level information compensation mechanism for bidirectional detail preservation. Forward compensation during the compression stage is used to capture high-frequency details lost due to channel compression in the lower channel branch. Before each channel compression stage, spatial details are preserved through pooling and convolution operations. The formula is as follows:
[0126]
[0127] in, This represents max pooling, which preserves the spatial size while extracting local extrema features. For the k-th level compensated convolution, a 1×1 convolution is used to unify the number of channels. , This represents the third feature map mentioned above. This represents a channel cascading operation, merging K-level compensation features into Passage. Then through... The bottom fusion operation yields the first fused feature map.
[0128] Backward compensation during the recovery phase is used to enhance the upper channel branch's ability to represent difficult-to-reconstruct details (such as small-scale structures) and suppress interpolation artifacts. Before each recovery stage in the upper channel, the bottom fused features and the lower channel compressed features are cascaded through skip connections.
[0129]
[0130] in, This is the compressed feature of the k-th level of the lower channel, i.e., the fourth feature map mentioned above. It transmits low-level spatial details through skip connections. This represents the fifth feature map, and the number of channels after cascading is... This allows the network to learn both semantics and spatial location simultaneously.
[0131] Step 2.6: Integrate shallow details and deep semantics using multi-scale feature fusion and image reconstruction to generate a visually realistic high-resolution (HR) image. The feature fusion formula is:
[0132]
[0133] in, This represents the upsampling module, which uses subpixel convolution, has a magnification factor of S, and an output dimension of... , This represents the second fused feature map.
[0134] The pixel reconstruction formula is:
[0135]
[0136] in, This represents a reconstructed convolutional layer, containing... Each 3×3 convolutional kernel outputs an HR image. , This represents the second vehicle image. Multi-scale feature fusion is achieved through element-wise addition. Achieving complementarity between low-frequency structures and high-frequency textures.
[0137] During training, end-to-end training is used, and the loss function is as follows:
[0138]
[0139] in, This represents a real HR profile, obtained through the Adam optimizer (initial learning rate). Minimize the loss to ensure the global optimality of the feature transformation. In the loss function... The historical second vehicle image is obtained by enhancing the original historical vehicle image to obtain the historical first vehicle image. Then, the historical first vehicle image is reconstructed by the image super-resolution reconstruction module to obtain the historical second vehicle image. The historical second vehicle image is trained with real high-resolution vehicle images to ensure the accuracy of the image super-resolution reconstruction module in the inference process.
[0140] In step S206 of the above vehicle recognition method, the backbone network includes a convolutional batch normalization activation module, a cross-stage partial connection module, and a multi-branch context preservation module. The backbone network in the vehicle recognition model is used to extract features from the second vehicle image to obtain a first feature map of the second vehicle image. This includes: normalizing the pixel values in the second vehicle image to obtain a third vehicle image; performing a first-stage processing on the third vehicle image through the convolutional batch normalization activation module to obtain a first processed feature map; performing a second-stage processing on the first processed feature map through the multi-branch context preservation module and the cross-stage partial connection module to obtain a second processed feature map; performing a third-stage processing on the second processed feature map through the custom feature processing module and the cross-stage partial connection module to obtain a third processed feature map; and determining the first feature map based on the second and third processed feature maps.
[0141] In some embodiments of this application, the vehicle recognition model can be an MBCRM-YOLOv8 model, consisting of a backbone network, a neck network, and a predicted head composed of a loss function. A Multi-Branch Context Retaining Module (MBCRM) is introduced into the YOLOv8 backbone network to replace the traditional single convolutional or pooling downsampling layer. The MBCRM module achieves the following optimizations through a sequential structure of depthwise separable convolutions, Maxpooling, and 3×3 convolutions (stride = 2):
[0142] Multi-path feature complementarity: Depthwise separable convolution decomposes standard convolution into channel-wise convolution and pointwise convolution, reducing computation by 75% while preserving spatial feature details, making it particularly suitable for extracting local features from small targets. Maxpool layers expand the receptive field to capture global contextual information, mitigating the problem of missed detections of small targets due to low feature resolution. 3×3 convolutions further refine features, enhancing expressive power through non-linear transformations.
[0143] Contextual information preservation: By fusing the three outputs through feature concatenation (Concat), the detailed information lost during downsampling is supplemented, so that the backbone network can extract high-dimensional semantic features while preserving the low-dimensional spatial location information of small targets.
[0144] Neck Network: A bidirectional, multi-scale feature fusion is achieved through a Bidirectional Feature Pyramid Network (BiFPN). The original PAN-FPN is replaced by Bidirectional Feature Pyramid Network (BiFPN). Through top-bottom bidirectional information flow and dynamic weighting mechanisms, cross-layer feature interaction is optimized. The top-down path transmits high-dimensional semantic features from deep to shallow layers, enhancing the semantic understanding of small targets in shallow layers. The bottom-up path transmits low-dimensional spatial features from shallow to deep layers, improving the accuracy of target localization in deep layers. Simultaneously, learnable weights are introduced. The contribution of features at different scales is dynamically adjusted.
[0145] Prediction Head: The MBCRM-YOLOv8 model adopts the loss function framework of YOLOv8, which mainly consists of three parts: classification loss, regression loss, and weighted strategy. The classification loss uses binary cross-entropy loss (BCE Loss) to classify tasks and calculate the probability error between the predicted class and the true label. The regression loss uses CIOU loss and distributed focus loss (DFL) to optimize the regression accuracy of the bounding box and solve the problem that the traditional IOU loss does not consider the differences in distance, scale, and rotation between the predicted box and the true box. Distributed focus loss is used to model the probability distribution of the bounding box position and improve the localization accuracy of small targets.
[0146] The vehicle recognition model includes the following steps:
[0147] Step 3.1: Standardize the input image (i.e., the second vehicle image) to a format that the model can process, unify the size and normalize the pixel values to improve the stability of feature extraction. The original height is Width is Resize to a fixed size using bilinear interpolation. After that, I got The calculation formula is as follows:
[0148]
[0149] in, This represents the interpolation function.
[0150] To standardize pixel values and eliminate the influence of brightness differences, the formula is:
[0151]
[0152] in, , Output The pixel value range is normalized to [-1, 1]. This represents the image of the third vehicle.
[0153] Step 3.2: The backbone network is based on the YOLOv8 backbone, embedding the MBCRM module to replace some traditional downsampling layers, thus preserving the contextual information of small targets. The backbone network consists of a cascaded CBS module (convolution + batch normalization + SiLU activation, i.e., the aforementioned convolutional batch normalization activation module), a C2f module (cross-stage partial connection module), and the MBCRM module, outputting multi-scale feature maps. The corresponding size is .
[0154] The backbone network cascading process is as follows:
[0155] With an input size of 640×640, the backbone network generates multi-scale feature maps through four downsampling operations. The specific process is as follows:
[0156] Phase 1: The number of channels has been increased to 32, while the size has been halved. Among them, That is, the above-mentioned convolutional batch normalization activation module.
[0157] Phase 2: This is the first time that the MBCRM module has been introduced for downsampling, followed by three C2f modules for feature extraction. C2f represents the multi-branch context preservation module mentioned above, and C2f represents the cross-stage partial connection module.
[0158] Phase 3: Output the first layer feature map This is used for small target detection. This refers to the custom feature processing module mentioned above.
[0159] Phase 4: Output the second layer feature map It is used for target detection.
[0160] Phase 5: Output the feature map of layer 3 It is used for large target detection.
[0161] Specifically, stage 1 corresponds to the first stage of processing mentioned above, stage 2 corresponds to the second stage of processing mentioned above, and stages 3-5 correspond to the third stage of processing mentioned above.
[0162] In the above steps, the third vehicle image is processed in the first stage by the convolutional batch normalization activation module to obtain the first processed feature map, including: acquiring the third vehicle image, the first convolutional kernel, and the first step length; in the convolutional batch normalization activation module, the third vehicle image is subjected to convolution operation and batch normalization operation based on the first convolutional kernel and the first step length to obtain the sixth feature map; the sixth feature map is processed by an activation function to obtain the first processed feature map.
[0163] In some embodiments of this application, the formula in the CBS module is:
[0164]
[0165] in, This represents the number of channels in the input feature map. ,size In the first stage, the image is processed into a third vehicle image. , For convolution, the size of the first convolution kernel is... The first step is [length missing] BN stands for Batch Normalization. This represents the sixth feature map, where SiLU is the activation function. , The Sigmoid function. Obtained through the first processing stage. This is the first feature map to be processed.
[0166] In the above steps, the first processed feature map is processed in the second stage through a multi-branch context preservation module and a cross-stage partial connection module to obtain a second processed feature map. This includes: obtaining the first processed feature map, the second convolution kernel, and the second stride; in the multi-branch context preservation module, the first processed feature map is subjected to depthwise separable convolution, max pooling, and ordinary convolution operations based on the second convolution kernel and the second stride to obtain a first intermediate feature map, a second intermediate feature map, and a third intermediate feature map; the first intermediate feature map, the second intermediate feature map, and the third intermediate feature map are concatenated and the number of channels is reduced to obtain a fourth intermediate feature map; in the cross-stage partial connection module, the channels of the fourth intermediate feature map and the third vehicle image are concatenated to obtain the second processed feature map.
[0167] In some embodiments of this application, the multi-branch context preservation module compensates for the information loss of a single downsampling operation by concatenating depthwise separable convolution (DWConv), max pooling (MaxPool), and ordinary convolution in parallel. The formulaic description is as follows:
[0168]
[0169]
[0170] in, To extract spatial features using depthwise convolution, the second stage processes the aforementioned first intermediate feature map, calculating it channel-by-channel with a parameter count of [number missing]. . This represents the first processed feature map. These represent the size of the second convolution kernel and the second step size, respectively.
[0171] The max pooling branch is:
[0172]
[0173] It preserves strong response features and suppresses the obscuring of small targets by features of large targets. Among these, This represents the second intermediate feature map.
[0174] The ordinary convolution branch is:
[0175]
[0176] Among them, ordinary convolution A 3×3 convolution is used to extract cross-channel correlation features, with a parameter count of [number missing]. . This represents the third intermediate feature map mentioned above.
[0177] The above features are then fused:
[0178]
[0179] The three outputs are merged along the channel dimension and then concatenated to obtain... The number of channels was reduced from 3C to 1C through 1×1 convolution compression. The formula is:
[0180]
[0181] in, This represents the fourth intermediate feature map, i.e., the one in stage 2. .
[0182] The C2f module is the core module of YOLOv8, based on the CSP (CrossStage Partial) architecture, and its formula is as follows:
[0183]
[0184] in, This represents the feature map of short connection branches (preserving the original features). This represents the main branch feature map (features extracted through multiple convolutions), namely the four intermediate feature maps mentioned above. This indicates a multi-layer CBS module stack, with the number of output channels and... match, This indicates channel cascading. This represents the second processing feature map mentioned above. In the C2f module formula The features representing the third vehicle image mentioned above, in the second stage, This indicates that by stacking 3 C2f modules, for The processed features are deeply extracted and fused, outputting a 64-channel image with a size of 160×160. .
[0185] In the above steps, the second processed feature map is processed in the third stage by a custom feature processing module and a cross-stage partial connection module to obtain a third processed feature map, including: obtaining the second processed feature map, the third convolution kernel, and the third stride; in the custom feature processing module, the second processed feature map is convolved according to the third convolution kernel and the third stride to obtain a fifth intermediate feature map; in the cross-stage partial connection module, the fifth intermediate feature map and the third vehicle image are channel-concatenated to obtain the third processed feature map.
[0186] In some embodiments of this application, MDC is generally a custom feature processing module (such as a combination of multi-scale convolution, depthwise separable convolution, etc., used for downsampling and feature enhancement), and the third-stage processing can refer to the process of the second-stage processing. In the third stage, The second processing feature map of the second stage output is processed using the MDC module. Downsampling and feature transformation are performed to provide suitable input for subsequent C2f module processing; It uses a stack of 6 C2f modules to extract and fuse features from the processed MDC, outputting a 128-channel, 80×80 pixel image. To generate the first layer feature map Prepare; in Phase 4, The feature map output from stage 3 is processed using the MDC module. Downsampling and feature transformation are performed to provide adapted input for subsequent C2f module processing; in stage 5, The feature map output from stage 4 is processed using the MDC module. Downsampling and feature transformation are performed to provide suitable input for subsequent C2f module processing.
[0187] For example, in stages 3-5, a second processing feature map, a third convolution kernel, and a third stride can be obtained; in the custom feature processing module, the second processing feature map is convolved based on the third convolution kernel and the third stride to obtain a fifth intermediate feature map; in the cross-stage partial connection module, the fifth intermediate feature map and the third vehicle image are channel-concatenated to obtain a third processing feature map.
[0188] In step S206 of the above vehicle recognition method, the neck network in the vehicle recognition model is used to enhance the features of the first feature map to obtain the second feature map. This includes: obtaining the second and third processed feature maps in the first feature map, wherein the third processed feature map includes sub-feature maps under multiple detection scales; performing layer-by-layer upsampling and fusion operations on the second and third processed feature maps in a first order to obtain the sixth intermediate feature map; performing layer-by-layer downsampling on the second and third processed feature maps in a second order to obtain the seventh intermediate feature map; and determining the second feature map based on the sixth and seventh intermediate feature maps.
[0189] In some embodiments of this application, the neck network receives multi-scale feature maps input from the backbone network. These correspond to the feature maps of stages 2-5, namely the second and third processing feature maps mentioned above. The third processing feature map includes... ,in, This represents the input feature map of the k-th layer (k=2,3,4,5 corresponding to different scales), with a size of... The number of channels is .
[0190] Construct a bidirectional feature pyramid, where the top-down path (the first order mentioned above) involves the following steps: initial layer retention (Directly retaining the largest scale features); layer-by-layer upsampling and fusion, the upsampled deep features are:
[0191]
[0192] Using bilinear interpolation Upsampling to Same size, This indicates selecting the first through third elements from the shape property of a tensor or array, including, for example, width, height, and number of channels.
[0193] Then, through weighted fusion, the formula is:
[0194]
[0195] in, This represents the intermediate feature map of the k-th layer in the top-down path. , Learnable weight parameters allow for adjustment of input features. The importance of upsampling features, A minimum constant is used to avoid zero denominators. Finally, a 3×3 convolution is used to enhance the nonlinear representation, and the output feature map is generated from the top-down path.
[0196]
[0197] in, This represents the sixth intermediate feature map mentioned above. It contains both deep semantics and shallow spatial details.
[0198] The bottom-up path (the second order mentioned above) construction steps are as follows: First, the initial layer is retained. (Preserving the smallest scale top-down features), then downsampling and fusing layer by layer. For k=3, 4, 5, shallow features are downsampled. The seventh intermediate feature map is obtained, and then max pooling is used to... downsampling to Same size. Next, weighted fusion is performed:
[0199]
[0200] in, This represents the output feature map of the k-th layer in the bottom-up path. These are represented as learnable weight parameters, corresponding to the importance of top-down features, downsampled shallow features, and original input features. Similarly, the feature representation is finally optimized through 3×3 convolution to reduce aliasing, and the final output is a fused feature map. That is, the second feature map mentioned above.
[0201] During the training of the MBCRM-YOLOv8 model, the loss function consists of three parts: classification loss, regression loss, and sample matching strategy. End-to-end optimization improves multi-scale object detection accuracy. The general formula for the loss function is:
[0202]
[0203] in, This represents the classification loss, which measures the error in class prediction. This represents the regression loss, used to optimize bounding box localization accuracy. This represents the sample matching loss, balancing the weights of positive and negative samples. , This is a hyperparameter used to adjust the weights of each loss term.
[0204]
[0205] Where N is the total number of samples. Let be the true label of the i-th sample (1 for a positive sample, 0 for a negative sample). This represents the class probabilities predicted by the model.
[0206]
[0207]
[0208] Calculate the penalty item:
[0209]
[0210] Calculate the metric penalty term: Weighting coefficients: Where B represents the predicted bounding box coordinates as (x, y, w, h), Represents the true bounding box , This represents the length of the diagonal of the smallest bounding rectangle containing the two boxes. .
[0211] The formula for the distribution focus loss is:
[0212]
[0213] in, Represented as the number of positive samples, These are the actual location coordinates. , For the endpoints of the discrete interval, The joint regression loss is the interval probability predicted by the model. ,in This is the DFL loss weight (usually set to 0.5).
[0214] The training process of the MBCRM-YOLOv8 model includes: constructing training and testing sets; both training and testing sets include: a collection of known traffic vehicle scene images.
[0215] The experimental environment configuration information is shown in Table 1:
[0216] Table 1 Experimental Environment Configuration
[0217]
[0218] The model in this patent was trained using the YOLO dataset. The parameter settings required for training are shown in Table 2.
[0219] Table 2 Training Model Parameters
[0220]
[0221] The training set is input into the traffic vehicle recognition model to train the model. When the total loss function value of the model no longer decreases, the training is stopped, and a preliminary vehicle recognition model is obtained. The preliminary vehicle recognition model is tested using a test set. When the test accuracy exceeds the set threshold, the current preliminary vehicle recognition model is the trained vehicle recognition model.
[0222] Table 3 below shows a comparison of the vehicle recognition model in this application embodiment with other methods on the test set:
[0223] Table 3
[0224]
[0225] The vehicle recognition method provided in this application employs HSV spatial transformation and multi-scale Gaussian filtering in the image enhancement module to convert the image from RGB to HSV space and separate the brightness channel for illumination processing. Small-scale (15), medium-scale (80), and large-scale (250) Gaussian filters are used to separate the illumination component, and weighted fusion is performed to balance local and global illumination. This avoids color distortion, effectively separates the illumination distribution, and improves the brightness uniformity of low-light images. An adaptive gamma correction function is also used, dynamically adjusting the gamma coefficient based on the global mean of the illumination component: reducing the coefficient in dark areas to enhance brightness and increasing the coefficient in bright areas to suppress overexposure. Guided filtering is used to denoise the reflection component while preserving edges, and high-frequency details are extracted through the residual map, combined with adaptive fusion using the image average gradient. This optimizes the brightness distribution, improves image contrast, and adapts to different lighting scenarios; while denoising, edges are sharpened, balancing detail enhancement and noise suppression, thus improving image clarity.
[0226] The vehicle recognition method provided in this application utilizes an improved U-Net architecture and multi-scale feature extraction in the image super-resolution reconstruction module. It employs residual attention blocks and channel compression in the lower channel branch to generate multi-resolution features (from high-dimensional details to low-dimensional semantics). The bottom cross-channel fusion module (hereinafter referred to as the bottom module) enhances cross-modal interaction by fusing compressed features through cross-channel convolution. This captures multi-scale features and semantic correlations, alleviates the blurring problem of upsampled details, and improves the semantic consistency of the reconstructed image. Through a multi-level information compensation mechanism, the compression stage compensation involves pooling and 1×1 convolution to preserve spatial details before lower channel compression, cascading them to the bottom module. The recovery stage compensation involves cascading the bottom fused features and lower channel compressed features before upper channel recovery. This compensates for the loss of high-frequency details (texture, edges) caused by channel compression, ensuring the integrity of underlying information and enhancing the representation ability of difficult-to-reconstruct details, while reducing upsampled artifacts and blurring.
[0227] The vehicle recognition method provided in this application, in the vehicle recognition model, namely the MBCRM-YOLOv8 model, adopts a multi-branch context preservation module (MBCRM) to replace the traditional downsampling layer, and uses a serial structure of depthwise separable convolution, Maxpool, and 3×3 convolution (stride = 2) to fuse the three outputs. The depthwise separable convolution decomposes the standard convolution into channel-wise and point-wise convolution, reducing the computational cost by 75%; Maxpool expands the receptive field and captures the global context; 3×3 convolution enhances the nonlinearity of feature representation. This lightweight design is suitable for local feature extraction of small targets; it preserves the low-dimensional spatial location information of small targets, alleviates the problem of missed detection caused by low resolution, and improves detection accuracy. The original PAN-FPN is replaced by a bidirectional feature pyramid network (BiFPN), which introduces bidirectional information flow (top-down to transmit semantic features, bottom-up to transmit spatial features) and a dynamic weighting mechanism: the contribution of features at different scales is adjusted through learnable weights. It can optimize cross-layer feature interaction, obtain deep semantic enhancements from shallow layers to improve the understanding of small targets, and help deep layers obtain shallow localization information to improve accuracy. Furthermore, it can adaptively fuse multi-scale features to improve the robustness of multi-size target detection in complex scenarios.
[0228] Figure 3 This is a structural diagram of a vehicle identification device according to an embodiment of this application, such as... Figure 3 As shown, the device includes:
[0229] The acquisition module 40 is used to acquire original vehicle images in traffic roads, including vehicle images in nighttime environments.
[0230] The processing module 42 is used to perform image enhancement on the original vehicle image to obtain a first vehicle image, and to reconstruct the first vehicle image to obtain a second vehicle image;
[0231] The recognition module 44 is used to extract features from the second vehicle image using the backbone network in the vehicle recognition model to obtain a first feature map of the second vehicle image, to enhance the features of the first feature map using the neck network in the vehicle recognition model to obtain a second feature map, and to recognize the second feature map using the prediction head in the vehicle recognition model to obtain the vehicle recognition result.
[0232] By using the acquisition module, processing module, and recognition module in the aforementioned vehicle recognition device, the accuracy of vehicle image recognition at night is improved. This enhances the robustness and accuracy of vehicle recognition in intelligent transportation systems under low-light conditions, thereby solving the technical problem of low vehicle recognition accuracy in images collected at night in related technologies.
[0233] It should be noted that, Figure 3 The vehicle identification device shown is used to perform Figure 2 The vehicle identification method shown above is also applicable to this vehicle identification device, and will not be repeated here.
[0234] This application also provides an electronic device, which includes a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the above-described vehicle identification method.
[0235] This application also provides a non-volatile storage medium that includes a stored computer program, wherein the device containing the non-volatile storage medium executes the above-described vehicle identification method by running the computer program.
[0236] This application also provides a computer program product, including computer instructions that, when executed by a processor, implement the steps of the vehicle identification method in various embodiments of this application.
[0237] This application also provides a computer program that, when executed by a processor, implements the steps of the vehicle identification method in various embodiments of this application.
[0238] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0239] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0240] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0241] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0242] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0243] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0244] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A vehicle identification method characterized by, The method comprises the following steps: obtaining an original vehicle image in a traffic road, wherein the original vehicle image comprises a vehicle image in a night environment; performing image enhancement on the original vehicle image to obtain a first vehicle image, and reconstructing the first vehicle image to obtain a second vehicle image; performing feature extraction on the second vehicle image by using a backbone network in a vehicle recognition model to obtain a first feature map of the second vehicle image, performing feature enhancement on the first feature map by using a neck network in the vehicle recognition model to obtain a second feature map, and performing recognition on the second feature map by using a prediction head in the vehicle recognition model to obtain a vehicle recognition result.
2. The method of claim 1, wherein, The method for performing image enhancement on the original vehicle image to obtain a first vehicle image comprises the following steps: converting the original vehicle image from a first color space to a second color space, and extracting a luminance value, a hue value and a saturation value of a luminance channel of the original vehicle image in the second color space; determining a target illumination value corresponding to each pixel point in the original vehicle image according to the luminance value; determining a reflection value of each pixel point in the original vehicle image according to the target illumination value and the luminance value; determining an enhanced luminance value according to the reflection value and the target illumination value; performing normalization processing on the enhanced luminance value to obtain a target luminance value; converting the target luminance value, the hue value and the saturation value corresponding to each pixel point in the original vehicle image back to the first color space to obtain the first vehicle image.
3. The method of claim 2, wherein, The method for determining a target illumination value corresponding to each pixel point in the original vehicle image according to the luminance value comprises the following steps: performing convolution on the luminance value by using a Gaussian kernel to obtain an initial illumination value corresponding to each pixel point in the original vehicle image; determining a global illumination mean value according to the initial illumination value corresponding to all pixel points in the original vehicle image; determining a gamma coefficient according to the initial illumination value and the global illumination mean value; adjusting the initial illumination value according to the gamma coefficient to obtain an adjusted target illumination value.
4. The method of claim 2, wherein, The method for determining an enhanced luminance value according to the reflection value and the target illumination value comprises the following steps: performing smoothing and denoising on the reflection value by using a guided filter to obtain a filtering result; determining a residual map according to the reflection value and the filtering result; fusing the residual map and the filtering result to obtain a first fusion result; determining an enhanced luminance value according to the target illumination value and the first fusion result.
5. The method of claim 1, wherein, The method for reconstructing the first vehicle image to obtain a second vehicle image comprises the following steps: performing initial convolution on the first vehicle image by using a convolution layer of a convolutional neural network to obtain a shallow feature map; performing multi-level feature compression on the shallow feature map by using a lower channel branch of the convolutional neural network to obtain a first feature map sequence; fusing feature maps in the first feature map sequence to obtain a first fused feature map; performing hierarchical channel expansion on the first fused feature map by using an upper channel branch of the convolutional neural network to obtain a second feature map sequence; perform feature fusion on the second feature map sequence and the shallow layer feature map to obtain a second fusion feature map; perform reconstruction convolution on the second fusion feature map to obtain the second vehicle image.
6. The method of claim 5, wherein, perform fusion on the feature maps in the first feature map sequence to obtain a first fusion feature map, including: perform max pooling and compensation convolution on the feature maps of each level in the first feature map sequence to obtain a third feature map processed by each level; perform channel concatenation and fusion operations on the third feature maps of all levels to obtain the first fusion feature map.
7. The method of claim 5, wherein, perform hierarchical channel expansion on the first fusion feature map using the upper channel branch of the convolutional neural network to obtain a second feature map sequence, including: obtain a fourth feature map of each level in the first feature map sequence; after each time performing channel expansion on the first fusion feature map, perform channel concatenation with the fourth feature map of the corresponding level to obtain a fifth feature map of each level; obtain the second feature map sequence according to the fifth feature maps of all levels.
8. The method of claim 1, wherein, The backbone network includes a convolution batch normalization activation module, a cross-stage partial connection module, and a multi-branch context retention module. The backbone network in the vehicle recognition model is used to extract features of the second vehicle image to obtain a first feature map of the second vehicle image, including: normalizing pixel values in the second vehicle image to obtain a third vehicle image; performing first stage processing on the third vehicle image through the convolution batch normalization activation module to obtain a first processing feature map; performing second stage processing on the first processing feature map through the multi-branch context retention module and the cross-stage partial connection module to obtain a second processing feature map; performing third stage processing on the second processing feature map through a self-defined feature processing module and the cross-stage partial connection module to obtain a third processing feature map; determining the first feature map according to the second processing feature map and the third processing feature map.
9. The method of claim 8, wherein, performing first stage processing on the third vehicle image through the convolution batch normalization activation module to obtain a first processing feature map, including: obtaining the third vehicle image, a first convolution kernel, and a first step size; in the convolution batch normalization activation module, performing convolution operation and batch normalization operation on the third vehicle image according to the first convolution kernel and the first step size to obtain a sixth feature map; processing the sixth feature map using an activation function to obtain the first processing feature map.
10. The method of claim 8, wherein, performing second stage processing on the first processing feature map through the multi-branch context retention module and the cross-stage partial connection module to obtain a second processing feature map, including: obtaining the first processing feature map, a second convolution kernel, and a second step size; in the multi-branch context retention module, performing depth separable convolution operation, max pooling processing, and ordinary convolution operation on the first processing feature map according to the second convolution kernel and the second step size to obtain a first intermediate feature map, a second intermediate feature map, and a third intermediate feature map; The first intermediate feature map, the second intermediate feature map and the third intermediate feature map are subjected to a splicing operation and a channel number reduction processing to obtain a fourth intermediate feature map; In the cross-stage partial connection module, the fourth intermediate feature map and the third vehicle image are subjected to channel concatenation to obtain the second processing feature map.
11. The method of claim 8, wherein, The second processing feature map is subjected to third stage processing by the self-defined feature processing module and the cross-stage partial connection module to obtain a third processing feature map, including: The second processing feature map, a third convolution kernel and a third step length are obtained; In the self-defined feature processing module, the second processing feature map is subjected to convolution operation according to the third convolution kernel and the third step length to obtain a fifth intermediate feature map; In the cross-stage partial connection module, the fifth intermediate feature map and the third vehicle image are subjected to channel concatenation to obtain the third processing feature map.
12. The method of claim 8, wherein, The first feature map is subjected to feature enhancement by a neck network in the vehicle recognition model to obtain a second feature map, including: The second processing feature map and a third processing feature map in the first feature map are obtained, wherein the third processing feature map includes sub-feature maps at multiple detection scales; The second processing feature map and the third processing feature map are subjected to layer-by-layer upsampling and fusion operation in a first order to obtain a sixth intermediate feature map; The second processing feature map and the third processing feature map are subjected to layer-by-layer downsampling in a second order to obtain a seventh intermediate feature map; The second feature map is determined according to the sixth intermediate feature map and the seventh intermediate feature map.
13. A vehicle identification apparatus characterized by comprising: including: An acquisition module is configured to acquire an original vehicle image in a traffic road, wherein the original vehicle image includes a vehicle image in a night environment; A processing module is configured to perform image enhancement on the original vehicle image to obtain a first vehicle image, and perform reconstruction on the first vehicle image to obtain a second vehicle image; An identification module is configured to perform feature extraction on the second vehicle image by a backbone network in a vehicle recognition model to obtain a first feature map of the second vehicle image, perform feature enhancement on the first feature map by a neck network in the vehicle recognition model to obtain a second feature map, and perform identification on the second feature map by a prediction head in the vehicle recognition model to obtain a vehicle recognition result.
14. An electronic device, comprising: including: A memory and a processor, wherein the memory is configured to store program instructions; the processor is connected with the memory and is configured to execute the vehicle identification method in any one of claims 1 to 12.
15. A non-volatile storage medium, comprising: The non-volatile storage medium includes a stored computer program, wherein a device in which the non-volatile storage medium is located executes the vehicle identification method in any one of claims 1 to 12 by running the computer program.
16. A computer program product comprising computer instructions, characterized in that, The computer instructions are executed by the processor to implement the vehicle identification method in any one of claims 1 to 12.