High-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision
By adding the attention mechanism and Transformer layer to the YOLOv5s model, combined with the depth information of the binocular camera and the DeepSORT algorithm, the problem of pedestrian positioning and tracking of the vehicle-mounted binocular vision system in complex environments is solved, and the accuracy of target detection and positioning is improved. degree and stability.
Patent Information
- Application Number
- CN202410627711.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2024-08-27
AI Technical Summary
Existing vehicle-mounted binocular vision systems have problems of missed detection and false detection when locating and tracking pedestrians in complex environments, and fail to fully utilize the potential of the binocular vision system, affecting the accuracy and stability of target detection and positioning.
By adding the attention mechanism and Transformer layer to the YOLOv5s model, combined with the depth information of the binocular camera, the three-dimensional coordinates of pedestrians in the camera coordinate system are calculated, and the DeepSORT algorithm is used for real-time tracking to improve the accuracy of target detection and positioning.
The accuracy of pedestrian detection and positioning is improved, and the real-time tracking ability of surrounding pedestrians is enhanced. The accuracy of model training is increased by approximately 4.2%, and the measurement distance error is reduced by approximately 6.2%.
Smart Images

Figure CN118552976A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of vehicle-mounted vision systems, and relates to a vehicle-mounted binocular vision system, and in particular to a high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision. Background Art
[0002] With the rapid development of automotive intelligent technology, vehicle-mounted binocular vision systems are increasingly used in the fields of vehicle safety and intelligent transportation.
[0003] Commonly used on-board pedestrian recognition uses deep learning models such as convolutional neural networks (CNN) to analyze and recognize images captured by on-board cameras to achieve fast and accurate detection of pedestrians and other targets. Commonly used deep learning models include YOLO (You Only Look Once) and Faster R-CNN (Region-based Convolutional Neural Networks).
[0004] In the case of moving pedestrians, the accuracy of monocular vision technology for identification and positioning is insufficient, and real-time pedestrian positioning in complex environments suffers from problems such as missed detection and false detection. Commonly used deep learning models may be limited by factors such as target scale, occlusion, and lighting changes during pedestrian detection and positioning, affecting their stability and reliability in practical applications. In addition, existing technologies have certain limitations in the integration of positioning and tracking algorithms when using binocular vision for pedestrian positioning, and fail to fully tap the potential of binocular vision systems. Summary of the invention
[0005] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision, so as to improve the accuracy of target detection and target positioning, improve the real-time tracking of surrounding pedestrians during driving, and timely detect position changes.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] A high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision comprises the following steps:
[0008] Step 1: Use the camera calibration tool in MATLAB to calibrate the black and white grid images collected by the binocular camera to obtain the internal and external parameters of the camera;
[0009] Step 2: Improve the YOLOv5s model by modifying the network layer and adding an attention mechanism to improve the detection accuracy and positioning accuracy of the model for pedestrian targets;
[0010] Step 3: Use the improved model to perform target detection on the binocular images collected in real time and identify pedestrian targets in the images;
[0011] Step 4: Using the depth information of the binocular camera and the position of the pedestrian target in the image, the three-dimensional coordinates of the pedestrian relative to the camera coordinate system are calculated to achieve real-time positioning of the pedestrian;
[0012] Step 5: Use the DeepSORT tracking algorithm to track pedestrian targets in real time, record the movement trajectory of pedestrian targets and update their status information.
[0013] The present invention also has the following technical features:
[0014] Preferably, the internal and external parameters of the camera described in step 1 include focal length, principal point coordinates, distortion parameters and baseline.
[0015] Preferably, the improvement to the YOLOv5s model described in step 2 includes:
[0016] S1 replaces the C3 module in the original Backbone network layer with the BottleneckCsp module;
[0017] S2 adds Transformer-based adaptive fusion attention mechanism TAF;
[0018] S3 uses the improved model training structure for model training.
[0019] Furthermore, the addition of the Transformer-based adaptive fusion attention mechanism TAF described in S2 includes the following steps:
[0020] 1) Encode the input image through a pre-trained convolutional neural network to obtain the feature representation of the image;
[0021] 2) Image features are mapped and extracted through a multi-layer Transformer module to capture global context information.
[0022] Furthermore, the Transformer layer consists of a self-attention mechanism and a feed-forward neural network.
[0023] Furthermore, the formula of the self-attention mechanism is:
[0024]
[0025] Where Q, K, V represent the query, key, and value matrices respectively, T represents the length of the input sequence, and d k is the dimension of the key.
[0026] Furthermore, the formula of the feedforward neural network is:
[0027] FFN(X)=ReLU(XW1+b1)W2+b2
[0028] Where W1, b1, W2, b2 are the learned weights and bias parameters, and X is the input sequence.
[0029] Preferably, the calculation process of the three-dimensional coordinates in step 4 includes:
[0030] S1 collects the depth information of the pedestrian target collected after target recognition, and calculates the depth information D of the target through the SGBM algorithm and the triangle similarity principle. The calculation formula is as follows:
[0031]
[0032] Where L is the baseline distance, H is the camera focal length, and d is the parallax of the left and right cameras;
[0033] S2 calculates the pixel coordinate information of the pedestrian center point through the coordinates of the pedestrian target detection frame. The calculation formula is as follows:
[0034]
[0035]
[0036] Among them, x left ,x right ,y top ,y bottom are the x and y coordinates of the upper left and lower right corners of the target detection box respectively;
[0037] S3 converts the pixel coordinate information of the target object into three-dimensional coordinates. The calculation formula is as follows:
[0038]
[0039]
[0040] Z=D
[0041] Where (c x ,c y ) is the pixel coordinate of the target, H is the focal length of the camera, and D is the depth information of the target, so the three-dimensional coordinates of the target object are (X, Y, Z).
[0042] Preferably, the method for real-time tracking of pedestrian targets using the DeepSORT tracking algorithm described in step 5 includes:
[0043] 1) Extract feature vectors from target detection boxes through convolutional neural networks (CNN);
[0044] 2) Input the target detection box and feature vector to establish the association between the target detected in the current frame and the historical trajectory, and then update the target's state information and ID;
[0045] 3) Output the updated target status and ID to achieve continuous tracking and identification of the target.
[0046] Preferably, in step five, the pedestrian target detection frame, confidence, three-dimensional coordinates, and ID information are drawn in real time in the binocular display image and presented through a visual display.
[0047] Compared with the prior art, the present invention has the following technical effects:
[0048] The present invention performs target recognition based on YOLOv5, improves the network structure of its model training structure YOLOv5s, adds target positioning and tracking functions, uses left and right perspective images obtained by a vehicle-mounted binocular camera, calculates depth information of objects in the image through stereo vision technology, thereby achieving accurate positioning and distance estimation of pedestrians, and combines binocular vision technology, YOLOv5 target detection model, Transformer attention mechanism and target tracking algorithm to improve the accuracy of target detection and target positioning, improve real-time tracking of surrounding pedestrians during driving, and timely discover position changes; compared with traditional pedestrian recognition methods, the model training accuracy is improved by about 4.2%, and the measurement distance error is reduced by about 6.2%. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is an overall flow chart of the high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision of the present invention;
[0050] Figure 2 It is the improved YOLOv5s network structure. DETAILED DESCRIPTION
[0051] The specific contents of the present invention are further explained in detail below in conjunction with embodiments.
[0052] Reference Figure 1 and Figure 2 This embodiment provides a high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision, including the following steps:
[0053] Step 1: Collect the black and white grid calibration plate photo data through the binocular camera, organize the data into a data set, import it into MATLAB, delete the data with large errors, calibrate the binocular camera to obtain the internal and external parameters of the camera, including focal length, principal point coordinates, distortion parameters and baseline, etc., to provide an accurate camera parameter basis for subsequent pedestrian positioning;
[0054] Step 2: Improve the YOLOv5s model by modifying the network layer and adding an attention mechanism to improve the detection accuracy and positioning accuracy of the model for pedestrian targets;
[0055] Improvements to the YOLOv5s model include:
[0056] S1 replaces the C3 module in the Backbone layer of YOLOv5s version 6.0 with the BottleneckCSP module of YOLOv5s version 2.0. This module has an additional Conv2d module for convolution operations compared to the C3 module, which can improve the accuracy of the target training process;
[0057] S2 adds Transformer-based adaptive fusion attention mechanism TAF (Transformer-based Adaptive Fusion), which has the characteristics of adaptive attention and hierarchical feature fusion; it includes the following steps:
[0058] 1) Encode the input image through a pre-trained convolutional neural network to obtain the feature representation of the image;
[0059] 2) The image features are mapped and extracted through a multi-layer Transformer module to capture global context information. The multi-layer Transformer module achieves multi-level abstraction and representation learning of image features by stacking multiple Transformer layers.
[0060] The Transformer layer consists of a self-attention mechanism and a feedforward neural network. The formula of the self-attention mechanism is:
[0061]
[0062] Where Q, K, V represent the query, key, and value matrices respectively, T represents the length of the input sequence, and d k is the dimension of the key.
[0063] The formula for a feedforward neural network is:
[0064] FFN(X)=ReLU(XW1+b1)W2+b2
[0065] Where W1, b1, W2, b2 are the learned weights and bias parameters, and X is the input sequence.
[0066] S3 uses the latest car-mounted pedestrian photos for model training, and the latest pedestrian detection dataset from Roboflow in 2024, including 5043 training sets and 456 test sets, totaling 5499 pictures and their labels, including pedestrian targets in different weather, lighting, and backgrounds. Through unsupervised learning training, a high-precision pedestrian detection model is trained to provide reliable support for subsequent target recognition.
[0067] Step 3: Input the images captured by the binocular camera in real time and input the images into the improved YOLOv5 network model for target detection to identify the position and posture information of the pedestrian targets in the image.
[0068] Step 4: Use the depth information of the binocular camera and the position mark of the pedestrian target in the image to collect depth information, calculate the three-dimensional coordinates of the pedestrian relative to the camera coordinate system, and realize the real-time positioning of the pedestrian;
[0069] The calculation process of three-dimensional coordinates includes:
[0070] S1 collects the depth information of the pedestrian target collected after target recognition, and calculates the depth information D of the target through the SGBM algorithm and the triangle similarity principle. The calculation formula is as follows:
[0071]
[0072] Where L is the baseline distance, H is the camera focal length, and d is the parallax of the left and right cameras;
[0073] S2 calculates the pixel coordinate information of the pedestrian center point through the coordinates of the pedestrian target detection frame. The calculation formula is as follows:
[0074]
[0075]
[0076] Among them, x left ,x right ,y top ,y bottom are the x and y coordinates of the upper left and lower right corners of the target detection box respectively;
[0077] S3 converts the pixel coordinate information of the target object into three-dimensional coordinates. The image size is 640×480. The image pixel coordinates obtained by the code are based on the upper left vertex as the origin, so the center coordinates of the image are (320,240). The calculation formula is as follows:
[0078]
[0079]
[0080] Z=D
[0081] Where (c z ,c y ) is the pixel coordinate of the target, H is the focal length of the camera, and D is the depth information of the target, so the three-dimensional coordinates of the target object are (X, Y, Z).
[0082] Step 5: Use the DeepSORT tracking algorithm to track pedestrian targets in real time, and extract feature vectors from the target detection frame through a convolutional neural network (CNN); input the target detection frame and feature vector to establish the association between the target detected in the current frame and the historical trajectory, and then update the target's status information and ID; output the updated target status and ID to achieve continuous tracking and identification of the target, record the motion trajectory of the pedestrian target, and update its status information.
[0083] The pedestrian target detection box, confidence, three-dimensional coordinates, and ID information are drawn in real time in the binocular display image and presented through a visual display.
Claims
1. A high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision, characterized in that: The following steps are involved: Step 1: Use the camera calibration tool in MATLAB to calibrate the black and white grid images collected by the binocular camera to obtain the internal and external parameters of the camera; Step 2: Improve the YOLOv5s model by modifying the network layer and adding an attention mechanism to improve the detection accuracy and positioning accuracy of the model for pedestrian targets; Step 3: Use the improved model to perform target detection on the binocular images collected in real time and identify pedestrian targets in the images; Step 4: Using the depth information of the binocular camera and the position of the pedestrian target in the image, the three-dimensional coordinates of the pedestrian relative to the camera coordinate system are calculated to achieve real-time positioning of the pedestrian; Step 5: Use the DeepSORT tracking algorithm to track pedestrian targets in real time, record the movement trajectory of pedestrian targets and update their status information.
2. The high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision as claimed in claim 1, characterized in that: The intrinsic and extrinsic parameters of the camera described in step 1 include focal length, principal point coordinates, distortion parameters and baseline.
3. The high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision as claimed in claim 1, characterized in that: The improvements to the YOLOv5s model described in step 2 include: S1 replaces the C3 module in the original Backbone network layer with the BottleneckCsp module; S2 adds Transformer-based adaptive fusion attention mechanism TAF; S3 uses the improved model training structure for model training.
4. The high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision as claimed in claim 3 is characterized in that: The addition of the Transformer-based adaptive fusion attention mechanism TAF described in S2 includes the following steps: 1) Encode the input image through a pre-trained convolutional neural network to obtain the feature representation of the image; 2) Image features are mapped and extracted through a multi-layer Transformer module to capture global context information.
5. The high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision as claimed in claim 4, characterized in that: The Transformer layer consists of a self-attention mechanism and a feed-forward neural network.
6. The high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision as claimed in claim 5, characterized in that: The formula of the self-attention mechanism is: Where Q, K, V represent the query, key, and value matrices respectively, T represents the length of the input sequence, and d k is the dimension of the key.
7. The high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision as claimed in claim 5, characterized in that: The formula of the feedforward neural network is: FFN(X)=ReLU(XW1+b1)W2+b2 Where W1, b1, W2, b2 are the learned weights and bias parameters, and X is the input sequence.
8. The high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision as claimed in claim 1, characterized in that: The calculation process of the three-dimensional coordinates described in step 4 includes: S1 collects the depth information of the pedestrian target collected after target recognition, and calculates the depth information D of the target through the SGBM algorithm and the triangle similarity principle. The calculation formula is as follows: Where L is the baseline distance, H is the camera focal length, and d is the parallax of the left and right cameras; S2 calculates the pixel coordinate information of the pedestrian center point through the coordinates of the pedestrian target detection frame. The calculation formula is as follows: Among them, x left ,x right ,y top ,y bottom are the x and y coordinates of the upper left and lower right corners of the target detection box respectively; S3 converts the pixel coordinate information of the target object into three-dimensional coordinates. The calculation formula is as follows: Z=D Where (c x ,c y ) is the pixel coordinate of the target, H is the focal length of the camera, and D is the depth information of the target, so the three-dimensional coordinates of the target object are (X, Y, Z).
9. The high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision as claimed in claim 1, characterized in that: The method for real-time tracking of pedestrian targets using the DeepSORT tracking algorithm described in step 5 includes: 1) Extract feature vectors from target detection boxes through convolutional neural networks (CNN); 2) Input the target detection box and feature vector to establish the association between the target detected in the current frame and the historical trajectory, and then update the target's state information and ID; 3) Output the updated target status and ID to achieve continuous tracking and identification of the target.
10. The high-precision pedestrian positioning and tracking method based on vehicle-mounted binocular vision as claimed in claim 1, characterized in that: In the step 5, the pedestrian target detection frame, confidence, three-dimensional coordinates, and ID information are drawn in real time in the binocular display image and presented through a visual display.
Citation Information
Patent Citations
Binocular camera ranging method based on Yolov5 and improved tracking algorithm
CN114494462A
PCB surface defect detection method based on improved Yolov5 algorithm
CN115546144A
Motorcycle helmet detection and tracking method based on improved YOLOv5DeepSORT algorithm
CN116645322A
Pedestrian target tracking method and application thereof
CN117911456A
Cited By
Real-time detection method and device for table tennis image target, computer equipment, storage medium and program product
CN121120708A
