A vehicle detection method and device based on a DSLNet network
By using the DSLNet network model, leveraging the backbone network and UDM module to enhance feature extraction, and combining it with depthwise separable convolution, the robustness and speed issues of vehicle detection algorithms in intelligent transportation are resolved, achieving efficient and accurate vehicle recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAIYIN INSTITUTE OF TECHNOLOGY
- Filing Date
- 2023-01-10
- Publication Date
- 2026-05-08
AI Technical Summary
Existing vehicle detection algorithms have poor robustness, long detection time, and low accuracy in the field of intelligent transportation, making it difficult to meet the detection needs of complex environments and small targets.
The DSLNet network model is adopted, including a backbone network module, a UDM enhanced feature extraction module, and a YoloHead object detection head module. Feature extraction is performed by combining large and small convolutions with depthwise separable convolutions, and the network parameters are optimized through a loss function to achieve effective fusion and detection of feature information.
It improves the accuracy and efficiency of vehicle detection, enabling real-time and accurate vehicle identification in complex environments, with particularly significant results in detecting dense and small targets.
Smart Images

Figure CN116030245B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision technology, specifically relating to a vehicle detection method and apparatus based on a DSLNet network. Background Technology
[0002] In recent years, with the rapid development of artificial intelligence and the accelerating pace of urbanization, intelligent transportation systems have become a social trend. Vehicle target detection is a crucial component of intelligent transportation management systems, widely used in intelligent monitoring systems, greatly alleviating traffic congestion and reducing traffic accident fatalities, thus improving traffic management efficiency. Therefore, optimizing vehicle target detection is of great significance and application value for enhancing traffic management systems.
[0003] Currently, vehicle target detection algorithms are broadly categorized into two types: traditional target detection algorithms and deep learning-based target detection algorithms. Traditional target detection algorithms combine machine learning classifiers with manually extracted local features. They primarily involve feature extraction and classification. The extracted features are typically histograms of gradient directions, combined with methods such as support vector machines or AdaBoost for target detection. However, this approach is prone to information loss, leading to errors and failing to meet the demands of high accuracy and high detection speed.
[0004] Compared to traditional object detection algorithms, deep learning-based object detection algorithms offer higher accuracy, faster detection speed, and stronger robustness. Examples include R-CNN, Fast R-CNN, and YOLO. However, in the field of intelligent transportation, they still exhibit problems such as long detection time, low accuracy, and poor robustness when detecting small targets in complex environments, making it difficult to meet the requirements of real-world scenarios. Summary of the Invention
[0005] Purpose of the invention: To address the problems of poor robustness, complex process, long detection time, and high false negative rate in existing vehicle detection methods, this invention proposes a vehicle detection method and device based on the DSLNet network model.
[0006] Technical Solution: This invention provides a vehicle detection method based on the DSLNet network model, specifically including the following steps:
[0007] (1) Preprocess the pre-acquired original images of traffic vehicles, which are divided into training images and test images;
[0008] (2) Constructing a DSLNet vehicle target detection network; the DSLNet vehicle target network includes a backbone network module, a UDM enhanced feature extraction module and a YoloHead target detection head module; the backbone network module is used to extract vehicle feature information, the UDM enhanced feature extraction module further enhances the feature extraction capability, and the YoloHead target detection head module is used to detect target objects;
[0009] (3) Input the pre-allocated training images into the DSLNet vehicle target detection network for training;
[0010] (4) Input the test image into the trained DSLNet vehicle target detection network to evaluate the overall performance of the DSLNet vehicle target detection network.
[0011] Further, the backbone network module described in step (2) includes a Focus module, a CBG module, and four DLC modules; the Focus module selects a value for every pixel in each image to obtain four independent feature layers, which are then stacked to increase the number of channels from 3 to 12; the CBG module contains a regular convolutional layer, a BatchNormalization layer, and a GELU activation layer; the DLC module divides a backbone into two branches, a and b, where branch a contains convolutional kernels of size 1×1, stride 1, and number of channels C, with the input and output channels remaining unchanged. The convolutional layer consists of a depthwise separable convolution with a kernel size of 3, C input channels, and 2C output channels. Branch b consists of a regular convolution with a kernel size of 1×1, a stride of 1, and C input / output channels, a depthwise separable convolution with a kernel size of 7×7, a stride of 1, C input channels, and 2C output channels, and a regular convolution with a kernel size of 1×1, a stride of 1, and 2C input / output channels, all activated using the GELU activation function. Branches a and b are then merged into a single line using a concat operation, and their feature information is fused through a regular 1×1 convolution.
[0012] Further, in step (2), the UDM enhanced feature extraction module first enhances feature extraction by performing convolution and downsampling on an image with a size of 4A×4A and a channel number of C extracted by the second layer DLC module in the backbone network. A 1×1 kernel with a stride of 1 is used for ordinary convolution, and the number of channels is changed. Downsampling reduces the image size from the original 4A×4A to A×A, shrinking it to one-quarter of its original size, resulting in images of size A×A and 4C channels, and images of size 4A×4A and 4C channels. Secondly, the feature image with a size of 2A×2A and 2C channels extracted by the third layer DLC module in the backbone network is further enhanced by performing convolution and downsampling. Features are further extracted using a 1×1 convolution kernel. Then, the last DLC module in the backbone network extracts an image of size A×A with 4C channels. This image is further extracted and upsampled using a 1×1 convolution kernel, resulting in images of size 4A×4A with C channels and A×A with 4C channels. The extracted 4A×4A and A×A images are combined and fused using add and convolution. The fused features are then redistributed to other convolutional layers. Information from intermediate layers is further aggregated and fused. Information from other feature layers is extracted using fusion and convolution, and finally distributed to the detection head for target detection.
[0013] Furthermore, step (3) includes the following steps:
[0014] (31) Input the allocated training sample data into the DSLNet vehicle target detection network to train it from scratch;
[0015] (32) Calculate the loss function of the DSLNet vehicle target detection network, and optimize the parameters of the network with the goal of minimizing the loss function:
[0016]
[0017] Where n represents the number of data categories, t i p represents the feature point corresponding to each ground truth bounding box. i The prediction results for the types of feature points are represented; the cross-entropy loss is calculated based on the types of the ground truth bounding boxes and the prediction results for the types of feature points.
[0018] (33) When the target loss value of the training converges, save the network model parameters to obtain the final DSLNet vehicle target detection network.
[0019] Based on the same inventive concept, the present invention also provides a vehicle detection device based on a DSLNet network, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is loaded onto the processor, it implements the above-described vehicle detection method based on the DSLNet network model.
[0020] Beneficial effects: Compared with the prior art, the beneficial effects of the present invention are as follows: The DSLNet model architecture proposed in this invention has a simple structure, uses a combination of large and small convolutions for feature extraction, and employs depthwise separable convolutions to reduce the number of parameters, enabling real-time accurate vehicle identification in road images with a high recognition accuracy; the backbone network and UDM enhanced feature extraction network extract feature information at different scales and effectively fuse them, significantly improving the efficiency and accuracy of detection. Attached Figure Description
[0021] Figure 1 A schematic diagram of the DSLNet vehicle target detection network structure constructed in this invention;
[0022] Figure 2 This is a schematic diagram of the DLC network structure;
[0023] Figure 3 This is a schematic diagram of the UDM network structure;
[0024] Figure 4 The image shows the results of the test using this invention. Detailed Implementation
[0025] The present invention will now be described in further detail with reference to the accompanying drawings.
[0026] This invention provides a vehicle detection method based on the DSLNet network model. First, the training images are preprocessed, and data augmentation is performed to avoid overfitting and improve the model's robustness and generalization ability, mainly using methods such as mixup, normalization, and scaling. The DSLNet network model is constructed, and its framework mainly includes a backbone network module, a UDM enhanced feature extraction module, and a YOLOHead object detection head module. The preprocessed training images are then input into the DSLNet network model for training. After sufficient training, preprocessed test images are input into the trained model to evaluate its performance. The specific steps include:
[0027] Step 1: Preprocess the pre-acquired raw images of traffic vehicles, dividing them into training images and test images.
[0028] The data is stored in a folder named Datasets, which contains two subfolders: Images and Labels. Images stores the training images, and Labels stores the XML files corresponding to the training images. The ratio of the training set to the test set is 8:2. The paths to the training set images are stored in train.txt, and the paths to the test set images are stored in test.txt, which contains the relative paths of the training images and labels.
[0029] Step 2: DSLNet vehicle target detection network model, such as Figure 1 As shown, it includes a backbone network module, a UDM module, and a YoloHead object detection head module. The backbone network module is used to extract target feature information from the image, the UDM module is used to further enhance and fuse feature information at different scales, and the YoloHead object detection module is used to detect target objects.
[0030] The backbone network consists of one focus module, one CBG module, and four DLC (Deep Large Convolution) modules. The backbone network extracts vehicle feature information through these modules. As the input image size decreases, the extracted feature information increases. The feature information extracted from the last three DLC layers of the backbone network is output to the UDM (Unified Distribution Module) module for further feature fusion. This fusion and redistribution method enriches the information. Finally, the obtained feature information of different sizes is input into the YoloHead detection head, which determines whether the desired object is present.
[0031] The Focus module selects a value for every pixel in each image to obtain four independent feature layers, which are then stacked to increase the number of channels from 3 to 12, a fourfold increase.
[0032] The CBG module contains a regular convolutional layer, a BatchNormalization layer, and a GELU activation layer.
[0033] like Figure 2The DLC module divides a main branch into two branches, a and b. Branch a consists of a convolutional layer with a kernel size of 1×1, a stride of 1, and C channels (with a constant number of input and output channels), and a depthwise separable convolution with a kernel size of 3, C input channels, and 2C output channels. Branch b consists of a regular convolution with a kernel size of 1×1, a stride of 1, and C input and output channels, a depthwise separable convolution with a kernel size of 7×7, a stride of 1, C input channels, and 2C output channels, and a regular convolution with a kernel size of 1×1, a stride of 1, and 2C input and output channels, all activated using the GELU activation function. Branches a and b are then merged into a single line using a concat operation, followed by a regular 1×1 convolution to better fuse their feature information.
[0034] like Figure 3 The UDM enhanced feature extraction module first takes the 4A×4A image with C channels extracted by the second layer DLC module in the backbone network and enhances feature extraction through convolution and downsampling. It uses a standard convolution with a 1×1 kernel and a stride of 1, and changes the number of channels. Downsampling reduces the image size from 4A×4A to A×A, a quarter of its original size, resulting in two images of size A×A with 4C channels and two images of size 4A×4A with C channels. Next, the 2A×2A image with 2C channels extracted by the third layer DLC module in the backbone network is further processed with a 1×1 convolution to extract features. Finally, the image with A×A and 4C channels extracted by the last layer DLC module in the backbone network is further processed with a 1×1 convolution and upsampling to obtain two images of size 4A×4A with C channels and two images of size A×A with 4C channels. The extracted 4A×4A, C-channel and A×A, 4C-channel combinations are fused using add and convolution. The fused features are then redistributed to other convolutional layers. The intermediate layer information is then aggregated and fused again, followed by convolution and redistributed to the upper and lower layers. The remaining feature layer information is extracted using fusion and convolution, and finally used in the detection head to detect the target.
[0035] Step 3: Input the training images into the DSLNet network model for training.
[0036] Input the training sample data into the DSLNet network model to train it; after setting the corresponding parameters, train the model; calculate the loss function of the DSLNet network:
[0037]
[0038] Where n represents the number of data categories, ti p represents the feature point corresponding to each ground truth bounding box. i This represents the prediction result for the feature point type. The cross-entropy loss is calculated based on the ground truth bounding box type and the feature point type prediction results.
[0039] The network parameters are optimized with the goal of minimizing the loss function. When the loss function converges, the network model parameters are saved, resulting in the final DSLNet vehicle target detection network model.
[0040] Step 4: Input the segmented test images into the trained DSLNet network model and evaluate the model's performance.
[0041] Configure parameters, including learning rate, epoch size, and batch size, where batch size is set to 8 and epochs to 300. Train the dataset using the configured parameters, performing training and prediction on images. Figure 4 The image shows the detection results of this model, which can be seen that the detection effect is particularly outstanding for dense targets and small targets.
[0042] Based on the same inventive concept, the present invention also provides a vehicle detection method based on the DSLNet network model, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the above-described vehicle detection method based on the DSLNet network model when loaded onto the processor.
[0043] The foregoing description illustrates the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claims. The scope of protection of this invention is defined by the appended claims.
Claims
1. A vehicle detection method based on a DSLNet network, characterized in that, Includes the following steps: (1) The pre-acquired original images of traffic vehicles are preprocessed and divided into training images and test images; (2) Constructing the DSLNet vehicle target detection network; the DSLNet vehicle target detection network includes a backbone network module, a UDM enhanced feature extraction module, and a YoloHead target detection head module; the backbone network module is used to extract vehicle feature information, the UDM enhanced feature extraction module further enhances the feature extraction capability, and the YoloHead target detection head module is used to detect target objects; the UDM enhanced feature extraction module first extracts the feature information of the second layer DLC module in the backbone network into an image with a size of 4A×4A and a number of channels C, and enhances feature extraction through convolution and downsampling. It adopts ordinary convolution with a kernel size of 1×1 and a stride of 1, and changes the number of channels. Through downsampling, the image size is changed from the original 4A×4A to A×A, which is reduced to one-quarter of the original size, resulting in a size of A×A and a number of channels. The system first extracts two images: one with a size of 4C and the other with a size of 4A×4A and a channel count of C. Then, it extracts a 2A×2A feature image with 2C channels using the third layer DLC module in the backbone network, which is further processed by a 1×1 convolution. Next, it extracts an A×A image with 4C channels using the last layer DLC module in the backbone network, which is then further processed by a 1×1 convolution to extract features and upsample, resulting in two images: one with a size of 4A×4A and a channel count of C, and the other with a size of A×A and a channel count of 4C. The extracted 4A×4A and A×A images are then combined and fused using add and convolution. The fused features are then redistributed to other convolutional layers. Information from intermediate layers is further aggregated and fused, and information from other feature layers is extracted using fusion and convolution. Finally, these features are assigned to the detection head for target detection. (3) Input the pre-assigned training images into the DSLNet vehicle target detection network for training; (4) Input the test image into the trained DSLNet vehicle target detection network to evaluate the overall performance of the DSLNet vehicle target detection network.
2. The vehicle detection method based on a DSLNet network according to claim 1, characterized in that, The backbone network module in step (2) includes a Focus module, a CBG module, and four DLC modules; the Focus module selects a value for every pixel in each image to obtain four independent feature layers, which are then stacked to increase the number of channels from 3 to 12; the CBG module contains a regular convolutional layer and a batch layer. The DLC module divides a main branch into two branches, a and b. Branch a includes a convolutional layer with a kernel size of 1×1, stride of 1, and number of channels C, with a constant number of input and output channels, and a depthwise separable convolution with a kernel size of 3, number of input channels C, and number of output channels 2C. Branch b includes a normal convolution with a kernel size of 1×1, stride of 1, and number of input and output channels C, a depthwise separable convolution with a kernel size of 7×7, stride of 1, number of input channels C, and number of output channels 2C, and a normal convolution with a kernel size of 1×1, stride of 1, and number of input and output channels 2C, all activated using the GELU activation function. Then, the two branches a and b are merged into one line through the concat operation, and their feature information is fused through a regular 1×1 convolution.
3. The vehicle detection method based on a DSLNet network according to claim 1, characterized in that, Step (3) includes the following steps: (31) Input the allocated training sample data into the DSLNet vehicle target detection network to train it from scratch; (32) Calculate the loss function of the DSLNet vehicle target detection network, and optimize the parameters in the network with the goal of minimizing the loss function: ; Where n represents the number of data categories, t i p represents the feature point corresponding to each ground truth bounding box. i The prediction results for the types of feature points are represented; the cross-entropy loss is calculated based on the types of the ground truth bounding boxes and the prediction results for the types of feature points. (33) When the target loss value of the training converges, save the network model parameters to obtain the final DSLNet vehicle target detection network.
4. A vehicle detection device based on a DSLNet network, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is loaded into the processor, it implements the steps of the vehicle detection method based on the DSLNet network as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Multi-scale target detection method combining equilibrium features and deformable convolution
CN114913433A
Light-weight pose estimation network with multi-scale heatmap fusion
WO2021163103A1