Lightweight double-dynamic vehicle detection and classification method and system in complex road environment
By introducing dynamic cross-stage local networks and multi-scale adaptive feature fusion devices into the vehicle detection algorithm, the problem of insufficient accuracy and real-time performance of vehicle detection in complex environments in the prior art is solved, and the vehicle detection effect is achieved with lightweight, efficient and high-precision.
Patent Information
- Application Number
- CN202411559226.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-03-07
AI Technical Summary
Existing deep learning-based vehicle detection algorithms are difficult to achieve fast and accurate identification in complex road environments, especially when resource constraints are limited, the number of parameters and calculations of the model are too large, making it difficult to meet the needs of real-time detection.
A lightweight dual dynamic vehicle detection classification method for complex road environments is proposed. Dynamic cross-stage local network and multi-scale adaptive feature fusion device are used to preprocess and data enhancement through the image acquisition module, target data set is constructed, vehicle detection classification model is trained, and the model is lightweight and efficiently detected.
While keeping the model lightweight, it significantly improves detection accuracy and robustness, and can quickly and accurately identify vehicle subjects under resource constraints, meeting the multi-scale vehicle detection needs in complex road contexts.
Smart Images

Figure CN119579953A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection and tracking, and in particular to a lightweight dual-dynamic vehicle detection and classification method and system in a complex road environment. Background Art
[0002] With the rapid development of deep learning technology, target detection has broken through the limitations of traditional classification algorithms, especially customized algorithms for specific scenarios to meet actual needs have become a hot spot for current technology improvements. As a key tool for transportation, it is crucial to quickly and accurately detect the type of vehicle and its specific location, which directly affects the vehicle's rapid response and avoidance capabilities, thereby helping to reduce road traffic accidents. With the increasing volume of traffic, the pressure to ensure driving safety has also increased. The continued development of deep learning has provided us with powerful tools to process video and image data more efficiently, greatly promoting the development and progress of the field of vehicle detection.
[0003] At present, the target detection methods based on deep learning are mainly divided into two-stage and one-stage methods. In the two-stage method, the process first generates candidate areas, and then classifies and locates these areas. The R-CNN network is a representative type of two-stage network. This type of algorithm has high detection accuracy, but the parameter scale of the algorithm is large, and the detection speed is not enough to meet the real-time requirements. In contrast, the one-stage method mainly uses regression algorithms to directly generate the class probability and position coordinate values of the target. The SSD algorithm and RetinaNet network are representatives of the one-stage network. Since this type of algorithm has a fast detection speed, it is of great significance for the real-time application of vehicle detection algorithms.
[0004] The complexity of the road environment, including changing weather conditions, different lighting conditions, and other environmental factors, significantly increases the difficulty of real-time vehicle detection tasks, making it more difficult to accurately identify vehicles from complex backgrounds. Although high-performance models can provide better detection results, this often comes at the cost of increased computational complexity and parameter size, resulting in these models requiring a large amount of computing resources and being difficult to meet the requirements of real-time processing, low power consumption, and deployment on embedded devices. Therefore, relying on manual or existing vehicle detection methods, it is impossible to quickly and accurately identify various types of vehicles in a resource-limited environment.
[0005] In summary, the research on lightweight vehicle detection algorithms based on deep learning is still a challenging topic. Facing the multi-scale vehicle detection problem in complex road environments and the interference of background factors in the environment, the problem of inaccurate vehicle identification will occur during vehicle detection. Therefore, how to achieve fast and accurate detection while keeping the model lightweight has become an urgent problem to be solved in current vehicle detection algorithms. The research on this topic has great practical significance. Summary of the invention
[0006] In view of the above problems, the purpose of the present invention is to provide a lightweight dual-dynamic vehicle detection and classification method and system for complex road environments, which is used to quickly and accurately identify the vehicle body under resource-constrained conditions. Compared with the previously proposed algorithm, the algorithm significantly suppresses environmental factors while maintaining the lightweight model, and has significantly improved the precision of precise measurement of multi-scale target vehicles. The above invention objectives of the present invention are achieved through the following technical solutions: The present invention provides a lightweight dual-dynamic vehicle detection and classification method in a complex road environment, comprising: Step S1: preprocessing vehicle images under different scene conditions through an image acquisition module and constructing a target data set for training a vehicle detection classification model; Step S2: Based on the trained vehicle detection classification model, a new vehicle image is input into the vehicle detection classification model for analysis to automatically output the category and location information of the vehicle; Among them, the vehicle detection and classification model includes a backbone feature extractor, a multi-scale adaptive feature fusion device and a classification locator; the backbone feature extractor contains a dynamic cross-stage local network module to extract multiple feature layer information from the vehicle image; the multi-scale adaptive feature fusion device contains a lightweight pyramid segmentation attention module, which extracts and fuses multiple feature map information and automatically outputs the vehicle category and location information through the classification locator.
[0007] Further, in step S1, the scene conditions include time, weather, vehicle type and background.
[0008] Further, in step S2, based on the trained vehicle detection classification model, it includes: Continuously train the vehicle detection classification model through the target data set until the evaluation parameter index of the vehicle detection classification model reaches a preset standard range; The evaluation parameter indicators include precision P, recall R, average precision AP and mean average precision mAP; the specific calculation formula is: ; ; ; ; Among them, TP is the number of vehicle images that are correctly identified, FP is the number of non-vehicle images that are misidentified as vehicle images, and FN is the number of vehicle images that are not identified.
[0009] Furthermore, the vehicle images under different scene conditions are preprocessed through the image acquisition module and a target data set is constructed, including: Standardize multiple vehicle images and label them; Aggregate the standardized and labeled vehicle images to form a primary target dataset; The Mixup data enhancement algorithm is used to randomly select two vehicle images, and the two vehicle images and their corresponding labels are mixed by linear interpolation to generate the corresponding mixed image and the corresponding mixed label; The generated mixed images and corresponding mixed labels are added to the primary target dataset to form the target dataset.
[0010] Furthermore, the Mixup data enhancement algorithm is used to randomly select two vehicle images, and the two vehicle images and their corresponding labels are mixed by linear difference to generate a corresponding mixed image and a corresponding mixed label, including: The formula for generating the mixed image is: ; The formula for mixed label generation is: ; in, For mixed images, is a mixed label; x1 and x2 are two randomly selected vehicle images; λ is a coefficient randomly selected from the Beta distribution; y1 and y2 are the labels corresponding to x1 and x2.
[0011] Furthermore, the backbone feature extractor includes a dynamic cross-stage local network module to extract multiple feature layer information from the vehicle image, including: The input vehicle image is processed through the initial convolutional layer to extract the primary feature layer information; The primary feature layer information is processed by the deep convolution layer to extract the deep feature layer information; In the dynamic cross-stage local network module, the deep feature layer information is divided into two branches for processing; the first branch is processed through a dynamic bottleneck structure to extract the semantic features of the vehicle and retain the details of the deep feature layer; the second branch performs channel transformation through conventional convolution to obtain the corresponding feature information; the feature information output by the first branch and the second branch is concat spliced to obtain the fused feature layer information, and the feature layer information of different sizes is captured through pyramid pooling operation.
[0012] Furthermore, the multi-scale adaptive feature fuser includes a lightweight pyramid segmentation attention module to extract and fuse multiple feature map information, including: The input feature map information is divided into S groups, denoted as , where S is a natural number greater than 1; Each set of feature map information is processed using convolution kernels of different sizes, and the formula is expressed as ;in, is the convolution kernel size, is the number of groups; The feature map information after convolution is recalibrated through the SE attention module. The calculation formula is: ; The recalibrated feature map information is spliced together to form the output feature map, and the calculation formula is: , the output feature map is used to determine the category and positioning information of the vehicle in the vehicle image.
[0013] Based on the same inventive concept, the present invention provides a lightweight dual-dynamic vehicle detection and classification system for a complex road environment, which adopts the lightweight dual-dynamic vehicle detection and classification method as described above, including: Image acquisition module: used to standardize multiple vehicle images and label them; summarize the standardized and labeled vehicle images to form a primary target data set; use the Mixup data enhancement algorithm to randomly select two vehicle images, and mix the two vehicle images and their corresponding labels by linear difference to generate corresponding mixed images and corresponding mixed labels; add the generated mixed images and corresponding mixed labels to the primary target data set to form the target data set.
[0014] The vehicle detection and classification module is used to receive new vehicle images for analysis to automatically output the category and location information of the vehicle; wherein the vehicle detection and classification model includes a backbone feature extractor, a multi-scale adaptive feature fusion device and a classification locator; the backbone feature extractor includes a dynamic cross-stage local network module to extract multiple feature layer information from the vehicle image; the multi-scale adaptive feature fusion device includes a lightweight pyramid segmentation attention module to extract and fuse multiple feature map information and automatically output the category and location information of the vehicle through the classification locator; Model training module: used to train the vehicle detection classification model through the target data set constructed by the image acquisition module until the evaluation parameter indicators of the vehicle detection classification model reach the preset standard range; among which, the evaluation parameter indicators include precision P, recall rate R, average precision AP and mean average precision mAP.
[0015] Furthermore, the backbone feature extractor is used to process the input vehicle image through the initial convolution layer to extract the primary feature layer information; the primary feature layer information is processed by the deep convolution layer to extract the deep feature layer information; in the dynamic cross-stage local network module, the deep feature layer information is divided into two branches for processing; wherein, the first branch is processed through a dynamic bottleneck structure to extract the semantic features of the vehicle and retain the details of the deep feature layer; the second branch performs channel transformation through conventional convolution to obtain the corresponding feature information; the feature information output by the first branch and the second branch is concat spliced to obtain the fused feature layer information, and the feature layer information of different sizes is captured through pyramid pooling operation.
[0016] Furthermore, the multi-scale adaptive feature fuser is used to divide the input feature map information into S groups, denoted as , S is a natural number greater than 1; each set of feature map information is processed by convolution of different sizes, and the formula is ;in, is the convolution kernel size, is the number of groups; the convolution feature map information is recalibrated through the SE attention module, the formula is, ; The recalibrated feature map information is spliced together to form the output feature map, and the calculation formula is , the output feature map is used to determine the category and positioning information of the vehicle in the vehicle image.
[0017] Compared with the prior art, the present invention has at least one of the following beneficial effects: (1) Compared with the existing advanced deep learning vehicle detection algorithms, this invention has smaller parameters and computational complexity, and has higher detection accuracy, which can meet the problem of lightweight vehicle detection under complex road backgrounds. While achieving lightweight models, it effectively reduces the interference of environmental variation factors, and significantly improves the precise measurement accuracy of multi-scale vehicle targets, and can quickly and accurately identify vehicle entities under resource-constrained conditions.
[0018] (2) The present invention significantly improves the interference handling capability, feature extraction efficiency and accuracy, and network robustness in complex environments by integrating data enhancement technology, dynamic cross-stage local networks, and multi-scale adaptive feature fusion modules. At the same time, it promotes the improvement of overall performance and detection accuracy. Moreover, compared with other advanced detection algorithms on the same data set, the present invention has higher advantages in detection accuracy and parameter quantity, and has a significant improvement in multi-scale vehicle detection under complex road backgrounds. (3) The present invention reduces the number of model parameters and computing requirements by optimizing the model structure. This not only reduces the reliance on computing resources, but also ensures higher detection accuracy while maintaining lower resource consumption, making the system more suitable for running on resource-constrained devices. The detection speed of the improved model meets the requirements of real-time detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A flowchart of the steps of the lightweight dual-dynamic vehicle detection and classification method for complex road environments of the present invention Figure 2 A structural diagram of a deep network model of a lightweight dual-dynamic vehicle detection and classification method for a complex road environment of the present invention; Figure 3 A flow chart of a Mixup data enhancement algorithm for a lightweight dual-dynamic vehicle detection and classification method in a complex road environment of the present invention; Figure 4 A structural diagram of a dynamic cross-stage local network module D-CSP of a lightweight dual-dynamic vehicle detection and classification method for complex road environments of the present invention; Figure 5 A structural diagram of a multi-scale adaptive feature fusion module MAFF of a lightweight dual-dynamic vehicle detection and classification method for a complex road environment of the present invention; Figure 6 It is a schematic diagram of the lightweight dual-dynamic vehicle detection and classification method in a complex road environment of the present invention; Figure 7 Result comparison table of different lightweight detection algorithms in the embodiments of the present invention. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0021] Those skilled in the art will appreciate that, unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0022] First embodiment Currently, deep learning-based methods have become mainstream in the field of vehicle detection. Most of these methods use two-stage detection frameworks such as R-CNN and its variants or one-stage detection frameworks such as SSD and YOLO. Although these models perform well in processing complex image and video data and can effectively identify vehicles and their locations, they usually have problems with high computing resource requirements and slow processing speed, especially in application scenarios that require real-time response.
[0023] Although existing vehicle detection algorithms perform well in terms of accuracy, they face serious resource limitation challenges when deployed in practical applications, especially on embedded systems or low-power devices. High-precision models are often accompanied by high parameter counts and computational complexity, which limits their application in real-time or resource-limited environments. In addition, detection algorithms in complex environments such as unstable lighting and weather conditions need to be improved.
[0024] Taking the above problems into consideration, the present invention proposes a lightweight and efficient vehicle detection method, especially how to reduce the number of model parameters and computational complexity while maintaining high detection accuracy, and how to improve the robustness of the model in a changing environment. Therefore, the present invention combines the deep learning architecture of CSPDarknet53, which includes a dynamic cross-stage local network, and the multi-scale adaptive feature fusion module MAFF. By dynamically adjusting the convolutional layer parameters in the network structure, the computational efficiency and resource consumption of the network are optimized. At the same time, the introduction of pyramid pooling and multi-scale feature fusion technology enhances the model's ability to detect vehicles of different sizes and in complex backgrounds. The embodiments of the present invention are as follows: like Figure 1 , 2 As shown in 6, the present invention provides a lightweight dual-dynamic vehicle detection and classification method in a complex road environment, including: Step S1: preprocessing vehicle images under different scene conditions through an image acquisition module and constructing a target data set for training a vehicle detection classification model; Step S2: Based on the trained vehicle detection classification model, a new vehicle image is input into the vehicle detection classification model for analysis to automatically output the category and location information of the vehicle; Among them, the vehicle detection and classification model includes a backbone feature extractor, a multi-scale adaptive feature fusion device and a classification locator; the backbone feature extractor contains a dynamic cross-stage local network module to extract multiple feature layer information from the vehicle image; the multi-scale adaptive feature fusion device contains a lightweight pyramid segmentation attention module, which extracts and fuses multiple feature map information while suppressing the interference of environmental factors and automatically outputs the vehicle category and location information through the classification locator.
[0025] Further, in step S1, the scene conditions include time, weather, vehicle type and background. Specifically, in order to improve the adaptability of the model to different actual conditions, the data set is designed to include multiple scene conditions, covering different weather such as sunny, rainy and foggy days, different times such as day and night, multiple vehicle types such as cars, trucks, buses, etc., a total of nine types, and background environments of different complexity, ranging from simple backgrounds to complex urban and highway landscapes. Different scene conditions help the model maintain efficient and accurate detection performance under various external conditions and the ability to adapt to different detection environments.
[0026] Further, in step S2, based on the trained vehicle detection classification model, it includes: Continuously train the vehicle detection classification model through the target data set until the evaluation parameter index of the vehicle detection classification model reaches a preset standard range; The evaluation parameter indicators include precision P, recall R, average precision AP and mean average precision mAP; the specific calculation formula is: ; ; ; ; Among them, TP is the number of vehicle images that are correctly identified, FP is the number of non-vehicle images that are misidentified as vehicle images, and FN is the number of vehicle images that are not identified.
[0027] Specifically, TP refers to the object that was originally a positive sample and was recognized as a positive sample by the network, FP refers to the object that was originally a negative example and was recognized as a positive sample by the network, and FN refers to the object that was originally a positive sample and was recognized as a negative sample by the network. Therefore, TP+FP is the number of all vehicles detected, and TP+FN represents the actual total number of vehicles. The implementation mainly adopts the following evaluation indicators to analyze the experimental results: F1 value, average precision mAP, computational amount GFLOPs, parameter amount Params, and frames per second FPS.
[0028] It should be explained that the F1 value is a statistical indicator used to measure the accuracy of the model, especially when the data categories are unbalanced. It is the harmonic mean of precision and recall. Average precision mAP calculates the average precision of each category at different recall rates, and then takes the average of all categories to measure the overall performance of the model. The amount of calculation GFLOPs is used to evaluate the complexity and computing requirements of the model. The amount of parameters Params is used to measure the scale and storage requirements of the model. The number of frames per second FPS is used for the number of frames per second FPS.
[0029] Furthermore, if Figure 3 As shown, the vehicle images under different scene conditions are preprocessed through the image acquisition module and the target data set is constructed, including: Standardize multiple vehicle images and label them; Aggregate the standardized and labeled vehicle images to form a primary target dataset; The Mixup data enhancement algorithm is used to randomly select two vehicle images, and the two vehicle images and their corresponding labels are mixed by linear interpolation to generate the corresponding mixed image and the corresponding mixed label; The generated mixed images and corresponding mixed labels are added to the primary target dataset to form the target dataset.
[0030] Furthermore, the Mixup data enhancement algorithm is used to randomly select two vehicle images, and the two vehicle images and their corresponding labels are mixed by linear difference to generate corresponding mixed images and corresponding mixed labels, including: The formula for generating the mixed image is: ; The formula for mixed label generation is: ; in, For mixed images, is a mixed label; x1 and x2 are two randomly selected vehicle images; λ is a coefficient randomly selected from the Beta distribution; y1 and y2 are the labels corresponding to x1 and x2.
[0031] Specifically, the data enhancement methods used in the present invention include Mosaic data enhancement, random rotation, affine transformation and other methods. However, in the vehicle detection task, a small number of vehicle categories in the data set will cause the model to be biased towards vehicles with a larger number of categories, and a smaller number of vehicle categories are easily submerged in complex environments, resulting in insufficient generalization of the model. Vehicle data collection in actual scenarios is more difficult and has high requirements for shooting. Therefore, the present invention uses a mixup data enhancement algorithm to achieve data expansion by linearly interpolating the images and labels of two samples. For two randomly selected image samples x1 and x2, y1 and y2 represent two corresponding generated image samples. The image input module performs data enhancement operations through linear interpolation of images and linear interpolation of labels. λ obeys the Beta distribution, and the obtained mixed image is expressed as , the mixed label can be expressed as The final mixed image combines the overall features of the two original images, enriches the feature distribution of the data set, and enables the model to obtain more feature information during training, making the model more robust and having better detection performance in complex environments. Feature transformation is performed during training to alleviate the imbalance problem between vehicle categories and enhance the robustness and generalization of the model.
[0032] Furthermore, the backbone feature extractor includes a dynamic cross-stage local network module to extract multiple feature layer information from the vehicle image, including: The input vehicle image is processed through the initial convolutional layer to extract the primary feature layer information; The primary feature layer information is processed by the deep convolution layer to extract the deep feature layer information; In the dynamic cross-stage local network module, the deep feature layer information is divided into two branches for processing; the first branch is processed through a dynamic bottleneck structure to extract the semantic features of the vehicle and retain the details of the deep feature layer; the second branch performs channel transformation through conventional convolution to obtain the corresponding feature information; the feature information output by the first branch and the second branch is concat spliced to obtain the fused feature layer information, and the feature layer information of different sizes is captured through pyramid pooling operation.
[0033] Specifically, if Figure 4 As shown, the backbone feature extraction module network is CSPDarknet53 embedded with a dynamic cross-connected local module network. The dynamic cross-stage local network module includes a dynamic bottleneck structure and three convolution parts. The input feature map is divided into two branches after the dynamic cross-stage local network, one of which is dynamically processed by the dynamic bottleneck structure, and the other branch is transformed by ordinary convolution. Finally, the feature maps output by the two branches are concat together to obtain the final output.
[0034] As attached Figure 3As shown, the feature extraction network of the present invention adopts the network of CSPDarknet53 integrated into the dynamic cross-stage local network. After the input network feature information is extracted by the backbone network, three feature layer information of different sizes will be generated, and the multi-scale feature fusion part will be performed after the pyramid pooling structure. The pyramid pooling module can aggregate the contextual information of different regions to improve the network's ability to obtain global information. The specific method is to obtain feature map information of different sizes through pooling operations of different scales, and splice them at the channel level. The dynamic cross-stage local network adaptively extracts vehicle features according to the image input at the bottom of the backbone network. The dynamic cross-stage local network module includes a residual dynamic bottleneck module and three convolution parts. The input feature map is cleverly divided into two branches, one of which is processed by the dynamic bottleneck structure to extract the feature information of the vehicle. The dynamic bottleneck structure is a residual structure that integrates two dynamic convolutions, which can well retain the image detail information while extracting the semantic information of the vehicle, and dynamically adjust the contribution of the features in each feature map. The other branch undergoes ordinary convolution, and finally the feature maps output by the two branches are concat spliced on the channel to obtain the final output. Given an input feature x, the dynamic cross-connected local network can be expressed as: .
[0035] Two dynamic convolution decomposition operations are used in the RDB structure, which can adaptively adjust the convolution parameters according to the characteristics of the input image, decompose the standard convolution weights into dynamic and static parts, and generate dynamic channel attention and dynamic channel fusion parts through average pooling and full connection layer operations. The convolution kernel can be expressed by the formula: , is the dynamic channel attention, is a static core, is the dynamic fusion coefficient, and P and Q are two static matrix parts. The dynamic bottleneck structure that integrates the dynamic convolution decomposition can effectively focus on the most relevant channel information in the input feature map and avoid interference from irrelevant information.
[0036] Furthermore, the multi-scale adaptive feature fuser includes a lightweight pyramid segmentation attention module to extract and fuse multiple feature map information, including: The input feature map information is divided into S groups, denoted as , where S is a natural number greater than 1; Each set of feature map information is processed using convolution kernels of different sizes, and the formula is expressed as ;in, is the convolution kernel size, is the number of groups; The feature map information after convolution is recalibrated through the SE attention module. The calculation formula is: ; The recalibrated feature map information is spliced together to form the output feature map, and the calculation formula is: , the output feature map is used to determine the category and positioning information of the vehicle in the vehicle image.
[0037] Specifically, if Figure 5 As shown in the figure, the multi-scale adaptive feature fusion module MAFF performs convolution calculations on the feature map with different receptive fields, and then establishes long-distance connections at the channel level to capture multi-scale information, while reducing the complexity of the model and ensuring the lightweight characteristics of the model. The multi-layer feature fusion module fuses the information of the four scale feature layers. The number of channel groupings of the input feature map is S, and the feature map is divided into For each group feature map, different groups use convolution kernels with different receptive fields, such as 3*3, 5*5, and 7*7 convolution kernels. , K represents the size of the convolution kernel. After calculating different convolution kernels, we get receptive fields of different sizes, and the output feature map is Then, these feature maps are processed by SE attention and Softmax operation to obtain the calibrated channel attention weights. Multiply them with the corresponding feature maps to obtain the final , after the obtained feature map is subjected to the Concat operation, the output feature map obtained by the multi-scale adaptive feature fusion module can be obtained by express.
[0038] How to perform positioning and position information is a common method used by technicians in this field, so we will not go into details here, such as extracting details and semantic information about the vehicle from the fused feature map, and evaluating the classification confidence and position confidence of each detected vehicle. The classification confidence reflects the degree of confidence of the model in judging the vehicle type, while the position confidence indicates the accuracy of the model's prediction of the vehicle location, i.e., the bounding box. Combined with the confidence, the system outputs the final vehicle type and location information. A higher confidence means that the model is very confident in its predicted vehicle category and location, which helps to ensure the reliability and accuracy of the detection results.
[0039] The present invention is based on the pytorch1.7.1 framework and uses python3.8.1 for programming calculations. The experiments are conducted on the GPU of NVIDIA RTX3090 with 24GB video memory. In training, we used the stochastic gradient descent method to optimize the model. The input size of the image is set to 640*640, and the b size is set to 32. The initial learning rate of the experiment is 0.01, the momentum decay is set to 0.0005, and the initial momentum is set to 0.937. The total training cycle is 100 rounds until the end of the training cycle.
[0040] Figure 7 The experimental results obtained by the method of the present invention are compared with the existing advanced methods. The evaluation indicators include F1 value, average accuracy, frames per second, parameter quantity and calculation amount, etc. The specific formula has been proposed in the previous text. From the results in the table, it can be observed that the present invention has good detection performance while keeping the model lightweight. At the same time, FPS also maintains a high level.
[0041] Second embodiment Based on the same inventive concept, the present invention provides a lightweight dual-dynamic vehicle detection and classification system for a complex road environment, which adopts the lightweight dual-dynamic vehicle detection and classification method as described above, including: Image acquisition module: used to standardize multiple vehicle images and label them; summarize the standardized and labeled vehicle images to form a primary target data set; use the Mixup data enhancement algorithm to randomly select two vehicle images, and mix the two vehicle images and their corresponding labels by linear difference to generate corresponding mixed images and corresponding mixed labels; add the generated mixed images and corresponding mixed labels to the primary target data set to form the target data set.
[0042] The vehicle detection and classification module is used to receive new vehicle images for analysis to automatically output the category and location information of the vehicle; wherein the vehicle detection and classification model includes a backbone feature extractor, a multi-scale adaptive feature fusion device and a classification locator; the backbone feature extractor includes a dynamic cross-stage local network module to extract multiple feature layer information from the vehicle image; the multi-scale adaptive feature fusion device includes a lightweight pyramid segmentation attention module to extract and fuse multiple feature map information and automatically output the category and location information of the vehicle through the classification locator; Model training module: used to train the vehicle detection classification model through the target data set constructed by the image acquisition module until the evaluation parameter indicators of the vehicle detection classification model reach the preset standard range; among which, the evaluation parameter indicators include precision P, recall rate R, average precision AP and mean average precision mAP.
[0043] Furthermore, the backbone feature extractor is used to process the input vehicle image through the initial convolution layer to extract the primary feature layer information; the primary feature layer information is processed by the deep convolution layer to extract the deep feature layer information; in the dynamic cross-stage local network module, the deep feature layer information is divided into two branches for processing; wherein, the first branch is processed through a dynamic bottleneck structure to extract the semantic features of the vehicle and retain the details of the deep feature layer; the second branch performs channel transformation through conventional convolution to obtain the corresponding feature information; the feature information output by the first branch and the second branch is concat spliced to obtain the fused feature layer information, and the feature layer information of different sizes is captured through pyramid pooling operation.
[0044] Furthermore, the multi-scale adaptive feature fuser is used to divide the input feature map information into S groups, denoted as , S is a natural number greater than 1; each set of feature map information is processed by convolution of different sizes, and the formula is ;in, is the convolution kernel size, is the number of groups; the convolution feature map information is recalibrated through the SE attention module, the formula is, ; The recalibrated feature map information is spliced together to form the output feature map, and the calculation formula is , the output feature map is used to determine the category and positioning information of the vehicle in the vehicle image.
[0045] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
[0046] It should be noted that the above embodiments can be freely combined as needed. The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered as the protection scope of the present invention.
Claims
1. A lightweight dual-dynamic vehicle detection and classification method for complex road environments, characterized in that: include; Step S1, preprocessing the vehicle images under different scene conditions through an image acquisition module and constructing a target data set for training a vehicle detection classification model; Step S2: Based on the trained vehicle detection classification model, the new vehicle image is input into the vehicle detection classification model for analysis to automatically output the category and location information of the vehicle; Among them, the vehicle detection classification model includes a backbone feature extractor, a multi-scale adaptive feature fusion device and a classification locator; the backbone feature extractor includes a dynamic cross-stage local network module to extract multiple feature layer information from the vehicle image; the multi-scale adaptive feature fusion device includes a lightweight pyramid segmentation attention module, which extracts and fuses multiple feature map information and automatically outputs the category and location information of the vehicle through the classification locator.
2. The lightweight dual-dynamic vehicle detection and classification method according to claim 1 is characterized in that: In step S1 , the scene conditions include time, weather, vehicle type and background.
3. The lightweight dual-dynamic vehicle detection and classification method according to claim 1 is characterized in that: In step S2, based on the trained vehicle detection classification model, further comprising: Continuously training the vehicle detection classification model using the target data set until an evaluation parameter index of the vehicle detection classification model reaches a preset standard range; The evaluation parameter indicators include precision P, recall R, average precision AP and mean average precision mAP; the specific calculation formula is: ; ; ; ; Wherein, TP is the number of vehicle images that are correctly identified, FP is the number of non-vehicle images that are mistakenly identified as vehicle images, and FN is the number of vehicle images that are not identified.
4. The lightweight dual-dynamic vehicle detection and classification method according to claim 1 is characterized in that: Preprocessing the vehicle images under different scene conditions through an image acquisition module and constructing a target data set further includes: Standardizing the plurality of vehicle images and labeling them; Aggregating the vehicle images that have undergone the standardization processing and the label annotation to form a primary target data set; The Mixup data enhancement algorithm is used to randomly select two vehicle images, and the two vehicle images and their corresponding labels are mixed by linear difference to generate a corresponding mixed image and a corresponding mixed label; The generated mixed image and the corresponding mixed label are added to the primary target data set to form the target data set.
5. The lightweight dual-dynamic vehicle detection and classification method according to claim 4 is characterized in that: The Mixup data enhancement algorithm is used to randomly select two vehicle images, and the two vehicle images and their corresponding labels are mixed by linear difference to generate a corresponding mixed image and a corresponding mixed label, further comprising: The formula for generating the mixed image is: ; The formula for generating the mixed label is: ; in, is the mixed image, is the mixed label; x1 and x2 are two randomly selected vehicle images; λ is a coefficient randomly selected from Beta distribution; y1 and y2 are the labels corresponding to x1 and x2.
6. The lightweight dual-dynamic vehicle detection and classification method according to claim 1 is characterized in that: The backbone feature extractor includes a dynamic cross-stage local network module to extract multiple feature layer information from the vehicle image, further comprising: The input vehicle image is processed through an initial convolutional layer to extract primary feature layer information; The primary feature layer information is processed by a deep convolution layer to extract deep feature layer information; In the dynamic cross-stage local network module, the deep feature layer information is divided into two branches for processing; wherein, the first branch is processed through a dynamic bottleneck structure to extract the semantic features of the vehicle and retain the details of the deep feature layer; the second branch performs channel transformation through conventional convolution to obtain corresponding feature information; the feature information output by the first branch and the second branch is concat spliced to obtain the fused feature layer information, and the feature layer information of different sizes is captured through a pyramid pooling operation.
7. The lightweight dual-dynamic vehicle detection and classification method according to claim 6 is characterized in that: The multi-scale adaptive feature fuser includes a lightweight pyramid segmentation attention module, extracts and fuses multiple feature map information, and further includes: The input feature map information is divided into S groups, denoted as , where S is a natural number greater than 1; Each set of feature map information is processed using convolution kernels of different sizes, and the formula is expressed as ; Among them, the is the convolution kernel size, is the number of groups; The feature map information after convolution is recalibrated through the SE attention module, and the calculation formula is: ; The recalibrated feature map information is spliced together to form an output feature map, and the calculation formula is: , the output feature map is used to determine the category and positioning information of the vehicle in the vehicle image.
8. A lightweight dual-dynamic vehicle detection and classification system for complex road environments, using the lightweight dual-dynamic vehicle detection and classification method as described in any one of claims 1 to 7, characterized in that: include: Image acquisition module: used to perform standardization processing on multiple vehicle images and label them; summarize the vehicle images that have undergone the standardization processing and the labeling to form a primary target data set; use the Mixup data enhancement algorithm to randomly select two of the vehicle images, and mix the two vehicle images and their corresponding labels in a linear difference manner to generate a corresponding mixed image and a corresponding mixed label; add the generated mixed image and the corresponding mixed label to the primary target data set to form a target data set; A vehicle detection and classification module is used to receive a new vehicle image for analysis to automatically output the category and location information of the vehicle; wherein the vehicle detection and classification model includes a backbone feature extractor, a multi-scale adaptive feature fusion device and a classification locator; the backbone feature extractor includes a dynamic cross-stage local network module to extract multiple feature layer information from the vehicle image; the multi-scale adaptive feature fusion device includes a lightweight pyramid segmentation attention module to extract and fuse multiple feature map information and automatically output the category and location information of the vehicle through the classification locator; Model training module: used to train the vehicle detection classification model through the target data set constructed by the image acquisition module until the evaluation parameter indicators of the vehicle detection classification model reach the preset standard range; wherein the evaluation parameter indicators include precision P, recall rate R, average precision AP and mean average precision mAP.
9. The lightweight dual-dynamic vehicle detection and classification system according to claim 8, characterized in that: The backbone feature extractor is used to process the input vehicle image through an initial convolution layer to extract primary feature layer information; the primary feature layer information is processed through a deep convolution layer to extract deep feature layer information; In the dynamic cross-stage local network module, the deep feature layer information is divided into two branches for processing; wherein, the first branch is processed through a dynamic bottleneck structure to extract the semantic features of the vehicle and retain the details of the deep feature layer; the second branch performs channel transformation through conventional convolution to obtain corresponding feature information; the feature information output by the first branch and the second branch is concat spliced to obtain the fused feature layer information, and the feature layer information of different sizes is captured through a pyramid pooling operation.
10. The lightweight dual-dynamic vehicle detection and classification system according to claim 9, characterized in that: The multi-scale adaptive feature fuser is used to divide the input feature map information into S groups, denoted as , S is a natural number greater than 1; each set of feature map information is processed by convolution of different sizes, and the formula is: ; Among them, the is the convolution kernel size, is the number of groups; the feature map information of the convolution is recalibrated through the SE attention module, and the formula is: ; The recalibrated feature map information is spliced together to form an output feature map. The calculation formula is: , the output feature map is used to determine the category and positioning information of the vehicle in the vehicle image.
Citation Information
Cited By
Lightweight vehicle identification method based on image
CN120259845A