A vehicle target detection method based on a new frequency domain encoder
By introducing a new frequency domain encoder into the DINO target detection network and using Fourier transform and convolution operations to encode and decode features, the problem of large calculations in DINO is solved and the real-time performance and applicability of the model are improved.
Patent Information
- Application Number
- CN202411040175.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-31
AI Technical Summary
The target detection network DINO based on the Transformer architecture has a large amount of calculation and poor real-time performance, making it difficult to meet the needs of various application scenarios.
A new frequency domain encoder is used, including a scale synchronization module, a frequency domain fusion module and an intermediate scale fusion module, to encode and decode features through Fourier transform and convolution operations, reducing the amount of calculation and improving the real-time performance of the model.
It significantly reduces the amount of calculation and parameters, improves the real-time performance of the model, and is suitable for more application scenarios.
Smart Images

Figure CN118570611B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection, and in particular to a vehicle target detection method based on a novel frequency domain encoder. Background Art
[0002] In the field of vehicle target detection based on deep learning, the Yolo series of convolutional neural networks are widely used because of their lightweight and fast advantages. DINO, a target detection network based on the Transformer architecture, has a higher average accuracy than other deep learning networks. It brings the Transformer from the NLP field to the target detection task, achieving a breakthrough innovation. DINO uses DETR as the benchmark model, improves the learning speed by introducing denoising training to stabilize label allocation, and improves detection accuracy by using each layer of decoder to predict relative offsets. It achieves faster training convergence, excellent average accuracy performance, and better big data fitting effects.
[0003] Since DINO adopts the Transformer structure with quadratic computational complexity, the disadvantages of large computational complexity and poor real-time performance are inevitable. Summary of the invention
[0004] The purpose of the present invention is to provide a vehicle target detection method based on a novel frequency domain encoder, which can greatly reduce the amount of calculation and greatly improve the real-time performance of the model to adapt to more application scenarios.
[0005] To achieve the above object, the present invention provides a vehicle target detection method based on a novel frequency domain encoder, comprising the following steps:
[0006] S1. Collect visible light data (vehicle visible light data at different times of day, weather conditions, and driving scenarios);
[0007] S2, inputting the collected visible light data into the backbone network for feature extraction;
[0008] S3, input the last four layers of features output by the backbone network into the new frequency domain encoder for encoding;
[0009] S4, inputting the features output by the novel frequency domain encoder into a decoder for decoding;
[0010] S5, input the features output by the decoder into the detection head to realize the positioning task and the classification task;
[0011] S6, post-processing;
[0012] Among them, the new frequency domain encoder includes a scale synchronization module, a frequency domain fusion module and an intermediate scale fusion module. The scale synchronization module includes a scale synchronization fusion up-sampling module and a scale synchronization fusion down-sampling module. There are two frequency domain fusion modules.
[0013] Preferably, in step S3, the last four layers of features output by the backbone network are input into a novel frequency domain encoder for encoding, comprising the following steps:
[0014] S31, the scale synchronization module scales the last four layers of features extracted by the backbone network to a uniform resolution, and then performs feature splicing to obtain the spliced features;
[0015] S32, the frequency domain fusion module converts the concatenated features to the frequency domain, and performs a Z-layer complex convolution on the features converted to the frequency domain to obtain a weight matrix of the same size as the input features, and multiplies the weight matrix with the frequency domain features to obtain the fused features; wherein the value of Z is 3 to 5;
[0016] S33, the intermediate-scale fusion module selects the intermediate-scale features for the fused features and uses convolution to perform feature fusion.
[0017] Preferably, in step S31, the feature sizes of the last four layers are , , , , where H is the height of the feature and W is the width of the feature.
[0018] Preferably, in step S31, the size of the spliced features obtained by the scale synchronous fusion upsampling module is ; The size of the spliced feature obtained by the scale synchronous fusion downsampling module is .
[0019] Preferably, in step S32, the frequency domain fusion module converts the spliced features into the frequency domain, specifically by converting the spatial domain features into the frequency domain through a two-dimensional discrete Fourier transform, which is implemented by the following formula:
[0020] ;
[0021] in, represents the frequency domain function; is the abscissa of the frequency domain function; is the ordinate of the frequency domain function; is the number of pixels in the horizontal direction of the image; is the number of pixels in the vertical direction of the image; represents the spatial domain function; is the horizontal coordinate of the spatial domain function; is the ordinate of the spatial domain function; Is an imaginary unit.
[0022] Preferably, in step S33, the intermediate-scale fusion module selects the intermediate-scale features from the fused features and uses convolution to perform feature fusion, and the specific operation is:
[0023] Downsample and upsample the features of the two middle scales to The feature transformation is The feature of size The feature transformation is Features;
[0024] Then concatenate the sampled features with features of the same size in the channel dimension;
[0025] Last Use The convolutions are fused separately.
[0026] Therefore, the present invention adopts the above-mentioned vehicle target detection method based on the novel frequency domain encoder, and the technical effects are as follows:
[0027] (1) The proposed frequency domain encoder can efficiently encode the input features and fuse features of different scales so that the decoder can better decode and regress the positioning and classification required for target detection from the fused features;
[0028] (2) Compared with other types of encoders, this encoder greatly reduces the amount of calculation and improves the calculation speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 This is the schematic diagram of the encoder structure of the original DINO;
[0030] Figure 2 It is a structural schematic diagram of the novel frequency domain encoder of the present invention. DETAILED DESCRIPTION
[0031] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.
[0032] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.
[0033] Embodiment 1
[0034] like Figure 1 As shown in the figure, it is a schematic diagram of the encoder structure of the original DINO, which adopts the six-layer encoder architecture of Transformer ( Figure 1N in the figure represents the number of encoder layers), and adopts a multi-head self-attention and feedforward neural network cascade plus residual structure. With the powerful global modeling ability, efficient parallel computing ability, flexible feature representation and wide applicability of the self-attention mechanism, the encoder of the Transformer architecture has achieved better feature fusion ability, but at the cost of increasing the number of parameters and calculations.
[0035] Figure 2 It is a novel frequency domain encoder of the present invention, which is used in the DINO target detection framework, replacing the encoder of the original Transformer architecture, and plays the role of encoding multi-scale features and fusing features.
[0036] The network after adding the novel encoder of the present invention is divided into the following parts in terms of program flow: backbone network, frequency domain encoder, decoder, detection head and post-processing.
[0037] Backbone network: The input image enters the backbone network, and the backbone network extracts features from the input image. Classic backbone networks include ConvNet, LenNet, AlexNet, Inception, VGG, ResNet, DenseNet, SeNet, ViT, DeiT, and Swin Transformer. Classic lightweight convolutional neural networks include SqueezeNet, MobileNet, ShuffleNet, Xception, IGCNet, EfficientNet, GhostNet, MicroNet, MixNet, CspNet, and RepVGG. They use convolution or Transformer architectures to extract features during downsampling. Feature extraction is the process of extracting the data we need from a large amount of data. In the original DINO network, ResNet and SwinTransformer were used as the backbone networks for model performance testing.
[0038] Swin Transformer (Shifted Window Transformer) adopts the Transformer architecture. Compared with other feature extraction networks, it better combines the local receptive field with the global receptive field through the shift operation of window attention, reduces the amount of calculation and memory requirements, and improves the calculation efficiency. At the same time, it has good flexibility, strong robustness to noise in the image, and can adapt to various changes and interferences in the image.
[0039] ResNet (Deep residual network) proposed a residual network to solve the training problem of deep networks. It realized an ultra-deep network structure and used BatchNorm to accelerate training, improving the overall performance of the network. Common versions of ResNet are ResNet-50, ResNet-101, and ResNet-152, and their network structures are shown in Table 1. Since ResNet-50 has fewer parameters and is relatively lightweight, this embodiment uses ResNet-50 as the backbone to test and experiment the model performance.
[0040] Table 1 Network structure of different versions of ResNet
[0041] ;
[0042] Novel frequency domain encoder: The encoder includes a scale synchronization module, a frequency domain fusion module and an intermediate scale fusion module, wherein the scale synchronization module includes a scale synchronization fusion upsampling module and a scale synchronization fusion downsampling module, and there are two frequency domain fusion modules.
[0043] The last four layers of features output by the backbone network are input into the frequency domain encoder. The four scale features are , , , After the scale synchronization fusion up-sampling module and the scale synchronization fusion down-sampling module, the feature map size is synchronized to and Next, the synchronized features are fused in the frequency domain by using the frequency domain fusion module, that is, the input multi-scale features are fused in the frequency domain through Fourier transform and inverse Fourier transform. The outputs of the two frequency domain fusion modules are split in half in the channel dimension to obtain a size of , , , Finally, the above four features are input into the intermediate scale fusion module to fuse the intermediate scale features after scale transformation, and the final output size is , , , The four features of complete the encoding of multi-scale features.
[0044] Decoder: The Transformer decoder uses self-attention and cross-attention mechanisms to decode the features output from the encoder. The query vector is taken as Q, and the features output from the encoder are taken as K and V. Cross-attention is used to iterate through the layers of the decoder so that the query vector can be fully learned from the encoded features. The Transformer can capture long-distance dependencies and has strong representation capabilities, which enables it to better focus on the low-frequency information of the image, making up for the shortcomings of convolutional neural networks.
[0045] Detection head: The decoder outputs features to the detection head, which transforms the features to the required dimension and size through a combination of linear layers. Object detection can be decomposed into two tasks: positioning and classification.
[0046] Therefore, two detection heads are used to implement two tasks respectively. The localization task is to locate the detection target in the form of anchor boxes from the image. For localization, a matrix of size (batch_size, num_query, 4) needs to be output. Batch_size represents the number of data samples input for each training, num_query represents the number of predicted anchor boxes, and 4 represents the coordinates of the anchor boxes. The classification task is to identify and determine the category of a target in the image without caring about the location or number of the target. For classification, the required output is (batch_size, num_query, num_class). Num_class represents the total number of categories to be predicted.
[0047] Post-processing: According to the threshold of the predicted probability score, the predicted boxes with a probability less than the threshold are discarded, and the predicted boxes with a probability greater than the threshold are retained. Finally, the image and the anchor box are visualized and displayed together.
[0048] Experimental results:
[0049] Table 2 shows the training results of three models A, B, and C on the Pascal voc2012 dataset for 12 Epochs on Nvidia RTX 4070 Ti SUPER. A is the original DINO, B is DINO with a frequency domain encoder, and C is DINO without the encoder.
[0050] Table 2 Training results
[0051] ;
[0052] It can be seen that, with roughly the same accuracy, the DINO network with a frequency domain encoder has a greatly reduced amount of computation (about 39.58%), a slightly increased FPS, and a reduced amount of parameters (about 3.9%).
[0053] It is worth noting that the contents not elaborated in detail in the present invention are all prior art and are well known to those skilled in the art.
[0054] Therefore, the present invention adopts the above-mentioned vehicle target detection method based on the novel frequency domain encoder, which can greatly reduce the amount of calculation and greatly improve the real-time performance of the model to adapt to more application scenarios.
[0055] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A vehicle target detection method based on a novel frequency domain encoder, characterized in that: The following steps are involved: S1, collect visible light data; S2, inputting the collected visible light data into the backbone network for feature extraction; S3, input the last four layers of features output by the backbone network into the new frequency domain encoder for encoding; S4, inputting the features output by the novel frequency domain encoder into a decoder for decoding; S5, input the features output by the decoder into the detection head to realize the positioning task and the classification task; S6, post-processing; The novel frequency domain encoder includes a scale synchronization module, a frequency domain fusion module and an intermediate scale fusion module. The scale synchronization module includes a scale synchronization fusion up-sampling module and a scale synchronization fusion down-sampling module. There are two frequency domain fusion modules. In step S3, the last four layers of features output by the backbone network are input into the novel frequency domain encoder for encoding, including the following steps: S31, the scale synchronization module scales the last four layers of features extracted by the backbone network to a uniform resolution, and then performs feature splicing to obtain the spliced features; S32, the frequency domain fusion module converts the concatenated features to the frequency domain, and performs a Z-layer complex convolution on the features converted to the frequency domain to obtain a weight matrix of the same size as the input features, and multiplies the weight matrix with the frequency domain features to obtain the fused features; wherein the value of Z is 3 to 5; S33, the intermediate-scale fusion module selects the intermediate-scale features for the fused features and uses convolution to perform feature fusion.
2. The vehicle target detection method based on the novel frequency domain encoder according to claim 1 is characterized in that: In step S31, the feature sizes of the last four layers are , , , , where H is the height of the feature and W is the width of the feature.
3. The vehicle target detection method based on the novel frequency domain encoder according to claim 2 is characterized in that: In step S31, the size of the spliced feature obtained by the scale synchronous fusion upsampling module is ; The size of the concatenated features obtained by the scale synchronous fusion downsampling module is .
4. The vehicle target detection method based on a novel frequency domain encoder according to claim 3 is characterized in that: In step S32, the frequency domain fusion module converts the spliced features into the frequency domain, specifically by converting the spatial domain features into the frequency domain through a two-dimensional discrete Fourier transform, which is implemented by the following formula: in, represents the frequency domain function; is the abscissa of the frequency domain function; is the ordinate of the frequency domain function; is the number of pixels in the horizontal direction of the image; is the number of pixels in the vertical direction of the image; represents the spatial domain function; is the horizontal coordinate of the spatial domain function; is the ordinate of the spatial domain function; Is an imaginary unit.
5. The vehicle target detection method based on a novel frequency domain encoder according to claim 4 is characterized in that: In step S33, the intermediate scale fusion module selects the intermediate scale features from the fused features and uses convolution to perform feature fusion. The specific operation is as follows: Downsample and upsample the features of the two middle scales to The feature transformation is The feature of size The feature transformation is Features; Then concatenate the sampled features with features of the same size in the channel dimension; Last Use The convolutions are fused separately.
Citation Information
Patent Citations
Detection method based on fusion of visible light image and corresponding night vision infrared image
CN106251355A
Blind source separation rapid method and system based on multi-standard fusion frequency point screening
CN108877831A
Target detection method and device based on frequency domain characteristics and ConvNeXt
CN118262094A
Light-weight remote sensing image target detection method based on deep learning
CN118334313A
Deep learning-based intelligent recognition method and system for locomotive signboard information
WO2024131380A1
