Tunnel vehicle positioning and trajectory tracking method, device and system
By installing stereo cameras inside the tunnel to obtain the corner coordinates and direction cosine matrix of lane markings, and combining the SwinTransformer and ResNet models for vehicle detection and feature extraction, the problem of low accuracy in vehicle positioning and trajectory tracking inside the tunnel was solved, and high-precision vehicle position and trajectory determination was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CCCC SECOND HIGHWAY CONSULTANTS CO LTD
- Filing Date
- 2025-10-17
- Publication Date
- 2026-07-07
AI Technical Summary
The accuracy of vehicle positioning and trajectory tracking results in tunnels is low, especially in narrow spaces where the size of vehicle targets varies greatly and uneven lighting makes detection difficult. Furthermore, large trucks are prone to trajectory breakage and loss due to obstruction.
A stereo camera is used to acquire the coordinates of the corner points of the lane markings in the tunnel. The coordinates and direction cosine matrix of the stereo camera are determined to establish the monitoring field of view. The SwinTransformer model is used for vehicle detection, and the ResNet model is combined for feature extraction and continuity detection to determine the vehicle position and trajectory.
It improves the accuracy of vehicle positioning and trajectory tracking in tunnels, increases vehicle detection and matching density, reduces the impact of light interference, and avoids trajectory noise and matching errors.
Smart Images

Figure CN121504991B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent traffic monitoring technology, specifically to a method, device, and system for vehicle positioning and trajectory tracking in tunnels. Background Technology
[0002] Highway tunnels are an important component of highways. Due to their enclosed and narrow spatial characteristics, the safe operation and management of tunnels is both crucial and extremely challenging. In the event of accidents such as vehicle fires or collisions within a tunnel, rescue efforts are incredibly difficult. Therefore, strengthening tunnel safety operation and management is of paramount importance.
[0003] Timely detection of vehicles exhibiting abnormal behavior, such as continuous lane changes, illegal parking, and severe speeding, is a crucial aspect of tunnel safety operation and management. Currently, machine vision algorithms are commonly used for vehicle trajectory tracking and anomaly detection within tunnels. This method fully utilizes existing surveillance cameras installed in the tunnel, eliminating the need for additional sensors. Its technical process typically includes vehicle detection, vehicle feature extraction, continuous frame vehicle matching, and trajectory tracking. However, in practical applications, vehicle detection, identification, and tracking within tunnels still face the following difficulties and challenges:
[0004] The narrow space of the tunnel causes the target scale to shrink significantly when the vehicle moves from the close-up to the far-up view of the camera. The confidence level of the close-up detection is high, but that of the far-up detection is low. In addition, large trucks are prone to track breakage or loss due to obstruction, resulting in low accuracy of vehicle positioning and tracking results. Summary of the Invention
[0005] In view of this, it is necessary to provide a method, device and system for vehicle positioning and trajectory tracking in tunnels to solve the technical problem of low accuracy of vehicle positioning and trajectory tracking results in tunnels.
[0006] To address the aforementioned problems, in a first aspect, the present invention provides a method for vehicle positioning and trajectory tracking within a tunnel, comprising:
[0007] Obtain the coordinates of the corner points of lane markings inside the tunnel;
[0008] Based on the coordinates of the lane marking corner points, the coordinates and direction cosine matrix of the stereo cameras inside the tunnel are determined; wherein, multiple sets of stereo cameras are installed at equal intervals along the center line of the tunnel arch, and each set of stereo cameras includes a main camera and an auxiliary camera located on both sides of the center line of the tunnel arch.
[0009] The monitoring field of view of the stereo camera is determined based on the coordinate and direction cosine matrix of the stereo camera in the tunnel.
[0010] The images captured by the stereo camera within the monitoring field of view are obtained, and each frame of the image is input into the trained SwinTransformer model to obtain the vehicle detection results.
[0011] Based on the vehicle detection results from different frames of images, the vehicle's position and trajectory are determined.
[0012] In one possible implementation, obtaining the coordinates of the corner points of the lane markings within the tunnel includes:
[0013] Obtain the coordinates of the tunnel entrance arch base collected by the GNSS system;
[0014] Based on the coordinates of the tunnel entrance and exit arch bottom, the coordinates of the lane marking corner points inside the tunnel are measured using the forward intersection method.
[0015] In one possible implementation, the coordinates and orientation cosine matrix of the stereo camera inside the tunnel are determined based on the coordinates of the lane marking corner points, including:
[0016] Based on the coordinates of the lane marking corner points and the collinearity between adjacent groups of stereo cameras, the coordinates and direction cosine matrix of the stereo cameras inside the tunnel are determined.
[0017] In one possible implementation, the coordinates and orientation cosine matrix of the stereo camera inside the tunnel are obtained based on the following formula:
[0018]
[0019] in, These are the coordinates of the lane marking corner points on the image captured by the stereo camera. f The focal length of the stereo camera. The coordinates of the feature points within the field of view of the stereo camera. Let be the cosine matrix of the stereo camera orientation to be solved. Let be the coordinates of the stereo camera to be solved.
[0020] In one possible implementation, the monitoring field of view of the stereo camera is determined based on the coordinate and orientation cosine matrix of the stereo camera inside the tunnel, including:
[0021] Determine the front edge of the monitoring field of view of the stereo camera when the pixel width of the lane line in the video image captured by the stereo camera shrinks to the target width.
[0022] Determine the rear edge of the 3D camera's field of view at the target distance in front of the 3D camera;
[0023] Based on the coordinates and direction cosine matrix of the stereo camera inside the tunnel, the endpoint coordinates of the front and rear lines are determined. Based on the endpoint coordinates of the front and rear lines, the monitoring field of view of the stereo camera is determined.
[0024] In one possible implementation, each frame of image is input into the trained Swin Transformer model to obtain vehicle detection results, including:
[0025] Each frame of image is input into the trained Swing Transformer model. In the window attention module of the Swing Transformer model, the image is segmented according to the illumination intensity to obtain different regions.
[0026] Different weights are assigned to different regions to form a light intensity mask;
[0027] The vehicle detection result is obtained by multiplying the illumination intensity mask element by element with the attention weight matrix.
[0028] In one possible implementation, the different areas include: a high-light area, a low-light area, and a normal area;
[0029] The window size of the high-light area is smaller than the window size of the normal area, and the window size of the normal area is smaller than the window size of the low-light area.
[0030] In one possible implementation, the vehicle detection result is a vehicle detection box;
[0031] Based on vehicle detection results from different frames of images, the vehicle's position and trajectory are determined, including:
[0032] Each vehicle detection box is input into the trained ResNet model to obtain the vehicle's feature vector.
[0033] The distance between the feature vectors of vehicles in adjacent frame images is determined, and the continuity detection result of the vehicles is determined based on the distance; the continuity detection result includes the identification result of whether the vehicles in adjacent frame images are the same vehicle;
[0034] Based on the continuous detection results, the vehicle's position and trajectory are determined.
[0035] Secondly, the present invention also provides a vehicle positioning and trajectory tracking device in a tunnel, comprising:
[0036] The acquisition module is used to obtain the coordinates of the corner points of lane markings inside the tunnel;
[0037] The coordinate calculation module is used to determine the coordinates and direction cosine matrix of the stereo cameras in the tunnel based on the coordinates of the lane marking corner points; wherein, multiple sets of stereo cameras are installed at equal intervals along the center line of the tunnel arch, and each set of stereo cameras includes a main camera and an auxiliary camera located on both sides of the center line of the tunnel arch.
[0038] The field of view determination module is used to determine the monitoring field of view of the stereo camera based on the coordinates and orientation cosine matrix of the stereo camera in the tunnel.
[0039] The vehicle detection module is used to acquire images captured by the stereo camera within the monitoring field of view. Each frame of the image is input into the trained Swing Transformer model to obtain the vehicle detection results.
[0040] The positioning and tracking module is used to determine the vehicle's position and trajectory based on the vehicle detection results from different frame images.
[0041] Thirdly, the present invention also provides a vehicle positioning and trajectory tracking system in a tunnel, including an electronic device for performing any of the methods described above, and multiple sets of stereo cameras communicatively connected to the electronic device; the multiple sets of stereo cameras are installed at equal intervals along the center line of the tunnel arch, and each set of stereo cameras includes a main camera and an auxiliary camera located on both sides of the center line of the tunnel arch.
[0042] The beneficial effects of the above implementation are as follows: The vehicle positioning and trajectory tracking method, device, and system provided by this invention obtain the coordinates of lane marking corner points in the tunnel; determine the monitoring field of view of the stereo camera through the coordinates and direction cosine matrix of the stereo camera in the tunnel, and obtain the images captured by the stereo camera within the monitoring field of view. Input each frame of image into the trained Swin Transformer model to obtain the vehicle detection result; determine the vehicle's position and trajectory based on the vehicle detection results of different frames of images. Addressing the problem of dynamic changes in target size in tunnel video images, this invention extracts vehicle features frame by frame from the detected images using the Swin Transformer model, forming a frame-by-frame feature vector space for the vehicle. Matching the vehicle feature vectors detected in each frame determines the vehicle tracking result, increasing the vehicle detection and matching density, and significantly improving the accuracy of vehicle tracking, thereby solving the technical problem of low accuracy in vehicle positioning and trajectory tracking results in tunnels. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 A flowchart of an embodiment of the vehicle positioning and trajectory tracking method in a tunnel provided by the present invention;
[0045] Figure 2 A flowchart of another embodiment of the vehicle positioning and trajectory tracking method in a tunnel provided by the present invention;
[0046] Figure 3 This is a schematic diagram of the measurement of feature point coordinates inside a tunnel provided by the present invention;
[0047] Figure 4 This is a schematic diagram of the camera installation location provided by the present invention;
[0048] Figure 5 This is a schematic diagram of the camera monitoring field of view provided by the present invention;
[0049] Figure 6 A schematic diagram of an embodiment of the vehicle positioning and trajectory tracking device in a tunnel provided by the present invention;
[0050] Figure 7 A schematic diagram of an embodiment of the electronic device provided by the present invention. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0052] In the description of the embodiments of this application, unless otherwise stated, "a plurality of" means two or more.
[0053] In this embodiment of the invention, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, apparatus, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules that are explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to such process, method, product or device.
[0054] The naming or numbering of steps in the embodiments of the present invention does not mean that the steps in the method flow must be executed in the time / logical order indicated by the naming or numbering. The execution order of the named or numbered process steps can be changed according to the technical purpose to be achieved, as long as the same or similar technical effect can be achieved.
[0055] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0056] This invention provides a method, device, and system for vehicle positioning and trajectory tracking in tunnels, which will be described below.
[0057] like Figure 1 As shown, this invention provides a method for vehicle positioning and trajectory tracking within a tunnel. This method can be implemented by executing an application on a terminal or server. The terminal can be a computer, and the server can be an edge server or a cloud server. The method includes:
[0058] S101. Obtain the coordinates of the corner points of the lane markings inside the tunnel.
[0059] Understandably, the coordinates of the corner points of the lane markings inside the tunnel can be used as feature points, and these feature points can be used as reference benchmarks for subsequent vehicle positioning.
[0060] S102. Based on the coordinates of the lane marking corner points, determine the coordinates and direction cosine matrix of the stereo cameras inside the tunnel; wherein, multiple sets of stereo cameras are installed at equal intervals along the center line of the tunnel arch, and each set of stereo cameras includes a main camera and an auxiliary camera located on both sides of the center line of the tunnel arch.
[0061] Understandably, all the stereo cameras are connected to the monitoring system host via data cables. The stereo cameras transmit the images they capture to the monitoring system host, forming a complete vehicle positioning and trajectory tracking system within the tunnel.
[0062] Stereo cameras are installed along the direction of travel in the tunnel. A set of stereo cameras is installed at the center of the tunnel arch every 200 meters, with the stereo cameras facing the direction of travel of the vehicles inside the tunnel.
[0063] S103. Based on the coordinates and direction cosine matrix of the stereo camera inside the tunnel, determine the monitoring field of view of the stereo camera.
[0064] Understandably, because cameras use perspective projection, vehicles appear significantly larger when closer and smaller when farther away within tunnels. Furthermore, the complex lighting conditions inside tunnels result in highly complex vehicle representations in video images. In addition, the number of continuously captured video images is enormous. To reduce data processing load, this invention establishes a monitoring field of view for each stereo camera based on the pixel width of lane lines in the video image. Only vehicles entering the monitoring field of view of the stereo camera are detected, tracked, and located.
[0065] S104. Acquire images captured by the stereo camera within the monitoring field of view, input each frame of image into the trained Swing Transformer model, and obtain vehicle detection results.
[0066] Understandably, the Swin Transformer is a visual Transformer model that effectively reduces the computational complexity of high-resolution image processing by introducing a sliding window mechanism and a hierarchical structure. For each frame, an improved Swin Transformer detection model is used to detect vehicles, and the ResNet-101-IBN neural network model is used to extract high-dimensional feature vectors of the detected vehicles. ResNet (Residual Neural Network) is a convolutional neural network architecture that solves the training difficulties of deep networks by introducing residual learning. For the high-dimensional feature vector of a vehicle detected in the next frame, its distance to the high-dimensional feature vector of a vehicle detected in the previous frame is calculated. Vehicles with a distance greater than a threshold are considered to be the same vehicle, thus achieving continuous vehicle detection.
[0067] S105. Based on the vehicle detection results of different frame images, determine the vehicle's position and motion trajectory.
[0068] Understandably, by determining the position of the same vehicle at different times based on the vehicle detection results of different frames, the vehicle's trajectory can be determined.
[0069] This invention makes a series of improvements and innovations to the method of vehicle positioning and trajectory tracking in tunnels:
[0070] To address the issue of dynamically changing target sizes in video images within tunnels, this invention extracts features from vehicles detected frame by frame, forming a frame-by-frame feature vector space for each vehicle. The feature vector of each detected vehicle is matched against the global feature vector space, and the optimal match is used as the vehicle tracking result. This increases the vehicle detection and matching density, significantly improving vehicle tracking accuracy.
[0071] To address the issue of lighting interference within tunnels, this invention employs an improved Swing Transformer detection model. Based on the light intensity in the image, it dynamically adjusts the window size and attention weight allocation to reduce the impact of lighting.
[0072] A monitoring system is built in the tunnel using stereo cameras, and the coordinates and direction cosine matrix of the stereo cameras are calculated to establish the monitoring field of view of each stereo camera. In order to address the camera field of view problem, this invention establishes the monitoring field of view of each camera and clearly calculates the coordinate range of the monitoring field of view.
[0073] To address trajectory noise and matching errors, this invention employs a frame-by-frame detection, feature extraction, and re-identification strategy, which significantly increases the detection density and greatly reduces vehicle matching errors.
[0074] In some embodiments, obtaining the coordinates of lane marking corner points within a tunnel includes:
[0075] Obtain the coordinates of the tunnel entrance and exit arch bottom collected by the GNSS system (Global Navigation Satellite System);
[0076] Based on the coordinates of the tunnel entrance and exit arch bottom, the coordinates of the lane marking corner points inside the tunnel are measured using the forward intersection method.
[0077] Understandably, in order to unify the coordinate system inside the tunnel with the vehicle positioning coordinate system outside the tunnel, the coordinates of four points at the bottom of the tunnel entrance and exit arches are measured using GNSS measurement methods. Based on these four coordinates, the coordinates of the corner points of the lane markings inside the tunnel are measured using a total station with the forward intersection method.
[0078] In some embodiments, determining the coordinates and direction cosine matrix of the stereo camera inside the tunnel based on the coordinates of the lane marking corner points includes:
[0079] Based on the coordinates of the lane marking corner points and the collinearity between adjacent groups of stereo cameras, the coordinates and direction cosine matrix of the stereo cameras inside the tunnel are determined.
[0080] The coordinates and direction cosine matrix of the stereo camera inside the tunnel are obtained based on the following formula:
[0081]
[0082] in, These are the coordinates of the lane marking corner points on the image captured by the stereo camera. f The focal length of the stereo camera. The coordinates of the feature points within the field of view of the stereo camera. Let be the cosine matrix of the stereo camera orientation to be solved. Let be the coordinates of the stereo camera to be solved.
[0083] As is understandable, each group of stereo cameras consists of two cameras. The camera located on the left side of the arch is the main camera, responsible for vehicle detection, tracking, and positioning. The camera on the right side is the auxiliary camera, assisting in vehicle positioning. Each group of stereo cameras is numbered as follows: ,in Main camera number, For auxiliary camera numbering, n is the camera group number.
[0084] The spatial position and orientation of each camera are calculated using the coordinates of feature points within the field of view of each camera, as shown in the formula above.
[0085] Select at least four feature points within the field of view of each camera in turn, and measure the pixel coordinates of the feature points on the image captured by the camera. Substitute these coordinates into the collinearity equation to solve for the installation coordinates and direction cosine matrix of each camera in the stereo camera.
[0086] In some embodiments, the monitoring field of view of the stereo camera is determined based on the coordinate and orientation cosine matrix of the stereo camera inside the tunnel, including:
[0087] Determine the front edge of the stereo camera's monitoring field of view when the pixel width of the lane line in the video image captured by the stereo camera shrinks to the target width.
[0088] Determine the rear edge of the 3D camera's field of view at the target distance in front of the 3D camera;
[0089] Based on the coordinates and direction cosine matrix of the stereo camera inside the tunnel, the endpoint coordinates of the front and rear lines are determined. Based on the endpoint coordinates of the front and rear lines, the monitoring field of view of the stereo camera is determined.
[0090] Understandably, when a vehicle is far from the camera, it appears small within the camera's field of view, making it difficult to identify vehicle features and resulting in significant vehicle detection and tracking errors. Furthermore, the continuous recording of video images by the camera leads to a large overall data volume; processing the entire video image would result in excessive data processing. Based on these two reasons, this invention establishes a monitoring field of view for each group of stereo cameras, detecting and tracking only vehicles within that field of view.
[0091] In some embodiments, determining the endpoint coordinates of the front and rear edges based on the coordinates and direction cosine matrix of the stereo camera inside the tunnel includes:
[0092] Based on the coordinates and direction cosine matrix of the stereo camera inside the tunnel, the coordinates of the endpoints of the front and rear lines are determined by photogrammetric forward intersection method.
[0093] Understandably, the current edge line v1 v 2. When the video image captured by the stereo camera is shrunk to a width of 100 pixels, take the value at this point. v 1 v 2 represents the position of the front edge. This position is measured in the images captured by the two cameras of the stereo camera. v 1. v The pixel coordinates of two points are used to calculate the installation coordinates and orientation cosine matrix of each camera in the stereo camera system. This matrix can then be obtained using the photogrammetric forward intersection method. v 1. v 2. The coordinates of the two points.
[0094] Then determine the back edge of the 3D camera's monitoring field of view. v 3 v 4. Mark a point 1m in front of the stereo camera. v 3 v 4. Measure the images captured by the two cameras of the stereo camera at this time. v 3. v 4. By calculating the pixel coordinates of two points, the installation coordinates and orientation cosine matrix of each camera in the stereo camera are obtained. The photogrammetric forward intersection method can then be used to obtain... v 3. v 4. The coordinates of the two points.
[0095] In some embodiments, each frame of image is input into the trained Swing Transformer model to obtain vehicle detection results, including:
[0096] Each frame of image is input into the trained Swing Transformer model. In the window attention module of the Swing Transformer model, the image is segmented according to the illumination intensity to obtain different regions.
[0097] Different weights are assigned to different regions to form a light intensity mask;
[0098] The vehicle detection result is obtained by multiplying the illumination intensity mask element by element with the attention weight matrix.
[0099] The different areas include: strong light area, weak light area and normal light area;
[0100] The window size of the high-light area is smaller than the window size of the normal area, and the window size of the normal area is smaller than the window size of the low-light area.
[0101] Understandably, to address the challenge of vehicle detection caused by extremely uneven lighting distribution within tunnels, this invention employs an improved Swin Transformer detection model. In the Swin Transformer's window attention module, the image is segmented based on lighting intensity, and the window size and attention weights are dynamically adjusted. Based on the brightness values of image pixels, thresholds are set: brightness greater than 200 indicates a strong light area, brightness less than 50 indicates a weak light area, and brightness between 50 and 200 indicates a normal light area. This method segments the image into strong light, weak light, and normal light areas.
[0102] For areas with strong light, the window size is reduced from 7×7 to 5×5 to reduce the interference of glare pixels on attention; for areas with weak light, the window size is increased from 7×7 to 9×9 to enhance the ability to aggregate weak features.
[0103] Based on the image segmentation results, the pixel weights of the bright areas are set to 0.7, the weights of the dim areas to 1.3, and the weights of the normal areas to 1, forming an illumination intensity mask. The illumination intensity mask is then multiplied element-wise with the attention weight matrix to suppress the weights of the bright areas and increase the weights of the dim areas.
[0104] In some embodiments, the vehicle detection result is a vehicle detection frame;
[0105] Based on vehicle detection results from different frames of images, the vehicle's position and trajectory are determined, including:
[0106] Each vehicle detection box is input into the trained ResNet model to obtain the vehicle's feature vector.
[0107] The distance between the feature vectors of vehicles in adjacent frame images is determined, and the continuity detection result of the vehicles is determined based on the distance; the continuity detection result includes the identification result of whether the vehicles in adjacent frame images are the same vehicle;
[0108] Based on the continuous detection results, the vehicle's position and trajectory are determined.
[0109] Understandably, for each vehicle detection box extracted after vehicle detection, the image within the detection box is input into the neural network model ResNet-101-IBN. After passing through convolutional layers and pooling layers, a 2048-dimensional average feature vector is obtained, which serves as the feature vector of the currently detected vehicle.
[0110] This invention aims to provide a machine vision-based method for vehicle localization and trajectory tracking within tunnels, the method comprising:
[0111] To unify the coordinate system inside the tunnel with the vehicle positioning coordinate system outside the tunnel, the coordinates of four points at the bottom of the tunnel entrance and exit arches were measured using GNSS measurement methods. Based on these four coordinates, the coordinates of the corner points of the lane markings inside the tunnel were measured using a total station with the forward intersection method.
[0112] To achieve vehicle positioning and tracking within tunnels, this invention employs machine vision technology, deploying stereo cameras as monitoring devices within the tunnel. All stereo cameras are connected to the monitoring system host via data cables, forming a complete vehicle positioning and trajectory tracking system within the tunnel.
[0113] To obtain the coordinates of the stereo camera inside the tunnel, the coordinates and direction cosine matrix of the stereo camera were calculated using the coordinates of the corner points of the lane markings inside the tunnel and the photogrammetric resection method.
[0114] Because cameras use perspective projection, vehicles appear significantly larger when closer and smaller when farther away inside tunnels. Furthermore, the complex lighting conditions within tunnels result in highly complex vehicle representations in video images. In addition, the number of continuously captured video images is enormous. To reduce data processing load, this invention establishes a monitoring field of view for each stereo camera based on the pixel width of lane lines in the video image. Only vehicles entering the monitoring field of view of a stereo camera are detected, tracked, and located.
[0115] Because vehicles move continuously within tunnels, the stereo cameras capable of detecting the same vehicle constantly change. To achieve continuous vehicle tracking throughout the tunnel, this invention proposes a vehicle localization and trajectory tracking method encompassing detection, feature extraction, re-identification, and cross-camera association. For each image frame, an improved Swin Transformer detection model is used to detect vehicles, and a ResNet-101-IBN neural network model is used to extract high-dimensional feature vectors of the detected vehicles. For the high-dimensional feature vectors of vehicles detected in the next image frame, the distance between them and the high-dimensional feature vectors of vehicles detected in the previous image frame is calculated. Vehicles with a distance greater than a threshold are considered the same vehicle, achieving continuous vehicle detection. Vehicle localization is achieved using a stereo camera and forward intersection. Finally, the vehicle's coordinates are used to calculate its speed, achieving cross-camera association.
[0116] In some embodiments, such as Figure 2 As shown, the method provided by this invention includes the following steps:
[0117] Step S201: Measurement of the coordinates of feature points inside the tunnel.
[0118] As attached Figure 3 As shown, the coordinates of points A, B, C, and D at the tunnel inlet and outlet arch bottoms were first measured using the GNSS RTK (Real-Time Kinematic) measurement method.
[0119] The corner points of the road lane lines inside the tunnel were selected as feature points and marked. The coordinates of the feature points were then measured sequentially using a total station and the forward intersection measurement method.
[0120] To avoid excessive cumulative measurement errors, the coordinates of feature points between the tunnel entrance and the midpoint are measured using points A and B as references, while the coordinates of feature points between the midpoint and the tunnel exit are measured using points C and D as references.
[0121] Step S202: Deployment and initialization of the vehicle monitoring system in the tunnel.
[0122] Stereo cameras will be installed along the tunnel's direction of travel, with one set of cameras installed every 200 meters at the center of the tunnel arch. The camera installation locations are shown in the appendix. Figure 4 The stereo camera is pointed directly at the direction of the vehicle's travel inside the tunnel. Let the camera's focal length be . f The camera pixel size is μ .
[0123] Each stereo camera group consists of two cameras. The camera located on the left side of the arch is the main camera, responsible for vehicle detection, tracking, and positioning. The camera on the right side is the auxiliary camera, assisting in vehicle positioning. Each stereo camera group is connected to the central server via a data cable. Each stereo camera group is numbered as follows: ,in Main camera number, For auxiliary camera numbering, n is the camera group number.
[0124] The spatial position and orientation of each camera are calculated using the coordinates of feature points within the field of view of each camera. The calculation method is as follows:
[0125] ① Based on the collinearity relationship, the collinearity equation can be written:
[0126]
[0127] ②Among them The coordinates of the feature points on the image captured by the camera. f For the camera's focal length, The coordinates of the feature points within the field of view of the stereo camera. Let be the camera orientation cosine matrix to be solved. Install coordinates for the camera to be solved.
[0128] Select at least four feature points within the field of view of each camera in turn, and measure the pixel coordinates of the feature points on the image captured by the camera. Substitute these coordinates into the collinearity equation to solve for the installation coordinates and direction cosine matrix of each camera in the stereo camera.
[0129] Step S203: Establish the monitoring field of view for the stereo camera.
[0130] When a vehicle is far from the camera, it appears small within the camera's field of view, making it difficult to identify vehicle features and resulting in significant vehicle detection and tracking errors. Furthermore, the camera continuously captures video images, leading to a large overall data volume. Processing the entire video image would result in excessive data processing. For these two reasons, this invention establishes a monitoring field of view for each group of stereo cameras, detecting and tracking only vehicles within that field of view. This invention provides a method for establishing the monitoring field of view of a stereo camera using a one-way two-lane highway tunnel as an example, as shown in the appendix. Figure 5 As shown.
[0131] ① v 1 v 2 v 3 v 4 is a stereo camera C 1. Surveillance field of view, v 1 v 2 is a stereo camera C 1. The front edge of the monitoring field of view. v 3 v 4 is a stereo camera C 1. The rear edge of the monitoring field of view. r 1 is v 1 v The midpoint of 2, r 2 is v 3 v The midpoint of 4.
[0132] ② First, determine the stereo camera. C 1. Front edge of the monitoring field of view v 1 v 2. v 1 r 1 represents the standard driving lane width of a highway tunnel. v 1 r 1 = 3.75m v 1 v 2 = 7.5m. Due to perspective projection, the lane will appear to narrow in the image along the direction the camera is shooting.
[0133] when v 1 v 2. In stereoscopic cameras C When the captured video image is shrunk to 100 pixels wide, take the width at that point. v 1 v 2 represents the front edge position. (In a stereo camera) C 1. Measurement of the images captured by the two cameras at this time v 1. vThe pixel coordinates of the two points are obtained by calculating the installation coordinates and orientation cosine matrix of each camera in the stereo camera in step S202, and then using the photogrammetric forward intersection method to obtain the pixel coordinates of the two points. v 1. v 2. The coordinates of the two points.
[0134] ③Then determine the stereo camera C 1. Rear edge of the monitoring field of view v 3 v 4. In a stereoscopic camera C 1. Mark out 1m ahead v 3 v 4. In a stereoscopic camera C 1. Measurement of the images captured by the two cameras at this time v 3. v The pixel coordinates of the four points are obtained by calculating the installation coordinates and orientation cosine matrix of each camera in the stereo camera system in step S202, and then using the photogrammetric forward intersection method to obtain the pixel coordinates of the two points. v 3. v 4. The coordinates of the two points.
[0135] ④ Use the same method to determine the stereo camera C 2 monitoring field of view v 5 v 6 v 7 v 8.
[0136] ⑤ Note v 5 v 6 v 3 v 4 are stereo cameras C 1. C 2 overlapping fields of view.
[0137] ⑥ Determine the monitoring field of view and overlapping field of view of all stereo cameras installed in the tunnel based on the above method.
[0138] Step S204: Vehicle detection, feature extraction, re-identification, and cross-camera association.
[0139] Due to the influence of lighting conditions, occlusion, and camera shooting angles within the tunnel, the appearance of vehicles traveling at different times varies significantly in video images. To achieve continuous vehicle tracking, this invention employs a cyclical strategy of detection, feature extraction, re-identification, and cross-camera association. The specific implementation method is as follows:
[0140] ①Remember the stereo camera C The main camera of 1 at the current moment t The video images captured are p 1_1_1 The next frame of the video image is at time [time].t The video images captured by 2 are p 1_1_2 The video images captured at subsequent moments are p 1_1_n A record of a stereoscopic camera. C The auxiliary camera of 1 at the current moment t The video images captured are p 1_2_1 The next frame of the video image is at time [time]. t The video images captured by 2 are p 1_2_2 The video images captured at subsequent moments are p 1_2_n .
[0141] ②For stereo cameras C 1's main camera C 1_1 At any moment t 1. Video images captured p 1_1_1 Conduct vehicle inspections.
[0142] To address the challenge of vehicle detection caused by extremely uneven lighting distribution within tunnels, this invention employs an improved SwingTransformer detection model. In the SwingTransformer's window attention module, the image is segmented based on lighting intensity, and the window size and attention weights are dynamically adjusted. Based on the brightness values of image pixels, thresholds are set: brightness values greater than 200 represent strong light areas, brightness values less than 50 represent weak light areas, and brightness values between 50 and 200 represent normal light areas. This method segments the image into strong light areas, weak light areas, and normal light areas.
[0143] For areas with strong light, the window size is reduced from 7×7 to 5×5 to reduce the interference of glare pixels on attention; for areas with weak light, the window size is increased from 7×7 to 9×9 to enhance the ability to aggregate weak features.
[0144] Based on the image segmentation results, the pixel weights of the bright areas are set to 0.7, the weights of the dim areas to 1.3, and the weights of the normal areas to 1, forming an illumination intensity mask. The illumination intensity mask is then multiplied element-wise with the attention weight matrix to suppress the weights of the bright areas and increase the weights of the dim areas.
[0145] Based on the improved Swing Transformer detection model, vehicle detection is performed on each frame of the main camera in the stereo camera, resulting in vehicle detection bounding boxes. (Video images are then recorded.) p 1_1_1 A total of 100,000 samples were detected. n 1_1 One vehicle.
[0146] ③ For stereo cameras C 1's main camera C 1_1 At any moment t 1. Video images captured p 1_1_1 Detected n 1_1 Feature extraction was performed on each vehicle.
[0147] For each vehicle detection bounding box extracted after vehicle detection, the image within the bounding box is input into the ResNet-101-IBN neural network model. After passing through convolutional and pooling layers, a 2048-dimensional average feature vector is obtained, which serves as the feature vector for the currently detected vehicle. (Video image) p 1_1_1 Total detection n 1_1 One vehicle can get n 1_1 A 2048-dimensional average eigenvector.
[0148] ④ For stereo cameras C 1 main camera C 1_1 At any moment t 1. Video images captured p 1_1_1 Detected p 1_1_1 The vehicle was located.
[0149] For stereo cameras C 1 main camera C 1_1 Video images captured p 1_1_1 For each detected vehicle bounding box, the SIFT matching algorithm is used on the auxiliary camera. C 1_2 Video images captured p 1_2_1 Image matching is performed by the main camera. C 1_1 Auxiliary cameras C 1_2 The coordinates and direction cosine matrix of the target vehicle, along with the matched corresponding points, are used. The coordinates of the matched corresponding points are calculated using the forward intersection method, and the average of these coordinates is taken as the coordinates of the currently detected vehicle within the tunnel. Based on this method, vehicle positioning is achieved.
[0150] ⑤ Re-identification of detected vehicles.
[0151] To achieve continuous vehicle recognition in continuous video images, the present invention employs the following method:
[0152] For stereo camerasC 1's main camera C 1_1 At any moment t 2. Video images captured p 1_1_2 Vehicle detection, feature extraction, and localization are performed according to the methods described in steps S204: ②, ③, and ④.
[0153] Time t 2. Extracted vehicle feature vectors and time intervals t 1. Calculate the correlation of the extracted feature vectors and sort them according to the correlation. The ones with the highest correlation and a correlation greater than 95% are identified as the same vehicle.
[0154] If no candidate vehicle with a correlation greater than 95% is found, then the time is considered to be... t One inspection vehicle at the time t 2. Tracking lost; at this time, the tracked vehicle is stored at the time of the lost tracking. t 1. Eigenvectors. If in subsequent time steps t n The extracted vehicle feature vector and the missing vehicle at time [time value missing] t If the correlation of the feature vectors of vehicle 1 satisfies the condition that the correlation is at its maximum and greater than 95%, then the lost vehicle is considered to have been re-tracked.
[0155] Based on the above methods, stereo cameras C 1's main camera C 1_1 At any moment t 3. Video images captured p 1_1_3 Perform vehicle detection, feature extraction, and localization according to the methods described in steps S204: ②, ③, and ④, and compare the results with the time. t 2. By performing correlation calculations on the extracted vehicle feature vectors, the time-series data can be obtained. t 3. Time t 2. Continuous identification of detected vehicles.
[0156] Storage time t 1. t 2. t 3…… t n The feature vector of the detected vehicle. If the same vehicle is at time... t 1. t 2. t 3…… t n If all of them are detected consecutively, a total of n 2048-dimensional feature vectors of the vehicle can be obtained, which constitute the feature vector space of the vehicle.
[0157] By repeating the methods described in steps S204: ②, ③, ④, and ⑤, continuous detection, localization, and tracking of vehicles in video images can be achieved.
[0158] ⑥ Calculation of vehicle speed.
[0159] According to time t 1. Time t 2. Detect the vehicle's coordinates, calculate the distance the vehicle traveled at two different times, and divide by the time difference to obtain the vehicle's speed.
[0160] ⑦ Detect cross-camera associations for vehicles.
[0161] According to the vehicle at the time t n Based on the positioning coordinates and the monitoring field of view of the stereo camera established in step 3, determine which stereo camera's monitoring field of view the vehicle is in.
[0162] If the vehicle is in the stereo camera C Within the monitoring field of view of 2, only stereo cameras are used. C 2. The video images captured are used to detect the vehicle, extract its features, and continuously update the vehicle's feature vector space.
[0163] If the vehicle is in the stereo camera C 1. C Within the overlapping monitoring field of view of 2, stereo cameras are used simultaneously. C 1. C 2. The video images captured are used to detect the vehicle, extract its features, and continuously update the vehicle's feature vector space.
[0164] If the vehicle's coordinates are detected to be less than 1 meter from the rear edge of the last stereo camera in the tunnel, it is determined that the vehicle has left the tunnel, and the vehicle's feature vector space is deleted.
[0165] In summary, this invention discloses a vehicle localization and trajectory tracking system and method in a tunnel based on machine vision. First, the coordinates of several feature points within the tunnel are measured to unify the coordinate systems inside and outside the tunnel. Then, by deploying stereo cameras, the coordinates and orientation cosine matrices of the stereo cameras are solved to establish their monitoring field of view, thus completing the construction of the vehicle localization and trajectory tracking system in the tunnel. Deep learning and machine vision methods are used to realize vehicle detection, feature extraction, re-identification, and localization frame by frame. Furthermore, by combining the monitoring field of view of the stereo cameras, cross-camera correlation for vehicle detection is achieved.
[0166] This invention enables vehicle detection, tracking, and precise positioning in tunnel environments with low light, high humidity, and poor visibility, providing technical support for traffic management, autonomous driving, and emergency rescue.
[0167] like Figure 6 As shown, the present invention also provides a vehicle positioning and trajectory tracking device 600 in a tunnel, comprising:
[0168] Module 601 is used to obtain the coordinates of the corner points of lane markings inside the tunnel;
[0169] The coordinate calculation module 602 is used to determine the coordinates and direction cosine matrix of the stereo camera in the tunnel based on the coordinates of the lane marking corner points; wherein, multiple sets of stereo cameras are installed at equal intervals along the center line of the tunnel arch, and each set of stereo cameras includes a main camera and an auxiliary camera located on both sides of the center line of the tunnel arch.
[0170] The field of view determination module 603 is used to determine the monitoring field of view of the stereo camera based on the coordinates and orientation cosine matrix of the stereo camera in the tunnel.
[0171] The vehicle detection module 604 is used to acquire images captured by the stereo camera within the monitoring field of view, and input each frame of image into the trained Swing Transformer model to obtain vehicle detection results.
[0172] The positioning and tracking module 605 is used to determine the position and trajectory of a vehicle based on the vehicle detection results of different frame images.
[0173] The present invention also provides a vehicle positioning and trajectory tracking system in a tunnel, including an electronic device for performing the above method, and multiple sets of stereo cameras that are communicatively connected to the electronic device; the multiple sets of stereo cameras are installed at equal intervals along the center line of the tunnel arch, and each set of stereo cameras includes a main camera and an auxiliary camera located on both sides of the center line of the tunnel arch.
[0174] The vehicle positioning and trajectory tracking device in the tunnel provided in the above embodiments can realize the technical solutions described in the above embodiments of the vehicle positioning and trajectory tracking method in the tunnel. The specific implementation principles of each module or unit can be found in the corresponding content in the above embodiments of the vehicle positioning and trajectory tracking method in the tunnel, which will not be repeated here.
[0175] like Figure 7 As shown, the present invention also provides an electronic device 700. The electronic device 700 includes a processor 701, a memory 702, and a display 703. Figure 7 Only some components of the electronic device 700 are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
[0176] In some embodiments, memory 702 may be an internal storage unit of electronic device 700, such as a hard disk or memory of electronic device 700. In other embodiments, memory 702 may also be an external storage device of electronic device 700, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 700.
[0177] Furthermore, the memory 702 may include both internal storage units of the electronic device 700 and external storage devices. The memory 702 is used to store application software and various types of data installed on the electronic device 700.
[0178] In some embodiments, processor 701 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 702 or process data, such as the vehicle positioning and trajectory tracking method in the tunnel of the present invention.
[0179] In some embodiments, display 703 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 703 is used to display information from electronic device 700 and to display a visual user interface. Components 701-703 of electronic device 700 communicate with each other via a system bus.
[0180] In some embodiments of the present invention, when the processor 701 executes the vehicle positioning and trajectory tracking program in the tunnel stored in the memory 702, the following steps can be implemented:
[0181] Obtain the coordinates of the corner points of lane markings inside the tunnel;
[0182] Based on the coordinates of the lane marking corner points, the coordinates and direction cosine matrix of the stereo cameras inside the tunnel are determined; wherein, multiple sets of stereo cameras are installed at equal intervals along the center line of the tunnel arch, and each set of stereo cameras includes a main camera and an auxiliary camera located on both sides of the center line of the tunnel arch.
[0183] The monitoring field of view of the stereo camera is determined based on the coordinate and direction cosine matrix of the stereo camera in the tunnel.
[0184] The images captured by the stereo camera within the monitoring field of view are obtained, and each frame of the image is input into the trained SwinTransformer model to obtain the vehicle detection results.
[0185] Based on the vehicle detection results from different frames of images, the vehicle's position and trajectory are determined.
[0186] It should be understood that when the processor 701 executes the vehicle positioning and trajectory tracking program in the tunnel stored in the memory 702, in addition to the functions mentioned above, it can also perform other functions, as detailed in the description of the corresponding method embodiments above.
[0187] Furthermore, the embodiments of the present invention do not specifically limit the type of electronic device 700 mentioned. Electronic device 700 can be a mobile phone, tablet computer, personal digital assistant (PDA), wearable device, laptop computer, or other portable electronic device. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices running iOS, Android, Microsoft, or other operating systems. The aforementioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, electronic device 700 may not be a portable electronic device, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0188] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the vehicle positioning and trajectory tracking methods in tunnels provided by the above methods, the method comprising:
[0189] Obtain the coordinates of the corner points of lane markings inside the tunnel;
[0190] Based on the coordinates of the lane marking corner points, the coordinates and direction cosine matrix of the stereo cameras inside the tunnel are determined; wherein, multiple sets of stereo cameras are installed at equal intervals along the center line of the tunnel arch, and each set of stereo cameras includes a main camera and an auxiliary camera located on both sides of the center line of the tunnel arch.
[0191] The monitoring field of view of the stereo camera is determined based on the coordinate and direction cosine matrix of the stereo camera in the tunnel.
[0192] The images captured by the stereo camera within the monitoring field of view are obtained, and each frame of the image is input into the trained SwinTransformer model to obtain the vehicle detection results.
[0193] Based on the vehicle detection results from different frames of images, the vehicle's position and trajectory are determined.
[0194] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0195] The method, apparatus and system for vehicle positioning and trajectory tracking in tunnels provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for vehicle positioning and trajectory tracking in a tunnel, characterized in that, include: Obtain the coordinates of the corner points of lane markings inside the tunnel; Based on the coordinates of the lane marking corner points, the coordinates and direction cosine matrix of the stereo cameras inside the tunnel are determined; wherein, multiple sets of stereo cameras are installed at equal intervals along the center line of the tunnel arch, and each set of stereo cameras includes a main camera and an auxiliary camera located on both sides of the center line of the tunnel arch. The monitoring field of view of the stereo camera is determined based on the coordinate and direction cosine matrix of the stereo camera in the tunnel. The images captured by the stereo camera within the monitoring field of view are obtained, and each frame of the image is input into the trained SwinTransformer model to obtain the vehicle detection results. Based on the vehicle detection results of different frame images, the vehicle's position and motion trajectory are determined; Based on the coordinates of the lane marking corner points, the coordinates and direction cosine matrix of the stereo camera inside the tunnel are determined, including: Based on the coordinates of the lane marking corner points and the collinear relationship between adjacent groups of stereo cameras, the coordinates and direction cosine matrix of the stereo cameras in the tunnel are determined. The coordinates and direction cosine matrix of the stereo camera inside the tunnel are obtained based on the following formula: in, These are the coordinates of the lane marking corner points on the image captured by the stereo camera. f The focal length of the stereo camera. The coordinates of the feature points within the field of view of the stereo camera. Let be the cosine matrix of the stereo camera orientation to be solved. Let be the coordinates of the stereo camera to be solved; Based on the coordinate and orientation cosine matrix of the stereo camera inside the tunnel, the monitoring field of view of the stereo camera is determined, including: Determine the front edge of the monitoring field of view of the stereo camera when the pixel width of the lane line in the video image captured by the stereo camera shrinks to the target width. Determine the rear edge of the 3D camera's field of view at the target distance in front of the 3D camera; Based on the coordinates and direction cosine matrix of the stereo camera inside the tunnel, the endpoint coordinates of the front and rear lines are determined, and the monitoring field of view of the stereo camera is determined based on the endpoint coordinates of the front and rear lines. Each frame of image is input into the trained Swin Transformer model to obtain vehicle detection results, including: Each frame of image is input into the trained Swing Transformer model. In the window attention module of the Swing Transformer model, the image is segmented according to the illumination intensity to obtain different regions. Different weights are assigned to different regions to form a light intensity mask; The vehicle detection result is obtained by multiplying the illumination intensity mask element by element with the attention weight matrix.
2. The method for vehicle positioning and trajectory tracking in a tunnel according to claim 1, characterized in that, Obtain the coordinates of the corner points of lane markings inside the tunnel, including: Obtain the coordinates of the tunnel entrance arch base collected by the GNSS system; Based on the coordinates of the tunnel entrance and exit arch bottom, the coordinates of the lane marking corner points inside the tunnel are measured using the forward intersection method.
3. The method for vehicle positioning and trajectory tracking in a tunnel according to claim 1, characterized in that, Different areas include: high light area, low light area and normal light area; The window size of the high-light area is smaller than the window size of the normal area, and the window size of the normal area is smaller than the window size of the low-light area.
4. The method for vehicle positioning and trajectory tracking in a tunnel according to claim 1, characterized in that, The vehicle detection result is the vehicle detection frame; Based on vehicle detection results from different frames of images, the vehicle's position and trajectory are determined, including: Each vehicle detection box is input into the trained ResNet model to obtain the vehicle's feature vector. The distance between the feature vectors of vehicles in adjacent frame images is determined, and the continuity detection result of the vehicles is determined based on the distance; the continuity detection result includes the identification result of whether the vehicles in adjacent frame images are the same vehicle; Based on the continuous detection results, the vehicle's position and trajectory are determined.
5. A vehicle positioning and trajectory tracking device for tunnels, characterized in that, include: The acquisition module is used to obtain the coordinates of the corner points of lane markings inside the tunnel; The coordinate calculation module is used to determine the coordinates and direction cosine matrix of the stereo cameras in the tunnel based on the coordinates of the lane marking corner points; wherein, multiple sets of stereo cameras are installed at equal intervals along the center line of the tunnel arch, and each set of stereo cameras includes a main camera and an auxiliary camera located on both sides of the center line of the tunnel arch. The field of view determination module is used to determine the monitoring field of view of the stereo camera based on the coordinates and orientation cosine matrix of the stereo camera in the tunnel. The vehicle detection module is used to acquire images captured by the stereo camera within the monitoring field of view. Each frame of the image is input into the trained Swing Transformer model to obtain the vehicle detection results. The positioning and tracking module is used to determine the vehicle's position and trajectory based on the vehicle detection results from different frame images; Based on the coordinates of the lane marking corner points, the coordinates and direction cosine matrix of the stereo camera inside the tunnel are determined, including: Based on the coordinates of the lane marking corner points and the collinear relationship between adjacent groups of stereo cameras, the coordinates and direction cosine matrix of the stereo cameras in the tunnel are determined. The coordinates and direction cosine matrix of the stereo camera inside the tunnel are obtained based on the following formula: in, These are the coordinates of the lane marking corner points on the image captured by the stereo camera. f The focal length of the stereo camera. The coordinates of the feature points within the field of view of the stereo camera. Let be the cosine matrix of the stereo camera orientation to be solved. Let be the coordinates of the stereo camera to be solved; Based on the coordinate and orientation cosine matrix of the stereo camera inside the tunnel, the monitoring field of view of the stereo camera is determined, including: Determine the front edge of the monitoring field of view of the stereo camera when the pixel width of the lane line in the video image captured by the stereo camera shrinks to the target width. Determine the rear edge of the 3D camera's field of view at the target distance in front of the 3D camera; Based on the coordinates and direction cosine matrix of the stereo camera inside the tunnel, the endpoint coordinates of the front and rear lines are determined, and the monitoring field of view of the stereo camera is determined based on the endpoint coordinates of the front and rear lines. Each frame of image is input into the trained Swin Transformer model to obtain vehicle detection results, including: Each frame of image is input into the trained Swing Transformer model. In the window attention module of the Swing Transformer model, the image is segmented according to the illumination intensity to obtain different regions. Different weights are assigned to different regions to form a light intensity mask; The vehicle detection result is obtained by multiplying the illumination intensity mask element by element with the attention weight matrix.
6. A vehicle positioning and trajectory tracking system in a tunnel, characterized in that, The device includes an electronic device for performing the method according to any one of claims 1-4, and multiple sets of stereo cameras communicatively connected to the electronic device; the multiple sets of stereo cameras are installed at equal intervals along the center line of the tunnel arch, and each set of stereo cameras includes a main camera and an auxiliary camera located on both sides of the center line of the tunnel arch.