Transform-based global positioning method for automatic driving commercial vehicle on structured road
Through a deep learning network based on Transformer, combined with semantic segmentation and self-attention mechanism, the features of structured roads are extracted and LSTM is used to learn time series data, which solves the problem of insufficient vehicle positioning accuracy in structured road scenes and achieves high accuracy and Robust global localization.
Patent Information
- Application Number
- CN202410828172.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-06-25
AI Technical Summary
Existing technology is difficult to achieve high-precision global positioning in structured road scenes. GPS positioning accuracy is insufficient. High-precision inertial navigation is costly and easy to accumulate errors. Deep learning methods are affected by dynamic object occlusion and illumination changes, making it difficult to extract structures stably and accurately. stable characteristics of the road.
A structured global positioning method for road autonomous commercial vehicles based on Transformer is adopted. Through deep learning network training, combined with semantic segmentation and self-attention mechanism, road structure information and location features are extracted. LSTM is used to learn time series data, combined with extended Kalman filtering. Carry out vehicle pose prediction.
It achieves high-precision vehicle positioning in structured road scenes, improves positioning robustness and universality, reduces dynamic object interference, and enhances the timeliness and accuracy of the algorithm.
Smart Images

Figure CN118691779A
Abstract
Description
Technical Field
[0001] The present invention relates to a Transformer-based global positioning method for a structured road autonomous driving commercial vehicle, belonging to the technical field of automobile driving positioning. Background Art
[0002] With continuous technological advancements, the performance and stability of autonomous driving systems have greatly improved. Commercial vehicles are the first to utilize a full range of autonomous driving systems to serve logistics, public transportation, and urban services, such as automated delivery for campus logistics, smart urban buses, and self-driving taxis. The application of autonomous driving technology in commercial vehicles has a significant impact on reducing labor costs, improving transportation efficiency, and enhancing driving safety. With the continuous advancement of autonomous driving technology, the commercial application of autonomous driving in commercial vehicles will accelerate. High-precision positioning information is a prerequisite for autonomous vehicle navigation and path planning, and is a key component of autonomous driving strategies. Accurate positioning information is even more crucial for autonomous commercial vehicles, as they require more accurate identification of the location of each key point. For commercial vehicles traveling on structured urban roads, the Global Positioning System (GPS) is the mainstream method for vehicle positioning, but its positioning accuracy is only in the meter range, which cannot meet the positioning accuracy requirements of smart vehicles. Global Navigation Satellite System (GNSS) / Real-Time Kinematics (RTK) is a vehicle positioning method that can achieve centimeter-level positioning accuracy. However, satellite signals are sensitive to obstruction by urban buildings and trees, making positioning signals easily lost. Furthermore, the high cost of building signal base stations significantly increases the cost of autonomous commercial vehicle positioning, preventing widespread use for global positioning on structured roads.
[0003] Currently, the mainstream high-precision positioning methods in structured road scenes are based on high-precision maps, SLAM, or high-precision inertial navigation, but these methods also suffer from high costs and cumulative errors. With the continuous development of computer vision and deep learning, low-cost camera sensors have become the primary research target for high-precision positioning technology. However, the information captured by cameras often contains unstable positioning features, such as pedestrians, vehicles, and other variable features. Objects with stable and reliable positioning features, such as curbs, lane markings, and traffic signs, are often obscured by pedestrians or passing vehicles, affecting positioning accuracy. Extracting and utilizing stable and reliable features has become a key issue in visual positioning technology. With the development of deep learning, methods for determining the absolute camera pose using deep learning have been widely studied. Leveraging the powerful feature extraction and learning capabilities of deep learning, it can effectively address issues such as occlusion by vehicles and pedestrians, and varying lighting conditions. Deep learning-based camera absolute pose estimation methods can directly output absolute poses end-to-end, and through learning from a large number of training samples, accurate positioning results can be obtained. However, inputting the complete, real-time image into the network is not only subject to interference from dynamic objects, but also reduces positioning robustness. Furthermore, structured roads often contain complete structural information, such as lane markings, curbs, and traffic signs. Utilizing this structural information not only improves positioning robustness but also enhances the algorithm's universality. Semantic segmentation is used to capture this structural information, and the Transformer self-attention mechanism is used to macroscopically exploit this structural information for positioning. Finally, this information is fed into an LSTM, which can learn from time series data. This effectively compensates for positioning inaccuracies caused by occlusions on structured roads, further improving vehicle positioning accuracy. Summary of the Invention
[0004] Purpose of the invention: In response to the shortcomings of the existing technology, the present invention provides a Transformer-based global positioning method for commercial vehicles on structured roads for autonomous driving. The method trains the constructed deep learning network through pre-collected real-scene images of the road and real-pose information to achieve high-precision self-positioning of the vehicle in structured road scenes.
[0005] Technical Solution: A Transformer-based global positioning method for autonomous commercial vehicles on structured roads, including the following steps:
[0006] Step 1: Image acquisition, image processing, and dataset creation:
[0007] Collect image features of the target city's roads, including roads, lane lines, road markings, traffic lights, traffic signs, poles, sidewalks, buildings, and trees, while recording the location information of each image. Perform pixel preprocessing on the images, reshaping the original images to 513×513 size. The resized images form the dataset for training and testing the network.
[0008] Step 2: Network model establishment, including the following three parts:
[0009] The first part of the network model is a model for perceiving road structure information. Structured roads contain a large amount of invariant structural information, such as roads, lane lines, road markings, traffic lights, traffic signs, poles, sidewalks, buildings, and trees. The DeepLabV3Plus semantic segmentation network is used to perform semantic segmentation on the resized original image in order to obtain road structure information. Based on the original DeepLabV3Plus semantic segmentation network model, an attention module is introduced; in the encoder of the original DeepLabV3+ model, the high-level features generated by the backbone network are directly fed into the ASPP. The ASPP module uses multiple parallel dilated convolutional layers with different sampling rates. The features extracted for each sampling rate are further processed in a separate branch and fused to generate the final result. The ASPP method obtains multi-scale features from the image and obtains image context information. However, due to the excessive expansion rate of the ASPP structure, spatial image information will be lost, and image edge features cannot be extracted well. That is, a PSA module is added after the ASPP module. The PSA module consists of channel attention and spatial attention, which increases the extraction of important information and improves the model's utilization of information.
[0010] The second part of the network model is an image spatial feature extraction model, which extracts robust position feature information from the image and encodes these features through the Transformer variable self-attention mechanism;
[0011] When faced with continuous similar scenes, the cosine calculations of the feature vectors of similar scene images are performed on each other. When the cosine value is between 0.4 and 0.6, the effectiveness of the feature extraction model can be proved;
[0012] Adopting the overall architecture based on the Swin Transformer sliding window, removing the last fully connected layer, and outputting a 768-dimensional feature vector, which can be regarded as the feature vector of the image to be located;
[0013] The third network model is a global pose prediction model. It uses the 768-dimensional feature vector output by the feature encoder as the input to the time series network. The LSTM long short-term memory network has a strong learning capability for time series data. By introducing the concept of "gates" to control the transmission of information, LSTM can capture and memorize the dependencies between image feature vectors over long time intervals, thereby more accurately predicting vehicle positioning information.
[0014] Step 3: Network model training:
[0015] According to the road key information detection model, image spatial feature extraction model and global pose prediction model in step 2, they are trained separately; the image data collected in step 1 is divided into training set, verification set and test set in a ratio of 3:1:1;
[0016] Step 4: Positioning the vehicle posture, including:
[0017] The extended Kalman filter is used to integrate the IMU and network output positioning results to obtain the vehicle posture state variable: where x i ,y i , are the vehicle position and heading angle in the two-dimensional plane respectively.
[0018] The attention module in step 2 includes two parts: channel attention and spatial attention, where the channel attention weight is calculated as:
[0019]
[0020] Where σ1σ2 represents 1×1 convolution, F SM represents the softmax function, represents 1×1 convolution and LN layer, which increases the channel dimension from C / 2 to C, F SG Represents the sigmoid function;
[0021] The spatial attention weight is calculated as:
[0022] A sp (X) = F SG [σ3(F SM (σ1(F GP (W q (X))))×σ2(W v (X)))] (2)
[0023] Where σ1σ2σ3 represents 1×1 convolution, F SM represents the softmax function, F GP represents global pooling, F SGRepresents the sigmoid function, which adopts a serial structure, that is, the feature map X first performs channel attention calculation and then spatial attention calculation.
[0024] In step 2, the Swin Transformer uses the self-attention mechanism, namely:
[0025] q=xW q ,k=xW k ,v=xWv (3)
[0026]
[0027] z=Concat(z (1) ,...,z (m) )W o (5)
[0028] Where x is the feature vector matrix obtained by flattening the feature map generated by convolution of the original input image, m is the number of heads of the multi-head attention mechanism, σ(·) is the softmax function, d is the vector length, and z is the length of the vector. (m) represents the output matrix of the mth attention head, q (m) 、k (m) and v (m) Respectively represent the query matrix, the matrix to be queried, and the actual feature matrix generated by the feature graph; W q , W k , W v Generate q (m) , k (m) , v (m) The weight matrix, W o is the multi-attention weight matrix, z is the final output feature vector matrix;
[0029] A deformable attention mechanism is used instead of the self-attention mechanism to improve the computational speed. The image feature map consists of at least 2401 tokens, i.e., a 49*49 rectangular array of tokens. A set of offsets is learned to determine the tokens necessary for attention calculation between the current token and the remaining tokens in the image, and attention calculation is performed on important points. The offsets are a set of two-dimensional vectors pointing from the current token to the necessary tokens.
[0030] Given an input feature map x∈R generated by the original image with length and width channels H, W, C H×W×C , generate several location points
[0031] First, give each point position information, that is, {(0,0),...(H G-1 ,W G-1 )}, then follow the grid shape HG ×W G , normalize all coordinates and determine the relative position, that is, (-1,-1) represents the upper left corner, and (+1,+1) represents the lower right corner; offset:
[0032] △p=q offset (q) (6)
[0033] Where q is the query vector of the feature point to which the attention mechanism is currently executed, q offset (·) is a lightweight convolutional neural network. The neural network consists of two convolutional modules with nonlinear activation. The query vector q generated by the feature map is input. The local features are first captured by 5×5 depth convolution. Then, the GELU activation function and 1×1 convolution are used to obtain the two-dimensional offset, and then the deformable attention mechanism is obtained:
[0034]
[0035] Where φ(;) is the bilinear interpolation function, which is used to obtain the feature points important to the current point. The query vector and actual feature vector of important feature points;
[0036] Perform multi-head attention calculation on q, k, v to get the final result
[0037]
[0038] The feature vector is reshaped into a 4×192 matrix, and four LSTM networks are used to pass it to a fully connected layer for positioning prediction.
[0039] For the DeepLabV3Plus network, 9 categories are defined, namely road, lane line, road marking, traffic light, traffic sign, pole, sidewalk, building and tree; the original image is annotated using Labelme software, and the learning rate is set to l r is 0.01 and is trained using a GPU;
[0040] For the Transformer feature encoder, a pre-trained model for classification tasks on the ImageNet dataset is used as the pre-trained model for this application;
[0041] For the LSTM network, the camera pose is p and the loss function is defined as:
[0042] loss(I)=(pp*) 2 (10)
[0043] Where p is the true pose and p* is the predicted pose.
[0044] The step 4 is specifically as follows:
[0045] Assume t i The estimated state X at time i Affected by system noise G i Drive, expressed in equation form:
[0046] X i =A i,i-1 X i +W i-1 G i-1 (11)
[0047] Among them A i,i-1 t i-1 Time to t i The transfer matrix at time t, W i-1 is the system noise driving matrix.
[0048] X i is GPS data, its value satisfies the linear relationship, and the measurement equation is:
[0049] Z i =H i X i +V i (12)
[0050] Among them H i is the measurement matrix, V i To measure the noise sequence, in this system we have:
[0051]
[0052] Let Q i is the system noise sequence variance matrix, R i is the variance matrix of the measurement noise sequence, which is a non-negative definite matrix in this system;
[0053] When the filter is initialized, the first frame GPS position and coordinates, that is, the positioning information of the network prediction model, are taken as the initial value of the filter state. Then the initial estimated mean square error matrix is:
[0054]
[0055] Where ed is the distance estimation noise, ey is the heading estimation noise; when the velocity information and gyroscope angular velocity information are updated, the prediction solution is obtained by dead reckoning, and the system noise variance matrix Q i for:
[0056]
[0057] The transfer matrix A from time i-1 to time i i,i-1for:
[0058]
[0059] For W i-1 , when the vehicle turning angle is small at the previous and next moments, we have:
[0060]
[0061] When the vehicle posture angle is large at the current and next moments, there are:
[0062]
[0063] Where td is the distance the vehicle travels during the time period, and tr is the angle the vehicle turns during the time period, namely:
[0064] td=v*dt,tr=w*dt (19)
[0065] Then we get the prediction mean square error matrix:
[0066] P i / i-1 =A i,i-1 *P i-1 *A T i,i-1 +W i *Q i-1 *W T i-1 (20)
[0067] When the network model outputs updated positioning information, the positioning result is fused with the current dead reckoning result; the measurement noise variance matrix is obtained based on the current network model:
[0068]
[0069] Calculate the filter gain K:
[0070] K=P i / i-1 *H T i *(H i *P i / i-1 *H T i +R i ) (twenty two)
[0071] The final state is estimated to be:
[0072] Y i =Z i -H i *X i / i-1 (twenty three)
[0073] X i =Xi / i-1 +K*Y i (twenty four)
[0074] Finally, update the mean square error matrix P, E is a 3×3 identity matrix:
[0075] P i =(EK i *H i )*P i / i-1 (25)
[0076] Final Output That is, the vehicle position and heading angle.
[0077] Beneficial effects:
[0078] The semantic segmentation after adding the PSA attention module captures the detailed information of the structured road, removes dynamic objects, retains the image spatial features, ensures the robustness of positioning, and also improves the versatility.
[0079] Transformer can better extract features that are strongly related to positioning through its powerful self-attention mechanism. Replacing the self-attention mechanism with a deformable attention mechanism can better adapt to images after semantic segmentation, increasing timeliness and accuracy.
[0080] When blurry occlusion, ghosting, and other conditions occur in a few frames, the LSTM network can effectively improve the above conditions and ensure the robustness of the positioning information. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0082] Figure 1 It is the overall flow chart of the present invention.
[0083] Figure 2 This is the improved DeepLabV3Plus structure diagram of the present invention.
[0084] Figure 3 This is a structural diagram of the PSA of the present invention.
[0085] Figure 4 This is the structural diagram of the Transformer encoder of the present invention.
[0086] Figure 5 This is the network model diagram of the present invention. DETAILED DESCRIPTION
[0087] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0088] In the description of the present invention, it should be understood that the terms "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating directions or positional relationships, are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as limiting the present invention.
[0089] In the present invention, unless otherwise expressly specified or limited, a first feature being "above" or "below" a second feature may include the first and second features being in direct contact, or may include the first and second features being in contact not directly but through another feature between them. Furthermore, a first feature being "above," "above," and "above" a second feature may include the first feature being directly above or obliquely above the second feature, or may simply mean that the first feature is higher in level than the second feature. A first feature being "below," "below," and "below" a second feature may include the first feature being directly below or obliquely below the second feature, or may simply mean that the first feature is lower in level than the second feature.
[0090] like Figure 1 As shown in FIG, a Transformer-based global positioning method for a commercial vehicle on a structured road autonomous driving system includes the following steps:
[0091] Step 1: Image acquisition, image processing, and dataset creation:
[0092] Collect image features of the target city's roads, including roads, lane lines, road markings, traffic lights, traffic signs, poles, sidewalks, buildings, and trees, while recording the location information of each image. Perform pixel preprocessing on the images, reshaping the original images to 513×513 size. The resized images form the dataset for training and testing the network.
[0093] Step 2: Network model establishment, including the following three parts:
[0094] The first part of the network model is a model for perceiving road structure information. Structured roads contain a large amount of invariant structural information, such as roads, lane lines, road markings, traffic lights, traffic signs, poles, sidewalks, buildings, and trees. The DeepLabV3Plus semantic segmentation network is used to perform semantic segmentation on the resized original image to obtain road structure information.
[0095] Building on the original DeepLabV3Plus semantic segmentation network model, the attention module is introduced. In the encoder of the original DeepLabV3+ model, the high-level features generated by the backbone network are directly fed into the ASPP module. The ASPP module uses multiple parallel dilated convolutional layers with different sampling rates. The features extracted for each sampling rate are further processed in a separate branch and fused to generate the final result. The ASPP method extracts multi-scale features from the image and obtains image context information.
[0096] However, due to the excessive expansion rate of the ASPP structure, spatial image information will be lost and the image edge features cannot be extracted well. That is, a PSA module is added after the ASPP module. The PSA module consists of channel attention and spatial attention, which increases the extraction of important information and improves the model's utilization of information.
[0097] The attention module in step 2 includes two parts: channel attention and spatial attention, where the channel attention weight is calculated as:
[0098] A ch (X) = F SG [W zq1 ((σ1(W v (X))×F SM (σ2(W q (X))))] (1)
[0099] Where σ1σ2 represents 1×1 convolution, F SM represents the softmax function, W zq1 represents 1×1 convolution and LN layer, which increases the channel dimension from C / 2 to C, F SG Represents the sigmoid function;
[0100] The spatial attention weight is calculated as:
[0101] A sp (X) = F SG [σ3(F SM (σ1(F GP (W q (X))))×σ2(W v (X)))] (2)
[0102] Where σ1σ2σ3 represents 1×1 convolution, FSM represents the softmax function, F GP represents global pooling, F SG Represents the sigmoid function, which adopts a serial structure, that is, the feature map X first performs channel attention calculation and then spatial attention calculation.
[0103] The second part of the network model is an image spatial feature extraction model, which extracts robust position feature information from the image and encodes these features through the Transformer variable self-attention mechanism;
[0104] When faced with continuous similar scenes, the cosine calculations of the feature vectors of similar scene images are performed on each other. When the cosine value is between 0.4 and 0.6, the effectiveness of the feature extraction model can be proved;
[0105] Adopting the overall architecture based on the Swin Transformer sliding window, removing the last fully connected layer, and outputting a 768-dimensional feature vector, which can be regarded as the feature vector of the image to be located;
[0106] In step 2, the Swin Transformer uses the self-attention mechanism, namely:
[0107] q=xW q ,k=xW k, v=xWv (3)
[0108]
[0109] z=Concat(z (1) ,...,z (m) )W o (5)
[0110] Where x is the feature vector matrix obtained by flattening the feature map generated by convolution of the original input image, m is the number of heads of the multi-head attention mechanism, σ(·) is the softmax function, d is the vector length, and z is the length of the vector. (m) represents the output matrix of the mth attention head, q (m) 、k (m) and v (m) Respectively represent the query matrix, the matrix to be queried, and the actual feature matrix generated by the feature graph; W q , W k , W v Generate q (m) , k (m) , v (m) The weight matrix, W o is the multi-attention weight matrix, z is the final output feature vector matrix;
[0111] A deformable attention mechanism is used instead of the self-attention mechanism to improve the computational speed. The image feature map consists of at least 2401 tokens, i.e., a 49*49 rectangular array of tokens. A set of offsets is learned to determine the tokens necessary for attention calculation between the current token and the remaining tokens in the image, and attention calculation is performed on important points. The offsets are a set of two-dimensional vectors pointing from the current token to the necessary tokens.
[0112] Given an input feature map x∈R generated by the original image with length and width channels H, W, C H×W×C , generate several location points
[0113] First, give each point position information, that is, {(0,0),...(H G-1, W G-1 )}, then follow the grid shape H G× W G , normalize all coordinates and determine the relative position, that is, (-1,-1) represents the upper left corner, and (+1,+1) represents the lower right corner; offset:
[0114] △p=q offset (q) (6)
[0115] Where q is the query vector of the feature point to which the attention mechanism is currently executed, q offset (·) is a lightweight convolutional neural network. The neural network consists of two convolutional modules with nonlinear activation. The query vector q generated by the feature map is input. The local features are first captured by 5×5 depth convolution. Then, the GELU activation function and 1×1 convolution are used to obtain the two-dimensional offset, and then the deformable attention mechanism is obtained:
[0116]
[0117] Where φ(;) is the bilinear interpolation function, which is used to obtain the feature points important to the current point. The query vector and actual feature vector of important feature points;
[0118] Perform multi-head attention calculation on q, k, v to get the final result
[0119]
[0120] The third network model is a global pose prediction model. It uses the 768-dimensional feature vector output by the feature encoder as the input to the time series network. The LSTM long short-term memory network has a strong learning capability for time series data. By introducing the concept of "gates" to control the transmission of information, LSTM can capture and memorize the dependencies between image feature vectors over long time intervals, thereby more accurately predicting vehicle positioning information.
[0121] The feature vector is reshaped into a 4×192 matrix, and four LSTM networks are used to pass it to a fully connected layer for positioning prediction.
[0122] Step 3: Network model training:
[0123] According to the road key information detection model, image spatial feature extraction model and global pose prediction model in step 2, they are trained separately; the image data collected in step 1 is divided into training set, verification set and test set in a ratio of 3:1:1;
[0124] For the DeepLabV3Plus network, 9 categories are defined, namely road, lane line, road marking, traffic light, traffic sign, pole, sidewalk, building and tree; the original image is annotated using Labelme software, and the learning rate is set to l r is 0.01 and is trained using a GPU;
[0125] For the Transformer feature encoder, a pre-trained model for classification tasks on the ImageNet dataset is used as the pre-trained model for this application;
[0126] For the LSTM network, the camera pose is p and the loss function is defined as:
[0127] loss(I)=(pp*) 2 (10)
[0128] Where p is the true pose and p* is the predicted pose.
[0129] Step 4: Positioning the vehicle posture, including:
[0130] The extended Kalman filter is used to integrate the IMU and network output positioning results to obtain the vehicle posture state variable: where x i ,y i , are the vehicle position and heading angle in the two-dimensional plane respectively.
[0131] The step 4 is specifically as follows:
[0132] Assume t i The estimated state X at timei Affected by system noise G i Drive, expressed in equation form:
[0133] X i =A i,i-1 X i +W i-1 G i-1 (11)
[0134] Among them A i,i-1 t i-1 Time to t i The transfer matrix at time t, W i-1 is the system noise driving matrix.
[0135] X i is GPS data, its value satisfies the linear relationship, and the measurement equation is:
[0136] Z i =H i X i +V i (12)
[0137] Among them H i is the measurement matrix, V i To measure the noise sequence, in this system we have:
[0138]
[0139] Let Q i is the system noise sequence variance matrix, R i is the variance matrix of the measurement noise sequence, which is a non-negative definite matrix in this system;
[0140] When the filter is initialized, the first frame GPS position and coordinates, that is, the positioning information of the network prediction model, are taken as the initial value of the filter state. Then the initial estimated mean square error matrix is:
[0141]
[0142] Where ed is the distance estimation noise, ey is the heading estimation noise; when the velocity information and gyroscope angular velocity information are updated, the prediction solution is obtained by dead reckoning, and the system noise variance matrix Q i for:
[0143]
[0144] The transfer matrix A from time i-1 to time i i,i-1 for:
[0145]
[0146] For W i-1 , when the vehicle turning angle is small at the previous and next moments, we have:
[0147]
[0148] When the vehicle posture angle is large at the current and next moments, there are:
[0149]
[0150] Where td is the distance the vehicle travels during the time period, and tr is the angle the vehicle turns during the time period, namely:
[0151] td=v*dt,tr=w*dt (19)
[0152] Then we get the prediction mean square error matrix:
[0153] P i / i-1 =A i,i-1 *P i-1 *A T i,i-1 +W i *Q i-1 *W T i-1 (20)
[0154] When the network model outputs updated positioning information, the positioning result is fused with the current dead reckoning result; the measurement noise variance matrix is obtained based on the current network model:
[0155]
[0156] Calculate the filter gain K:
[0157] K=P i / i-1 *H T i *(H i *P i / i-1 *H T i +R i ) (twenty two)
[0158] The final state is estimated to be:
[0159] Y i =Z i -H i *X i / i-1 (twenty three)
[0160] X i =X i / i-1 +K*Y i (twenty four)
[0161] Finally, update the mean square error matrix P, E is a 3×3 identity matrix:
[0162] P i =(EK i *H i )*P i / i-1 (25)
[0163] Final Output That is, the vehicle position and heading angle.
[0164] The specific working methods according to the execution of the above steps include:
[0165] Follow Step 1: Collect data and create a dataset. The vehicle is equipped with a monocular camera and GNSS-RTK. First, manually calibrate the timestamps of the monocular camera and GNSS-RTK to ensure high-precision position information and image data synchronization. The vehicle enters the target road section and maintains normal driving during data collection, maximizing the reproduction of realistic driving conditions.
[0166] Follow Step 2: Build the network model. Figure 5 For the semantic segmentation network, the DeepLabV3Plus network with the PSA module is used. Figure 2 As shown in the figure, the original road image is input, MobileNetV2 is selected as the image feature extraction network, and finally the semantic segmentation image is obtained. For the Transformer encoder, the structure is as follows Figure 3 As shown in the figure, similar to the Swin Transformer, the Transformer encoder consists of four stages, each of which includes a window attention module and a shifted window-based attention module. Drawing on the characteristics of the DAT network and the image after segmentation, excessive deformable attention significantly increases computational overhead and timeliness. Therefore, the deformable attention mechanism is only introduced in stage 4 and is used only with the shifted window-based attention mechanism, preserving the global self-attention mechanism within the window. This allows it to better learn global features while minimizing computational complexity and training difficulty. After the segmented image enters the Transformer encoder, the output is a 768-row vector, which is then input into the LSTM network, completing the network model.
[0167] As described in step 3: Network model training. For the DeepLabV3Plus network, 9 categories are defined, namely roads, lane lines, road markings, traffic lights, traffic signs, poles, sidewalks, buildings, and trees. Use Cityscapes software to annotate them, and perform rotation, cropping, and occlusion to increase the amount of data as data augmentation. Use the pre-trained model on the Cityscapes dataset for training. For the training of the Transformer encoder, first resize the semantically segmented image to 224×224×3, use its network for classification tasks on the ImageNet dataset as the backbone network, and use its pre-trained model for training, freezing the training weights of the first three stages. For LSTM, in order to train the model, we use the stochastic gradient descent (SGD) algorithm with an initial learning rate of 0.001, a weight decay of 0.0005, a batch size of 8, and minimize the mean square error as the loss function.
[0168] Positioning is achieved as described in Step 4. When a vehicle enters the target urban road section, the vehicle's camera captures a structured road image that is fed into the trained DeepLabV3Plus network. MobileNetV2 is selected as the backbone network for image feature extraction. The image enters the network and undergoes a series of convolution operations. Feature maps obtained at four different sampling rates are fused and then further fused with shallow features obtained from MobileNetV2. Finally, semantic segmentation is achieved through decoding, resulting in an image without dynamic objects such as vehicles, pedestrians, and cyclists. The output semantic segmentation image is resized to 224×224×3 and then enters the Transformer encoder, with an image size of 224×224×3. Similar to the Swin Transformer, the input image first enters the convolutional layer, which evenly divides the entire image into several small feature maps, specifically 56×56×96. This generates 3136 small feature maps, each of which is flattened into a one-dimensional vector of length 96. Resizing is then performed to divide the feature maps into small windows. Each window size is 7, meaning each window consists of 49 small feature maps, for a total of 64 windows. In stage one, each window performs self-attention. After all 64 windows are simultaneously self-attentioned, they are resized to 56×56×96. After this calculation, the window shifting operation is performed, which rearranges the window divisions and re-divides them to correlate global image features. Due to the offset window size limit, this re-dividing of the windows changes the number and size of windows. The feature map is reshaped to maintain the same number of windows at 64. The resized windows are padded with zeros and reshaped to 7×7. Self-attention calculations are then performed for each window. After this calculation, the map is reshaped again to 56×56×96, thus entering stage two. Downsampling is first performed, uniformly downsampling the 56×56×96 feature map from top to bottom and left to right, reshaping it to 28×28×384. A convolution is then performed, resulting in 784 small feature maps of 28×28×192. Each feature map is flattened into a one-dimensional vector of length 192. As in stage one, the window division operation is performed, with each window size being 7, for a total of 16 windows. Each window first performs window self-attention, then resizes and enters the sliding window attention calculation. After resizing, it enters stage three. In stage three, it first continues downsampling, evenly sampling the 28×28×192 feature map. After resampling, it is resized to 14×14×384. This results in 196 small feature maps, each of which is flattened into a one-dimensional vector of length 384. The window is divided into 7 windows, for a total of 4 windows. After performing the window self-attention calculation on each window, it is resized and enters the sliding window attention calculation. After resizing, it enters stage four, performing downsampling, evenly sampling the 14×14×384 feature map, and resizing it to 7×7×768. This results in 49 small feature maps, each of which is flattened into a one-dimensional vector of length 768.The window size is still 7. At this time, there is a window. The sliding window attention calculation is no longer performed, and the window self-attention mechanism is no longer performed. Instead, the window deformable attention mechanism is performed, that is, formula (6)(7)(8)(9), and the final output is 7×7×768. Average pooling and flattening are performed to finally obtain a one-dimensional image feature vector of length 768. It is sent to the LSTM network and finally enters the fully connected layer to output global positioning information. The first positioning information output will be used as the initial value of the multi-sensor stage. The IMU information will be loosely coupled with the network positioning information to output the final trajectory information.
[0169] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.
[0170] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A Transformer-based global positioning method for autonomous commercial vehicles on structured roads. It is characterized in that The following steps are involved: Step 1: Image acquisition, image processing, and data set preparation: Collect image features of target city roads, including roads, lane lines, road markings, traffic lights, traffic signs, poles, sidewalks, buildings, and trees, and record the location information of each image; perform pixel preprocessing on the images, that is, reshape the original images into 513×513 size, and form the reshaped images into the data set for training and testing networks; Step 2: Network model establishment, including the following three parts: The first part of the network model is a model for perceiving road structure information. The DeepLabV3Plus semantic segmentation network is used to perform semantic segmentation on the resized original image. The defined categories include roads, lane lines, road markings, traffic lights, traffic signs, poles, sidewalks, buildings, and trees. Based on the original DeepLabV3Plus semantic segmentation network model, the attention module is introduced; That is, a PSA module is added after the ASPP module. The PSA module consists of channel attention and spatial attention, which increases the extraction of important information and improves the model's utilization of information. The second part of the network model is an image spatial feature extraction model, which extracts robust position feature information from the image and encodes these features through the Transformer variable self-attention mechanism; When faced with continuous similar scenes, the feature vectors of similar scene images perform cosine calculations on each other. When the cosine value is close to 0.5, the effectiveness of the feature extraction model can be proved; The overall architecture based on the Swin Transformer sliding window is adopted, the last fully connected layer is removed, and a 768-dimensional feature vector is output, which can be regarded as the feature vector of the image to be located; The third network model is a global posture prediction model, which uses the 768-dimensional feature vector output by the feature encoder as the input of the temporal network and predicts the vehicle's positioning information through the LSTM long short-term memory network. Step 3: Network model training: According to the key information model of the road detection, the image space feature extraction model and the global posture prediction model in step 2, separate training is performed respectively; the image data collected in step 1 is divided into a training set, a verification set and a test set in a ratio of 3:1:1; Step 4: Positioning of vehicle posture, including: The extended Kalman filter is used to integrate the IMU and network output positioning results to obtain the vehicle posture state variable: where x i ,y i , They are the vehicle position and heading angle in the two-dimensional plane respectively.
2. The Transformer-based global positioning method for structured road autonomous driving commercial vehicles according to claim 1, Features: The attention module in step 2 includes two parts: channel attention and spatial attention, where the channel attention weight is calculated as: A ch (X)=F SG [W zq1 ((σ 1 (W v (X))×F SM (σ 2 (W q (X))))] (1) Where σ 1 σ 2 represents 1×1 convolution, F SM represents the softmax function, W zq1 represents 1×1 convolution and LN layer, increasing the channel dimension from C / 2 to C, F SG Represents the sigmoid function; The spatial attention weight is calculated as: A sp (X)=F SG [σ 3 (F SM (σ 1 (F GP (W q (X))))×σ 2 (W v (X)))] (2) Where σ 1 σ 2 σ 3 represents 1×1 convolution, F SM represents the softmax function, F GP represents global pooling, F SG Represents the sigmoid function, which adopts a serial structure, that is, the feature map X first performs channel attention calculation and then spatial attention calculation.
3. The Transformer-based global positioning method for structured road autonomous driving commercial vehicles according to claim 2, Features: In step 2, Swin Transformer uses the self-attention mechanism, namely: q=xW q ,k=xW k ,v=xWv (3) from=Concat(from (1) ,...,With (m) )IN o (5) Where x is the feature vector matrix obtained by flattening the feature map generated by convolution of the original input image, m is the number of heads of the multi-head attention mechanism, σ(·) is the softmax function, d is the vector length, and z is (m) represents the output matrix of the mth attention head, q (m) , k (m) and v (m) They represent the query matrix, the matrix to be queried and the actual feature matrix generated by the feature graph respectively; W q , W k , W v Generate q (m) , k (m) , v (m) The weight matrix, W o is the multi-attention weight matrix, z is the final output feature vector matrix; The deformable attention mechanism is used to replace the self-attention mechanism to improve the operation rate. The image feature map consists of 2401 tokens, that is, a 49*49 rectangular token array. By learning a set of offsets, the tokens necessary for attention calculation are determined between the current token and the remaining tokens of the image, and attention calculation is performed on important points; the offsets are a set of two-dimensional vectors, pointing from the current token to the necessary token; Given an input feature map x∈R generated by an original image with length, width and channels H, W, C H×W×C , generate several location points First, give each point position information, that is, {(0,0),...(H G-1 ,W G-1 )}, then according to the grid shape H G ×W G , normalize all coordinates and determine the relative position, that is, (-1,-1) represents the upper left corner, and (+1,+1) represents the lower right corner; Offset: △p=q offset (q) (6) Where q is the query vector of the feature point to be currently performing the attention mechanism, q offset (·) is a lightweight convolutional neural network. The neural network consists of two convolutional modules with nonlinear activation. The query vector q generated by the feature map is input. The local features are first captured by a 5×5 deep convolution. Then, the GELU activation function and 1×1 convolution are used to obtain the two-dimensional offset, and then the deformable attention mechanism is obtained: In the formula, φ(;) is a bilinear interpolation function, which is used to obtain the feature points important to the current point. The query vector and actual feature vector of important feature points; Perform multi-head attention calculation on q, k, v to get the final result 4. The Transformer-based global positioning method for structured road autonomous driving commercial vehicles according to claim 3, Features: The feature vector is reshaped into a 4×192 matrix, and four LSTM networks are used to pass it to a fully connected layer for positioning prediction.
5. The Transformer-based global positioning method for structured road autonomous driving commercial vehicles according to claim 4, Features: For the DeepLabV3Plus network, 9 categories are defined, namely roads, lane lines, road markings, traffic lights, traffic signs, poles, sidewalks, buildings and trees; the original images are annotated using Labelme software, and the learning rate is set to l r is 0.01 and trained using GPU; For the Transformer feature encoder, a pre-trained model for classification tasks on the ImageNet dataset is used as the pre-trained model for this application; For the LSTM network, the camera pose is p and the loss function is defined as: loss(I)=(p-p*) 2 (10) Where p is the true pose and p* is the predicted pose.
6. The Transformer-based global positioning method for structured road autonomous driving commercial vehicles according to claim 5, It is characterized in that The step 4 is specifically as follows: Assume t i The estimated state X at time i Affected by system noise G i Drive, expressed in equation form: X i =A i,i-1 X i +W i-1 G i-1 (11) Among them A i,i-1 t i-1 Time to t i The transfer matrix at time, W i-1 is the system noise driving matrix; X i is GPS data, its value satisfies the linear relationship, and the measurement equation is: Z i = H i X i +V i (12) Among them, H i is the measurement matrix, V i To measure the noise sequence, in this system we have: Let Q i is the system noise sequence variance matrix, R i is the variance matrix of the measurement noise sequence, which is a non-negative definite matrix in this system; When the filter is initialized, the first frame of GPS position and coordinates, that is, the positioning information of the network prediction model, is taken as the initial value of the filter state Then the initial estimated mean square error matrix is: Where ed is the distance estimation noise, ey is the heading estimation noise; when the velocity information and gyroscope angular velocity information are updated, the prediction solution is obtained by dead reckoning, and the system noise variance matrix Q i for: The transfer matrix A from time i-1 to time i i,i-1 for: For W i-1 , when the vehicle turning angle is small at the previous and next moments, we have: When the vehicle posture angle is large at the current and next moments, there are: Where td is the distance the vehicle travels in the time period, and tr is the angle the vehicle turns in the time period, that is: td=v*dt,tr=w*dt (19) Then we get the prediction mean square error matrix: P i / i-1 =A i,i-1 *P i-1 *A T i,i-1 +W i *Q i-1 *W T i-1 (20) When the network model outputs the updated positioning information, the positioning result is fused with the current dead reckoning result; the measurement noise variance matrix is obtained according to the current network model: Calculate the filter gain K: K=P i / i-1 *H T i *(H i *P i / i-1 *H T i +R i ) (22) The final state is estimated to be: Y i =Z i -H i *X i / i-1 (23) X i =X i / i-1 +K*Y i (24) Finally, update the mean square error matrix P, E is a 3×3 identity matrix: P i =(E-K i *H i )*P i / i-1 (25) Final Output That is, the vehicle position and heading angle.
Citation Information
Patent Citations
Cross-view cross-modal image geographic positioning method based on cooperation of CNN and cross-layer interaction Transform
CN116310866A
Automatic driving vehicle behavior prediction method and system fusing complex network and graph Transformer
CN116853272A
Automatic driving method based on convolutional neural network and attention mechanism
CN117115770A
Vehicle track prediction method independent of map information
CN117493424A
Method and system for predicting surrounding vehicle behavior of automatic driving emergency rescue vehicle based on multi-intention guiding comparative learning
CN118193953A
Cited By
On-machine roughness prediction method and device in cylindrical grinding process
CN119260492A
A method and apparatus for in-process roughness prediction of an external cylindrical grinding process
CN119260492B
Dynamic SLAM removing method based on multiple sensors and polarized attention
CN119579902A
A dynamic SLAM method based on multi-sensor and polarization attention
CN119579902B
Visual inertia fusion navigation positioning method based on visual information selection
CN119783029A
