Expressway visibility detection method based on image recognition

By optimizing the YOLOv7 and DeepsSORT algorithms, and combining manual annotation with the CIOU_Loss loss function, the problems of low visibility detection accuracy and insufficient generalization ability in existing technologies have been solved, enabling rapid and accurate visibility detection in foggy weather.

CN119339286APending Publication Date: 2025-01-21CHINA MERCHANTS CHONGQING COMM RES & DESIGN INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411364465.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

Existing image processing-based visibility detection methods are greatly affected by image quality and quantity, resulting in low detection accuracy and insufficient generalization ability, making it difficult to quickly and accurately detect visibility in foggy weather.

Method used

The YOLOv7 algorithm is used to optimize the vehicle detection bounding box, and the DeepsSORT algorithm is combined to track the vehicle's movement trajectory. The visibility level is determined by calculating the maximum distance between the vehicle and the camera. Manually labeled data is used to optimize the YOLOv7 algorithm, and the detection accuracy is improved by combining the CIOU_Loss loss function and adaptive anchor box calculation. The DeepsSORT algorithm is used for vehicle trajectory matching and merging.

Benefits of technology

It improves the accuracy of vehicle detection and the generalization ability of visibility detection, enabling accurate visibility identification in different environments, reducing the requirements for data quality and quantity, and adapting to various visibility conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119339286A_ABST
    Figure CN119339286A_ABST
Patent Text Reader

Abstract

The invention provides a highway visibility detection method based on image recognition, which comprises the following steps: acquiring a plurality of first video streams with different visibility, extracting a plurality of first images containing vehicles from the first video streams, and manually marking first image frames of the vehicles in the images; identifying all vehicles in all the first images by adopting a YOLOv7 algorithm, and optimizing the algorithm; acquiring a second video stream of the camera on the expressway, extracting a plurality of second images containing vehicles from the second video stream, and identifying the vehicles in the second images by using a YOLOv7 algorithm to obtain a second detection frame; and a DeepsSORT algorithm is adopted to track the second detection frame of the same vehicle in different images, a corresponding moving track is generated, and the maximum distance between the actual position of the vehicle in the moving track and the camera is calculated. According to the invention, the problems of low detection precision and insufficient generalization ability caused by great influence of image quality and number on the visibility detection method based on image processing in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart highway technology, and in particular to a highway visibility detection method based on image recognition. Background Art

[0002] With the improvement of the construction level of expressways in my country, expressways have become one of the main choices for people to travel across provinces. However, the impact of severe weather such as fog, strong winds, rain and snow on expressways is becoming more and more obvious, especially the traffic accidents caused by fog are increasing year by year. Fog weather is short-lived and small-scale, with fog coverage ranging from tens of meters to several kilometers. The fog is unevenly distributed and sporadic, making it difficult for drivers to detect foggy areas in advance and for expressway management to make precise forecasts. The low visibility caused by fog limits the range of vision and increases the difficulty of judging vehicle speed and distance, thereby increasing the risk of major accidents such as rear-end collisions and rollovers.

[0003] At present, many researchers have conducted research on visibility detection in foggy days, which mainly include instrument measurement method and visibility detection based on image processing. At present, the more mature one is the instrument measurement method. Meteorological observation stations are built on highways in various provinces. Staff use instrument measurement methods to measure visibility in foggy days and issue warnings. Visibility instruments estimate visibility by measuring the attenuation of transmitted light: measuring the intensity of scattered light received by the receiver after being emitted from the transmitting light source and passing through the fog, measuring the amount of light transmitted through the fog, comparing the intensity of incident light and transmitted light, and calculating visibility. Visibility detection based on image recognition directly measures the visibility value from the high-speed monitoring image: first, the image noise is removed by filtering algorithm, the edge information in the image is extracted by edge detection algorithm, the image is divided into multiple regions to identify fog groups, and then the visibility is determined by the image edge clarity. At the same time, in order to improve the accuracy, a deep convolutional neural network is used to input image data sets of different visible ranges for training to achieve the detection of visibility level.

[0004] At present, none of these methods can quickly and accurately meet the visibility detection task in foggy weather. For instrument measurement methods, the observation station uses the visibility in foggy weather within the instrument measurement range to replace the visibility of the entire road. It cannot detect the visibility of occasional foggy weather very well, and the detection instrument needs regular maintenance and calibration, which has high labor costs. Therefore, the use of visibility detection based on image recognition is gradually increasing. However, the visibility detection method based on image processing is greatly affected by image quality and feature extraction is difficult. It requires high-performance computing equipment to process a large number of images, and is easily affected by other visual interference objects. The visibility detection results, at the same time, the deep learning model requires a large number of original images with visibility annotations for training, but it is difficult to obtain high-quality data sets covering different visibility and difficult to annotate, resulting in insufficient model generalization ability and poor performance in actual detection scenarios. Summary of the invention

[0005] In view of the deficiencies in the prior art, the present invention provides a highway visibility detection method based on image recognition, which solves the problem that the visibility detection method based on image processing in the prior art is greatly affected by the quality and quantity of images, resulting in low detection accuracy and insufficient generalization ability.

[0006] According to an embodiment of the present invention, a highway visibility detection method based on image recognition includes:

[0007] Acquire a plurality of first video streams with different visibility, extract a plurality of first images containing vehicles from the first video streams in frame order, and manually mark first image frames of the vehicles in the images;

[0008] Using the YOLOv7 algorithm to identify all vehicles in all the first images, obtaining first detection frames of all vehicles in all the first images, and optimizing the algorithm according to the positions of the first image frames and the first detection frames;

[0009] Obtain a second video stream from a camera on the highway, extract multiple second images containing vehicles from the second video stream in frame order, use the trained YOLOv7 algorithm to identify the vehicles in the second image, and obtain a second detection frame;

[0010] The DeepsSORT algorithm is used to track the second detection frame of the same vehicle in different images, generate the corresponding movement trajectory, calculate the maximum distance between the actual position of the vehicle in the movement trajectory and the camera, and use the maximum distance as the visibility level.

[0011] Preferably, when manually annotating the image, only the image frames of vehicles whose actual length is less than 12 m and the corresponding vehicle lengths are annotated.

[0012] Preferably, the CIOU_Loss loss function is used in the YOLOv7 algorithm, and the parameters of the YOLOv7 algorithm are optimized according to the loss function until the ratio of the aspect ratio of the first image frame to the aspect ratio of the first detection frame is less than a preset value.

[0013] Preferably, the step of tracking the second detection frame of the same vehicle in different images using the DeepsSORT algorithm includes:

[0014] S1: cascade matching is performed on the initial track and the second detection frames in different images to obtain a first unmatched track, a first unmatched detection frame and a first matched track;

[0015] S2: Perform IOU matching on the first unmatched trajectory and the first unmatched detection frame to obtain a second unmatched trajectory, a second unmatched detection frame, a second matched trajectory, and a second new trajectory;

[0016] S3: merging the first matching trajectory and the second matching trajectory through Kalman filtering;

[0017] S4: Use the second unmatched detection frame as the initial detection frame, use the second new trajectory and the first matching trajectory as the initial trajectory and repeat steps S1-S4.

[0018] Preferably, in S2, after the IOU matching is performed, the second unmatched trajectory is directly deleted. If the second new trajectory is successfully cascade matched for multiple times, it is used as the first matching trajectory. If the cascade matching is still unsuccessful after repeated multiple times, it is directly deleted.

[0019] Preferably, the steps of cascade matching are as follows:

[0020] Calculate the Mahalanobis distance and cosine distance between all second detection frames and all second new tracks or first matching tracks in each image in frame order;

[0021] The Mahalanobis distance and cosine distance are weighted to obtain the comprehensive matching degree;

[0022] The second detection frame is merged into the second new track or the first matching track with the highest comprehensive matching degree.

[0023] Preferably, after obtaining the Mahalanobis distance and the cosine distance, the Mahalanobis distance and the cosine distance are compared with the first threshold and the second threshold respectively. If the Mahalanobis distance is greater than the first threshold or the cosine distance is less than the second threshold, it is determined that the second detection frame is not associated with the corresponding second new trajectory or the first matching trajectory, and subsequent comprehensive matching degree calculation is not performed.

[0024] Preferably, if the first matching trajectory is not updated after three cascade matchings are performed, the first matching trajectory is used as the movement trajectory of the corresponding vehicle.

[0025] Preferably, the maximum distance is calculated as follows:

[0026]

[0027] Among them, H is the camera height, f is the camera focal length, ɑ is the angle between the line from the center point of the vehicle to the camera and the center of the optical axis, θ is the angle between the camera and the horizontal plane, y is the vertical axis coordinate of the intersection of the center of the optical axis and the image on the image, and W is the vehicle width.

[0028] Compared with the prior art, the present invention has the following beneficial effects:

[0029] By manually annotating the image frame in the image, the detection frame of the vehicle identified by the image recognition algorithm YOLOv7 is optimized to make the algorithm recognize the vehicle more accurately. Then the optimized image recognition algorithm is used to recognize the image, and the DeepsSORT algorithm is used to continuously track the position of the same vehicle in different images to generate the corresponding moving trajectory of the vehicle until the moving trajectory of the vehicle no longer changes. At this time, it means that the vehicle has left the camera's field of view. At this time, the maximum distance between the vehicle and the camera in the moving trajectory is used as the visibility level. The smaller the distance, the lower the visibility, and the larger the distance, the greater the visibility. The requirements for data quality and quantity are relatively low, and the visibility of most environments can be quantified and covered, with high generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 The following is a detection flow chart of an embodiment of the present invention.

[0031] Figure 2 This is a manually labeled diagram of an embodiment of the present invention.

[0032] Figure 3 This is a diagram of the YOLOv7 algorithm architecture of an embodiment of the present invention.

[0033] Figure 4 This is a DeepsSORT algorithm tracking flowchart of an embodiment of the present invention.

[0034] Figure 5 This is a model diagram for calculating the distance between a vehicle and a camera according to an embodiment of the present invention.

[0035] Figure 6 This is a visibility detection effect diagram of an embodiment of the present invention. DETAILED DESCRIPTION

[0036] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0037] like Figure 1As shown, the embodiment of the present invention proposes a highway visibility detection method based on image recognition, including:

[0038] Acquire a plurality of first video streams with different visibility, extract a plurality of first images containing vehicles from the first video streams in frame order, and manually mark first image frames of the vehicles in the images;

[0039] The first video streams shot by cameras at different locations on the highway on foggy days are obtained, and divided into three categories: heavy fog, medium fog and light fog according to the visibility of the actual environment in the first video stream. The duration ratio of the first video stream in each category is 7:2:1. Then, images are extracted from the first video stream. At the same time, since the vehicle speed on the highway is quite fast, the first video stream is processed by extracting images in the first video stream in frames to avoid excessive deviation in the vehicle position between two consecutive images, which makes it inconvenient to track the vehicle.

[0040] like Figure 2 As shown in the figure, after extracting the image, the labelimg tool is used to manually annotate the first graphic frame of the vehicles in all images. In addition, there is a certain selectivity in the annotation of vehicles in the image. First, only vehicles with an actual length of less than 12m are annotated. Large vehicles and trailers with a length of more than 12m are either prohibited from entering the highway in foggy days, or their length has exceeded the maximum viewing distance of the camera (the front of the vehicle has left the camera's field of view, but the rear of the vehicle has not entered the camera's field of view). Secondly, small cars and large cars are annotated separately. There is a significant difference in size between large cars and small cars. Therefore, vehicles with a length of less than 6m are classified as small cars, and vehicles with a length of 6-12m are classified as large cars. Finally, after annotating the graphic frame for small cars, the label of the image frame is unified as a frame width of 1.8m, and after annotating the graphic frame for large vehicles, the label of the image frame is unified as a frame width of 2.5m.

[0041] Using the YOLOv7 algorithm to identify all vehicles in all the first images, obtaining first detection frames of all vehicles in all the first images, and optimizing the algorithm according to the positions of the first image frames and the first detection frames;

[0042] like Figure 3 As shown in the figure, the YOLOv7 image recognition algorithm includes an input end, a backbone network, and a detection head, which integrates the neck network and the detection head of the YOLO classic algorithm.

[0043] (1) Input terminal

[0044] YOLOv7 uses some YOLOv5 technologies in data preprocessing, such as Mosaic data enhancement, adaptive anchor box calculation, and image adaptive scaling. These methods improve the detection performance and robustness of YOLOv7, enabling the model to better handle situations of different sizes, occlusions, and multiple targets, thereby improving accuracy and versatility. It is mainly composed of the following modules.

[0045] Mosaic data augmentation: Mosaic data augmentation is an image augmentation method designed to train deep learning object detection models. It synthesizes multiple training images into one and randomly places the target objects. In YOLOv7, when the random value is less than 0.8, 4 images are used for synthesis; when the random value is between 0.8 and 1, 9 images are used. This new synthesized image contains a variety of backgrounds and occlusions, which helps the model better learn to handle complex situations, thereby improving robustness and generalization performance.

[0046] Adaptive anchor box calculation: By counting the average size, variance, and aspect ratio of the target objects in the training set, the anchor box that best suits the dataset is determined. This method helps improve the performance of the target detection model, making it better adaptable to targets of different sizes and ratios, thereby meeting the needs of different datasets and tasks.

[0047] Adaptive scaling: Usually, images are uniformly resized to a fixed size, such as 640×640, and smaller or unequal-length images are padded with pixels on the short side. However, this padding method may produce too many black edges in images with large length and width differences, resulting in information redundancy and affecting the inference speed. YOLOv5 improved the image scaling strategy and adopted an adaptive scaling method to reduce the black edges around the image, thereby improving the computational efficiency of the model and saving computing resources. YOLOv7 also uses this adaptive scaling technology to reduce image padding, reduce information redundancy, and improve computational efficiency.

[0048] (2) Backbone network

[0049] The backbone network of YOLOv7 is composed of CBS module, ELAN module and MP-1 module. The network structure is as follows: Figure 2As shown in the figure. The CBS module consists of a two-dimensional convolution (Conv), a batch normalization layer (Batch Normalization, BN) and an activation function (SiLu). YOLOV7 has three CBS modules. The difference between different CBS is the convolution kernel size and convolution step size. Efficient Layer Aggregation Networks (ELAN) is the basic module of the YOLOv7 backbone network and the core improvement of the YOLOv7 algorithm. The ELAN module consists of multiple CBS modules, which improves the feature representation capability by efficiently aggregating feature information from different network layers. This aggregation method can effectively utilize information at different levels, thereby improving the accuracy of target detection.

[0050] (3) Detection head

[0051] The detection head of YOLOv7 mainly includes the SPPCSPC module, ELAN-1 module, MP-x module, and structure reparameterization module. The SPPCSPC module is an improvement on the Spatial Pyramid Pooling (SPP) network proposed by Kaiming He. SPP improves the model's perception of objects of different sizes by extracting feature information of different scales. The MP-x module is an improvement on the Max Pool (MP), and its main function is to perform downsampling operations. There are two types of MP-x modules in YOLOv7, one in the backbone network and the other in the detection head. The main difference is that the MP-x module in the detection head is connected to the forward output layer.

[0052] (4) Loss Function

[0053] In deep learning tasks, a loss function is often used to evaluate a deep learning model. In the present invention, the YOLOv7 loss function adopts CIOU_Loss as the loss function of the first detection box, taking into account the scale information of the aspect ratio of the bounding box, so that the speed and accuracy of the first detection box regression become higher.

[0054] The complete expression of CIOU_Loss is as follows:

[0055]

[0056] In the formula, ρ 2 (b,b gt ) refers to calculating the Euclidean distance between the center points of the first detection frame and the first image frame, c represents the diagonal distance of the circumscribed rectangle of both the first detection frame and the first image frame, IoU is the intersection over union ratio of the first detection frame and the first image frame, w and w gt are the widths of the first detection frame and the first image frame, h and h respectively.gt are the lengths of the first detection frame and the first image frame respectively.

[0057] In the above formula, v is used to measure the consistency of the aspect ratio of the first image frame and the first detection frame. The smaller the value of v, the more consistent the aspect ratio of the first image frame and the first detection frame, and the more similar the two frames are. In addition, the smaller the value of the loss value CIoUloss, the more similar the size of the first image frame and the first detection frame are, and the more overlapping they are. Then, the YOLOv7 algorithm is optimized according to the value of CIoUloss and the value of v until the value of CIoUloss and the value of v are both less than the preset value (that is, the ratio of the aspect ratio of the first image frame to the aspect ratio of the first detection frame is less than the preset value).

[0058] like Figure 4 As shown, a second video stream of a camera on the highway is obtained, a plurality of second images containing vehicles are extracted from the second video stream in frame order, and the trained YOLOv7 algorithm is used to identify the vehicles in the second image to obtain a second detection frame;

[0059] The DeepsSORT algorithm is used to track the second detection frame of the same vehicle in different images, generate the corresponding movement trajectory, and calculate the maximum distance between the actual position of the vehicle in the movement trajectory and the camera, and the maximum distance is used as the visibility level.

[0060] When used for the first time, there is no initial trajectory, so an additional initial trajectory can be artificially introduced, and the initial trajectory is not associated with the vehicle in the currently obtained second video stream.

[0061] In DeepSORT, only the matched trajectories will be cascade matched. The cascade matching module matches the appearance and motion features of the first detection frame and the initial trajectory between frames. The motion features are matched using the Mahalanobis distance, which is calculated as follows:

[0062]

[0063] Among them, d (1) (i,j) is the motion matching degree between the jth second prediction box and the i-th trajectory, d j is the position of the jth prediction box, y i is the position of the second detection frame of the vehicle in the current detection stage by the i-th tracker, is the covariance of d and y. In addition, the Mahalanobis distance is compared with the first threshold (the present invention adopts the threshold of the chi-square distribution). When the Mahalanobis distance is less than the first threshold, the match is successful, indicating that all the second detection frames in the i-th track and the j-th second detection frame belong to the same vehicle. On the contrary, when the Mahalanobis distance is greater than the first threshold, the match fails, indicating that all the second detection frames in the i-th track and the j-th second detection frame do not belong to the same vehicle.

[0064] When the certainty of the motion is high, the association is measured by the Mahalanobis distance. However, when the moving vehicle moves quickly, it will affect the accuracy of the Kalman filter in predicting the target position, and when there is occlusion, the Mahalanobis distance cannot measure the similarity well. Therefore, the appearance similarity is integrated into the assignment problem.

[0065] Using Mahalanobis distance alone cannot solve the problem of ID jump, so the cosine distance of the performance feature is used to calculate the similarity between the vehicle trajectory and the detection frame, as shown in the following formula:

[0066]

[0067] For each detection box, r j is the appearance feature of the second detection frame, Represents the appearance features of the last 100 objects of the i-th trajectory. Each distance between the second detection box and the object (detection box) in the trajectory has a second threshold. When the distance is less than the set second threshold, it is set as impossible to associate. Conversely, when the distance is greater than the set second threshold, it is set as possible to associate.

[0068] If the Mahalanobis distance is less than the first threshold or the cosine distance is greater than the second threshold, the Mahalanobis distance and the cosine distance are weighted to obtain a comprehensive matching degree:

[0069] c i,j =λd (1) (i,j)+(1-λ)d (2) (i,j)

[0070] If the Mahalanobis distance is greater than the first threshold or the cosine distance is less than the second threshold, it is determined that the detection frame is not associated with the corresponding second new track or the first matching track, and subsequent comprehensive matching degree calculation is not performed.

[0071] Afterwards, the first unmatched trajectory and the first unmatched detection frame are IOU matched to obtain the second unmatched trajectory, the second unmatched detection frame, the second matched trajectory and the second new trajectory. The first matched trajectory and the second matched trajectory are then merged through Kalman filtering. The second unmatched detection frame is then used as the initial detection frame, the second new trajectory and the first matched trajectory are used as the initial trajectory, and the above trajectory tracking is repeated.

[0072] After the IOU matching, the second unmatched track is directly deleted. If the second new track is successfully cascade matched three times, it will be used as the first matching track. If the cascade matching is still unsuccessful after 30 repetitions, it will be directly deleted.

[0073] If the first matching trajectory is not updated after three cascade matchings, the first matching trajectory is used as the movement trajectory of the corresponding vehicle, and the maximum distance between the actual position of the vehicle and the camera in the movement trajectory is calculated.

[0074] In actual application scenarios, the camera and the vehicle are not always parallel to each other, and there may be pitch angles and yaw angles. In order to reduce the errors of pitch angles and yaw angles, a vehicle ranging model based on pitch angles and yaw angles is used, such as Figure 5 :

[0075] The intersection of the optical axis center and the imaging plane is O(x, y), the focal length is f, the angle between the line connecting the center point of the vehicle to the camera and the center of the optical axis is ɑ, θ is the angle between the camera and the horizontal plane, and the imaging point, i.e. the center coordinates of the second detection frame, is D(u, v). The formula for the spatial distance from the vehicle to the camera is:

[0076]

[0077] in,

[0078]

[0079] In actual scenarios, there may be a vehicle yaw angle, so the distance measurement model that considers the yaw angle and pitch angle is more accurate. The schematic diagram of the distance measurement model based on the pitch angle and yaw angle is as follows: Figure 6 As shown. Among them, β is the horizontal angle of the camera optical axis outside the camera, γ is the vehicle yaw angle, AB is the actual vehicle width w, and the pixel center point O' is (u, v), which can be obtained:

[0080]

[0081] Combining the above three formulas, the vehicle ranging model formula based on pitch angle and yaw angle is:

[0082]

[0083] The vehicle ranging result considering the pitch angle and yaw angle of the camera installation can be obtained by calculating γ in real time according to the vehicle width.

[0084] The maximum distance in the trajectory is used as the visibility level of the camera's location, such as Figure 6As shown in the figure, the model can identify the farthest distance of the tracked vehicle as the visibility distance, where the visibility identification update parameter k can be adjusted according to the environment. The value is 7 in the demonstration result, which means that the visibility value is updated once every seven vehicle tracking results. During the update process, the tracking distances of the seven vehicles are averaged, which can improve the stability of the model's output of visibility values.

[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.

Claims

1. A highway visibility detection method based on image recognition, characterized in that: include: Acquire a plurality of first video streams with different visibilities, extract a plurality of first images containing vehicles from the first video streams in frame order, and manually annotate first image frames of the vehicles in the images; Using the YOLOv7 algorithm to identify all vehicles in all the first images, obtaining first detection frames of all vehicles in all the first images, and optimizing the algorithm according to the positions of the first image frames and the first detection frames; Obtain a second video stream from a camera on the highway, extract multiple second images containing vehicles from the second video stream in frame order, use the trained YOLOv7 algorithm to identify the vehicles in the second image, and obtain a second detection frame; The DeepsSORT algorithm is used to track the second detection frame of the same vehicle in different images, generate the corresponding movement trajectory, calculate the maximum distance between the actual position of the vehicle in the movement trajectory and the camera, and use the maximum distance as the visibility level.

2. The method for detecting highway visibility based on image recognition according to claim 1, characterized in that: When manually annotating images, only the image frames of vehicles with actual lengths less than 12 m and the corresponding vehicle lengths are annotated.

3. The method for detecting highway visibility based on image recognition according to claim 1, characterized in that: The CIOU_Loss loss function is used in the YOLOv7 algorithm. According to the loss function, the parameters of the YOLOv7 algorithm are optimized until the ratio of the aspect ratio of the first image frame to the aspect ratio of the first detection frame is less than a preset value.

4. The method for detecting highway visibility based on image recognition according to claim 1, characterized in that: The steps of using the DeepsSORT algorithm to track the second detection frame of the same vehicle in different images include: S1: cascade matching is performed on the initial track and the second detection frames in different images to obtain a first unmatched track, a first unmatched detection frame and a first matched track; S2: Perform IOU matching on the first unmatched trajectory and the first unmatched detection frame to obtain a second unmatched trajectory, a second unmatched detection frame, a second matched trajectory, and a second new trajectory; S3: merging the first matching trajectory and the second matching trajectory through Kalman filtering; S4: Use the second unmatched detection frame as the initial detection frame, use the second new trajectory and the first matching trajectory as the initial trajectory and repeat steps S1-S4.

5. The method for detecting highway visibility based on image recognition according to claim 4, characterized in that: In S2, after the IOU matching is performed, the second unmatched trajectory is directly deleted. If the second new trajectory is successfully cascade matched multiple times, it is used as the first matching trajectory. If the cascade matching is still unsuccessful after repeated multiple times, it is directly deleted.

6. The method for detecting highway visibility based on image recognition according to claim 4, characterized in that: The steps of cascade matching are as follows: Calculate the Mahalanobis distance and cosine distance between all second detection frames and all second new tracks or first matching tracks in each image in frame order; The Mahalanobis distance and cosine distance are weighted to obtain the comprehensive matching degree; The second detection frame is merged into the second new track or the first matching track with the highest comprehensive matching degree.

7. The method for detecting highway visibility based on image recognition according to claim 6, characterized in that: After obtaining the Mahalanobis distance and the cosine distance, the Mahalanobis distance and the cosine distance are compared with the first threshold and the second threshold respectively. If the Mahalanobis distance is greater than the first threshold or the cosine distance is less than the second threshold, it is determined that the second detection frame is not associated with the corresponding second new track or the first matching track, and subsequent comprehensive matching degree calculation is not performed.

8. The method for detecting highway visibility based on image recognition according to claim 4, characterized in that: If the first matching trajectory is not updated after three cascade matchings, the first matching trajectory is used as the movement trajectory of the corresponding vehicle.

9. The method for detecting highway visibility based on image recognition according to claim 1, characterized in that: The maximum distance is calculated as follows: Among them, H is the camera height, f is the camera focal length, ɑ is the angle between the line from the center point of the vehicle to the camera and the center of the optical axis, θ is the angle between the camera and the horizontal plane, y is the vertical axis coordinate of the intersection of the center of the optical axis and the image on the image, and W is the vehicle width.