Vehicle detection model training and vehicle monitoring method, device and equipment

By training the vehicle detection model and target tracking model based on Yolo model, identifying and tracking motor vehicles on non-motorized vehicle lanes, the problem that the existing technology cannot be applied to slow-moving traffic systems is solved, and accurate detection and monitoring of motor vehicles is achieved. , improves the reliability and convenience of traffic management.

CN118115834BActive Publication Date: 2024-11-26BEIJING TRANSPORTATION RES CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410121716.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-30
Publication Date
2024-11-26
Estimated Expiration
2044-01-30

AI Technical Summary

Technical Problem

The existing target detection algorithm is not applicable to slow-moving traffic systems and cannot effectively detect and monitor motor vehicles on non-motorized vehicle lanes, resulting in challenges in urban traffic management.

Method used

By acquiring and preprocessing non-motorized vehicle lane video data, training a vehicle detection model based on the Yolo model, and combining the target tracking model, identifying and tracking motor vehicles on non-motorized vehicle lanes, calculating their intrusion time, and providing accurate traffic data.

Benefits of technology

It improves the accuracy and applicability of the vehicle detection model, can effectively detect and monitor motor vehicles on non-motorized vehicle lanes, help traffic management departments to timely understand traffic conditions, alleviate urban traffic pressure, and ensure the safety and smooth flow of the traffic system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118115834B_ABST
    Figure CN118115834B_ABST
Patent Text Reader

Abstract

The present invention discloses a vehicle detection model training and vehicle monitoring method, device, and equipment. The vehicle detection model training method includes: obtaining an initial detection model, the initial detection model includes a Yolo model; collecting multiple sets of non-motorized vehicle lane video data of a target road section in different time periods and environments; preprocessing the non-motorized vehicle lane video data to obtain a video image sequence and make a video data set; annotating the pictures in the video data set according to preset classification categories, generating corresponding labels for each picture, and the labels include category information and location information; using the annotated video data set to train the initial detection model until a vehicle detection model that meets preset conditions is obtained. The present invention can provide a vehicle detection model that is highly accurate, stable, and reliable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology, and in particular relates to a vehicle detection model training and vehicle monitoring method, device and equipment. Background Art

[0002] As society pays more attention to slow traffic, the government pays more attention to slow traffic every year. However, the illegal intrusion and occupation of non-motorized vehicle lanes by motor vehicles has brought great trouble to urban traffic. Therefore, it is necessary to detect motor vehicles on non-motorized vehicle lanes.

[0003] At present, with the gradual development of computer vision, there are some target detection algorithms in the existing technology. These algorithms all use deep learning technology, such as convolutional neural network and Yolo neural network. Although these algorithms have made significant progress in accuracy, robustness and adaptability, and can better cope with lighting changes, complex backgrounds, occlusions and multi-target scenes. However, the existing target detection algorithms are not suitable for slow traffic systems. Therefore, it is urgent to provide a vehicle detection model that can be oriented to slow traffic systems. Summary of the invention

[0004] In order to solve at least one technical problem in the background technology, the present invention proposes a vehicle detection model training and vehicle monitoring method, device, and equipment for slow-moving traffic systems, which can improve the model detection accuracy and thus provide accurate, stable and reliable slow-moving traffic data.

[0005] According to a first aspect of the present invention, the present invention first provides a vehicle detection model training method, comprising:

[0006] Acquire an initial detection model, wherein the initial detection model includes a Yolo model;

[0007] Collect multiple sets of non-motorized vehicle lane video data of the target road section at different time periods and environments;

[0008] Preprocessing the non-motorized vehicle lane video data to obtain a video image sequence and prepare a video data set;

[0009] Annotating the images in the video data set according to the preset classification categories, generating a corresponding label for each image, wherein the label includes category information and location information;

[0010] The initial detection model is trained using the annotated video data set until a vehicle detection model that meets preset conditions is obtained.

[0011] Furthermore, the preprocessing of the non-motorized vehicle lane video data to obtain a video image sequence and prepare a video data set includes:

[0012] Using the ffmpeg tool, capture pictures every 8-12 frames in the non-motorized vehicle lane video data to obtain a video image sequence;

[0013] A plurality of pictures in the video image sequence are formed into a video data set.

[0014] Furthermore, the images in the video data set are labeled according to the preset classification categories, and each image generates a corresponding label, including:

[0015] Using the Labelimg tool, each image in the video dataset is labeled according to preset classification categories to generate category information and location information of each image; wherein the preset classification categories include motor vehicle category, cycling category and pedestrian category.

[0016] Furthermore, the initial detection model is trained according to the annotated video data set until a vehicle detection model that meets preset conditions is obtained, including:

[0017] Input the annotated video data set into the initial detection model, train the initial detection model according to preset parameters until the weight file with the highest accuracy in the training round is obtained, and derive the trained vehicle detection model;

[0018] The preset parameters include the batch size and training rounds of training.

[0019] According to a second aspect of the present invention, the present invention further provides a vehicle monitoring method, comprising:

[0020] Acquire monitoring video, where the monitoring video includes the driving conditions of vehicles on the current road section;

[0021] Determine the non-motorized vehicle lane area in the monitoring video;

[0022] Detecting vehicles in the non-motorized vehicle lane area using a target vehicle detection model to identify the target vehicle; and,

[0023] Tracking the identified target vehicle using a target tracking model, and dynamically monitoring the intrusion time of the target vehicle in the non-motorized vehicle lane area;

[0024] Wherein, the target vehicle detection model is trained based on a vehicle detection model training method.

[0025] Furthermore, the detecting the vehicles in the non-motorized vehicle lane area by using the target vehicle detection model to identify the target vehicle includes:

[0026] Inputting the monitoring video into the target vehicle detection model;

[0027] The target vehicle detection model identifies the target vehicle in the video to be detected and marks it by a bounding box; wherein the target vehicle includes a motor vehicle traveling in the non-motor vehicle lane area;

[0028] The characteristic information of the target vehicle is obtained and saved in a detection list, wherein the detection list includes a mapping relationship between the characteristic information of the target vehicle and the tracking ID of the target vehicle; wherein the characteristic information includes pixel position, width and height information, confidence threshold and category.

[0029] Furthermore, the use of the target tracking model to track the identified target vehicle and dynamically monitor the intrusion time of the target vehicle in the non-motor vehicle lane area includes:

[0030] Obtain the target vehicle that first appears in the first frame of the monitoring video, record the intrusion time of the target vehicle as 0, and simultaneously establish a mapping relationship between the tracking ID of the target vehicle and the intrusion time to generate a mapping set;

[0031] According to the characteristic information of the target vehicle, a target vehicle tracking step is performed, and the target vehicle tracking step includes:

[0032] According to the tracking ID, determining whether a target vehicle in the mapping set appears in a subsequent frame of the monitoring video;

[0033] If the target vehicle in the mapping set appears in the next frame of the monitoring video, the intrusion time corresponding to the target vehicle in the mapping set is updated according to the interval time between two adjacent frames; or, if the target vehicle in the mapping set does not appear in the next frame of the monitoring video, the existing relevant information of the target vehicle is deleted from the mapping set;

[0034] Repeat the target vehicle tracking step.

[0035] Furthermore, the determining whether a target vehicle in the mapping set appears in a subsequent frame of the monitoring video further includes:

[0036] If a target vehicle that does not exist in the mapping set appears in the next frame of the monitoring video, it is deemed that the target vehicle appears for the first time, the intrusion time of the target vehicle is recorded as 0, and the mapping relationship between the tracking ID of the target vehicle and the intrusion time is added to the mapping set; and the target vehicle tracking step is executed at the same time.

[0037] According to a third aspect of the present invention, the present invention further provides a vehicle detection model training device, comprising:

[0038] An acquisition module, used to acquire an initial detection model, wherein the initial detection model includes a Yolo model;

[0039] A collection module, used to collect multiple sets of non-motorized vehicle lane video data of the target road section at different time periods and environments;

[0040] A processing module, used for preprocessing the non-motorized vehicle lane video data to obtain a video image sequence and generate a video data set;

[0041] A labeling module, used to label the pictures in the video data set according to preset classification categories, and generate a corresponding label for each picture, wherein the label includes category information and location information;

[0042] The training module is used to train the initial detection model using the annotated video data set until a vehicle detection model that meets preset conditions is obtained.

[0043] According to a fourth aspect of the present invention, the present invention further provides an electronic device, comprising a memory and a processor, wherein:

[0044] The memory is used to store the computer program;

[0045] The processor is used to execute the computer program to implement the above-mentioned vehicle detection model training method and / or the above-mentioned vehicle monitoring method.

[0046] Through the technical solution of the present invention, the following technical effects can be obtained:

[0047] The vehicle detection model training method and vehicle monitoring method provided by the present invention obtain a large amount of non-motor vehicle lane video data to train the existing detection model, so as to obtain a vehicle detection model suitable for a slow traffic system, thereby making the vehicle detection model more reliable; in addition, the vehicle detection model is combined with a target tracking model to detect and track motor vehicles on non-motor vehicle lanes in a slow traffic system, and can accurately detect motor vehicles that illegally invade non-motor vehicle roads, and calculate the invasion time of motor vehicles in a designated area, so as to help traffic management departments to timely understand the situation of motor vehicles on slow traffic roads invading non-motor vehicle roads, thereby alleviating the pressure of urban traffic to a great extent, ensuring the safety and smoothness of the urban traffic system, and improving the reliability and convenience of slow traffic. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0049] Figure 1 A flow chart of a vehicle detection model training method provided by an embodiment of the present invention;

[0050] Figure 2 A flow chart of a method for training the initial detection model using a labeled video data set until a vehicle detection model that meets preset conditions is obtained, provided in an embodiment of the present invention;

[0051] Figure 3 A flow chart of a vehicle monitoring method provided by an embodiment of the present invention;

[0052] Figure 4 A flow chart of a method for dynamically monitoring the intrusion time of the target vehicle in the non-motor vehicle lane area provided by an embodiment of the present invention;

[0053] Figure 5 A schematic diagram of the structure of a vehicle detection model training device provided by an embodiment of the present invention;

[0054] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0056] It should be noted that the terms "first", "second", "third" and "fourth" in the specification and claims of this application are used to distinguish different objects rather than to describe a specific order. The terms "including" and "having" in the embodiments of this application and any variations thereof are intended to cover non-exclusive inclusions.

[0057] With the gradual development of computer vision, existing target detection algorithms use deep learning technology, such as convolutional neural networks and Yolo neural networks. Although such target detection algorithms have made significant progress in accuracy, robustness, and adaptability, and can better cope with lighting changes, complex backgrounds, occlusions, and multi-target scenes, existing target detection algorithms are not suitable for slow-moving traffic systems. Therefore, it is urgent to provide a vehicle detection model that can be oriented to slow-moving traffic systems to improve the reliability of detection.

[0058] It should be noted that slow traffic usually refers to a mode of transportation that uses slow travel. In the urban transportation system, pedestrian traffic with a speed of 4-7 kilometers per hour and non-motorized vehicles (including bicycles and electric vehicles) with a speed of less than 20 kilometers per hour can both be called "slow traffic."

[0059] According to one embodiment of the present invention, Figure 1 FIG. 1 is a flow chart of a vehicle detection model training method in the present invention. Figure 1 As shown, the present invention provides a vehicle detection model training method, the training method comprising:

[0060] S11, obtaining an initial detection model, where the initial detection model includes a Yolo model;

[0061] In this step, optionally, the initial detection model can be any Yolo model among Yolov1 model, Yolov2 model, Yolov3 model, Yolov4 model, Yolov5 model, Yolov6 model, Yolov7 model and Yolov8 model. In this embodiment, the initial detection model is Yolov8 model, which has higher detection accuracy.

[0062] S12, collecting multiple sets of non-motorized vehicle lane video data of the target road section at different time periods and environments;

[0063] Optionally, a large amount of non-motorized vehicle lane video data can be quickly acquired by using video equipment already arranged on the road or by manually shooting and collecting non-motorized vehicle lane video data of the target road section. The target road section is selected according to actual needs. The different time periods and environments include the driving conditions of bicycles and electric vehicles on the road during peak hours in the morning and evening, off-peak hours, and nighttime.

[0064] Taking Beijing as an example, the high-position video and low-pile video equipment of the Beijing Parking Management Affairs Center can be used to combine manual shooting to shoot the collected data sections at different time periods, different angles and different scenes, and quickly obtain a large number of non-motorized vehicle lane videos of slow-moving traffic roads. The above step S12 collects non-motorized vehicle lane video data in various scenes to provide rich training samples, thereby improving the accuracy of the training model.

[0065] S13, preprocessing the non-motorized vehicle lane video data to obtain a video image sequence and generate a video data set;

[0066] As an optional embodiment, the preprocessing of the non-motorized vehicle lane video data to obtain a video image sequence and prepare a video data set includes:

[0067] Using the ffmpeg tool, pictures are intercepted every 8-12 frames in the non-motorized vehicle lane video data to obtain a video image sequence; and multiple pictures in the video image sequence are made into a video data set. In this embodiment, pictures are intercepted every 10 frames in the non-motorized vehicle lane video data to reduce the number of annotations in the video data set and the similarity of the annotated pictures, so as to prevent the subsequent training of the initial detection model from being too redundant.

[0068] The ffmpeg tool is used to convert the video file format and convert the video file into an image sequence. The video image sequence is a set consisting of a series of continuous images. In this embodiment, the video image sequence includes 15776 pictures, and these pictures are collected together to form a video data set.

[0069] S14, labeling the pictures in the video data set according to the preset classification categories, generating a corresponding label for each picture, wherein the label includes category information and location information;

[0070] Based on the video data set generated in step S13, step S14 performs high-quality annotation on each picture in the video data set, and respectively annotates category information and location information. As an optional embodiment, the images in the video data set are annotated according to the preset classification categories, and each picture generates a corresponding label, including:

[0071] Using the Labelimg tool, each image in the video dataset is labeled according to preset classification categories to generate category information and location information of each image; wherein the preset classification categories include motor vehicle category, cycling category and pedestrian category.

[0072] It can be understood that the objects appearing in each picture are labeled according to the three major categories of cars, electric vehicles or bicycles, and pedestrians, until all pictures in the video data set have been labeled, and a data set of a specified format is obtained. The data set of the specified format means that the pictures in the data set have been labeled according to the preset classification categories. In addition to labeling the object category during the labeling process, the location information of the object must also be labeled. For example, the car in a picture is labeled as a car category, and the location information of the car in the picture is labeled, such as the pixel position. A picture may be labeled with one or more labels.

[0073] S15, using the annotated video data set to train the initial detection model until a vehicle detection model that meets preset conditions is obtained.

[0074] Specifically, step S15 further includes:

[0075] The annotated video data set is input into the initial detection model, and the initial detection model is trained according to preset parameters until a weight file with the highest detection accuracy in the training round is obtained, and the trained vehicle detection model is exported; wherein the preset parameters include a training batch size of 30-34 batches and a training round of 180-220 rounds. In this embodiment, the training batch size is 32 and the training round is 200 rounds.

[0076] As an optional embodiment, Figure 2 A flow chart of a method for training the initial detection model using the annotated video data set until a vehicle detection model that meets preset conditions is obtained is shown, such as Figure 2 As shown, the method for training the initial detection model using the labeled video data set includes:

[0077] S151, divide the images in the annotated video data set to generate a training set, a validation set and a test set. In this embodiment, the images in the video data set are divided according to a ratio of 8:1:1, that is, the images in the training set account for 8 / 10, the images in the validation set account for 1 / 10, and the images in the test set account for 1 / 10. During the division process, the training set images, the validation set images, and the test set images are randomly assigned. At this time, the data set is ready.

[0078] S152, inputting the training set into the initial detection model for training to obtain a first training model;

[0079] S153, inputting the verification set into the first training model for adjustment to obtain a second training model; in this step, the verification set images can be reused to adjust the first training model multiple times to obtain a more reliable and stable training model.

[0080] S154, inputting the test set into the second training model for testing to obtain the final vehicle detection model.

[0081] It should be noted that the various Yolo models illustrated above are all existing target detection algorithms, and the specific detection algorithms will not be described here in detail.

[0082] The vehicle detection model training method provided in this embodiment obtains a vehicle detection model for a slow-moving traffic system by training an existing detection model. The vehicle detection model can accurately, conveniently and reliably detect motor vehicles in non-motorized vehicle lanes, thereby improving the accuracy and practicality of the vehicle detection model.

[0083] According to another embodiment of the present invention, Figure 3 A flow chart of a vehicle monitoring method provided by the present invention, such as Figure 3As shown, the present invention provides a vehicle monitoring method, which monitors the intrusion of motor vehicles on non-motorized vehicle lanes based on the vehicle detection model provided in the above embodiment, so as to help the traffic management department to timely understand the intrusion of motor vehicles on slow traffic roads into non-motorized vehicle roads and take further actions. Specifically, the vehicle monitoring method includes:

[0084] S21, obtaining a monitoring video, where the monitoring video includes the driving conditions of vehicles on the current road section;

[0085] In this step, the monitoring video includes all traffic conditions of the road section that the user needs to monitor, such as motor vehicle lanes, non-motor vehicle lanes, and sidewalks. The monitoring video can be selected according to the actual needs of the user. The acquisition method of the monitoring video is not limited. For example, the monitoring video can be retrieved through the urban road monitoring command center.

[0086] S22, determining a non-motor vehicle lane area in the monitoring video;

[0087] Specifically, step 22 does not need to perform recognition detection on the entire video to be detected. Before recognition, a non-motorized vehicle lane area can be selected in the video to be detected, and the vehicles on the non-motorized vehicle lanes are mainly detected, while the sidewalks and motor vehicle lanes on both sides of the road are ignored, thereby reducing the number of boundary boxes corresponding to the target vehicle in the subsequent detection process and improving the detection and tracking speed of the target vehicle. Optionally, the non-motorized vehicle lane area is manually divided in the monitoring video.

[0088] It should be noted that step S22 can also be omitted, and there is no need to divide the non-motorized vehicle lane area. All data of the monitoring video will be detected later, which will not be repeated later.

[0089] S23, using a target vehicle detection model to detect motor vehicles in the non-motor vehicle lane area and identify the target vehicle; wherein the target vehicle detection model is trained based on the above-mentioned vehicle detection model training method;

[0090] Specifically, the detecting the vehicles in the non-motor vehicle lane area by using the target vehicle detection model to identify the target vehicle includes:

[0091] Step a, inputting the monitoring video into the target vehicle detection model;

[0092] Step b, the target vehicle detection model identifies the target vehicle in the video to be detected and marks it with a bounding box; wherein the target vehicle includes a motor vehicle traveling in the non-motor vehicle lane area; wherein, after the monitoring video is input into the target vehicle detection model, the target vehicle detection model detects the motor vehicle in the monitoring video according to pre-trained data, and determines whether the motor vehicle is traveling in the non-motor vehicle lane area, and the target vehicle detection model only outputs the motor vehicle in the non-motor vehicle lane area as the target vehicle, and marks the motor vehicle in the monitoring video with a bounding box.

[0093] Step c, obtaining the characteristic information of the target vehicle and saving it in a detection list, wherein the detection list includes a mapping relationship between the characteristic information of the target vehicle and the tracking ID of the target vehicle; optionally, the detection list is indexed by the video frame number, and stores a mapping relationship between the tracking ID and the characteristic information of the target vehicle under each video frame number.

[0094] After acquiring the characteristic information of each target vehicle, a tracking ID is set for each target vehicle. The same target vehicle has the same tracking ID, and the tracking ID of each target vehicle is unique. The tracking ID is used to identify its own information so as to establish a connection between adjacent frames in the video to be detected. The setting method of the tracking ID is not limited, and it can be a symbol that can be uniquely identified, such as a number, a letter, etc., which is not limited here.

[0095] Wherein, the feature information includes pixel position, width and height information, confidence threshold and category. Optionally, the pixel position is any image pixel on the bounding box that identifies the target vehicle, which can be the upper left corner position, the upper right corner position, the lower left corner position, the lower right corner position or the center position of the bounding box. In this embodiment, the pixel position is the central image pixel of the bounding box, which can make the measurement data more accurate. The width and height information are the width and height of the bounding box; the confidence threshold is a preset value, and the accuracy of the detection result can be limited by adjusting the confidence threshold; the category is the category of the currently identified target vehicle, such as a car.

[0096] S24, using a target tracking model to track the identified target vehicle, and dynamically monitor the intrusion time of the target vehicle in the non-motor vehicle lane area;

[0097] After the target vehicle is detected in step S23, since the target vehicle is in motion in the video, the detected target vehicle is further tracked in combination with the target tracking model. Optionally, the target tracking model uses an existing Deepsort model. In this embodiment, the detection list dectections can be passed into the DeepSort model to track the target vehicle.

[0098] During the tracking process, the intrusion time of the corresponding target vehicle is updated in real time according to the target vehicle appearing in each video frame, so that the driving time of each target vehicle in the non-motorized vehicle lane can be obtained. Figure 4 A flow chart of a method for dynamically monitoring the intrusion time of the target vehicle in the non-motorized vehicle lane area is shown. Specifically, Figure 4 As shown, the dynamic monitoring of the intrusion time of the target vehicle in the non-motor vehicle lane area includes:

[0099] S241, obtaining the target vehicle that first appears in the first frame of the monitoring video, recording the intrusion time of the target vehicle as 0, and establishing a mapping relationship between the tracking ID of the target vehicle and the intrusion time to generate a mapping set;

[0100] S242, executing a target vehicle tracking step according to the characteristic information of the target vehicle, the target vehicle tracking step comprising:

[0101] S2421, determine whether a target vehicle in the mapping set appears in the next frame of the monitoring video; this step can determine whether the same target vehicle appears in different video frames based on whether the tracking ID is the same.

[0102] S2422, if the target vehicle in the mapping set appears in the next frame of the monitoring video, then the intrusion time corresponding to the target vehicle in the mapping set is updated according to the interval time between two adjacent frames; or, if the target vehicle in the mapping set does not appear in the next frame of the monitoring video, then the existing relevant information of the target vehicle is deleted from the mapping set;

[0103] In step S2422, when the target vehicle in the mapping set does not appear in the next frame of the monitoring video, the relevant information of the target vehicle in the mapping set is deleted. Through this method, short-term driving or parking such as getting on and off the roadside can be excluded, further improving the accuracy of vehicle detection.

[0104] S2423, repeat the target vehicle tracking step.

[0105] As another optional embodiment, the determining whether a target vehicle in the mapping set appears in a subsequent frame of the monitoring video further includes:

[0106] If a target vehicle that does not exist in the mapping set appears in the next frame of the monitoring video, it is deemed that the target vehicle appears for the first time, the intrusion time corresponding to the target vehicle is recorded as 0, added to the mapping set and the above target vehicle tracking step is performed.

[0107] It can be understood as follows: In the first step, when starting detection and tracking, the tracking ID of the target vehicle that has not appeared before is added to the mapping set, and the corresponding intrusion time is recorded as 0; In the second step, if the tracking ID that appears in the next video frame appears in the mapping set, the intrusion time of the tracking ID is updated in the mapping set, and the time interval of two video frames is added to the intrusion time of 0, which is the current intrusion time of the target vehicle; If the tracking ID that appears in the next video frame has a tracking ID that has not appeared in the mapping set, execute the first step; If there is a tracking ID that does not need to be updated in the mapping set, delete the stored related information; In the third step, repeat the above second step.

[0108] The vehicle monitoring method provided by the present invention uses computer vision and image processing technology to mainly detect and track motor vehicles in the non-motorized vehicle lane area in the video frame to identify and track the vehicle, and dynamically update the intrusion time of the motor vehicle intruding the non-motorized vehicle lane by tracking the ID and maintaining a mapping set. Through this monitoring method, accurate, real-time, stable and reliable slow-moving traffic data can be provided.

[0109] In other optional embodiments, in order to ease the pressure of urban traffic and ensure the safety and smoothness of the urban traffic system, the vehicle monitoring method further includes:

[0110] S25, determining the violation status of the target vehicle according to the intrusion time.

[0111] Optionally, a threshold of intrusion time can be set to determine whether a motor vehicle has violated the rules. When the intrusion time exceeds the threshold, a reminder can be given to the front-end user, such as through a pop-up window, voice, sound, etc. In this way, it can help the traffic management department to timely understand the situation of motor vehicles on slow-moving traffic roads invading non-motorized vehicle roads, so as to deal with the target vehicles in a timely manner and improve the reliability and convenience of slow-moving traffic.

[0112] Based on a vehicle detection model training method provided in Example 1, this embodiment provides a training device corresponding to the above training method, and the same contents will not be repeated here. Figure 5 A schematic diagram of the structure of a vehicle detection model training device is shown. Figure 5 As shown, the vehicle detection model training device comprises:

[0113] An acquisition module 10 is used to acquire an initial detection model, wherein the initial detection model includes a Yolo model;

[0114] The acquisition module 20 is used to acquire multiple sets of non-motorized vehicle lane video data of the target road section at different time periods and environments;

[0115] The processing module 30 is used to pre-process the non-motorized vehicle lane video data to obtain a video image sequence and generate a video data set;

[0116] A labeling module 40 is used to label the pictures in the video data set according to the preset classification categories, and generate a corresponding label for each picture, wherein the label includes category information and location information;

[0117] The training module 50 is used to train the initial detection model using the annotated video data set until a vehicle detection model that meets preset conditions is obtained.

[0118] Further, the training module 50 includes a division unit 51, a first training unit 52, a second training unit 53, and a third training unit 54. The division unit 51 is used to divide the images in the annotated video data set to generate a training set, a validation set, and a test set; in this embodiment, the images in the video data set are divided according to a ratio of 8:1:1, that is, the images included in the training set account for 8 / 10, the images included in the validation set account for 1 / 10, and the images included in the test set account for 1 / 10. In the division process, the training set images, the validation set images, and the test set images are randomly allocated, and the data set is ready at this time.

[0119] The first training unit 52 is used to input the training set into the initial detection model for training to obtain a first training model;

[0120] The second training unit 53 is used to input the verification set into the first training model for adjustment to obtain a second training model; wherein the verification set images can be reused to adjust the first training model multiple times to obtain a more reliable and stable training model.

[0121] The third training unit 54 is used to input the test set into the second training model for testing to obtain the final vehicle detection model.

[0122] The vehicle detection model training device provided in the embodiment of the present invention obtains a vehicle detection model for a slow-moving traffic system by training an existing detection model. The vehicle detection model can accurately, conveniently and reliably detect motor vehicles in non-motorized vehicle lanes, thereby improving the accuracy and practicality of the vehicle detection model.

[0123] like Figure 6As shown, this embodiment further provides an electronic device 60, the electronic device 60 includes: a memory 61 and a processor 62, wherein:

[0124] The memory 61 is used to store computer programs;

[0125] The processor 62 is used to execute the computer program to implement the vehicle detection model training method described in the above embodiment and / or the vehicle monitoring method described in the above embodiment.

[0126] Regarding the specific process of the above-mentioned vehicle detection model training method and / or vehicle monitoring method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0127] The memory 61 is used as a carrier for storing resources, which may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc. The storage method may be temporary storage or permanent storage.

[0128] In addition, the electronic device 60 also includes a power supply 63, a communication interface 64, an input / output interface 65 and a communication bus 66; wherein the power supply 63 is used to provide working voltage for each hardware device on the electronic device 60; the communication interface 64 can create a data transmission channel between the electronic device 60 and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input / output interface 65 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0129] Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described device and equipment can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0130] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative.

[0131] Those skilled in the art should understand that the scope of the invention involved in the present invention is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) to form a technical solution.

[0132] It should be understood that the size of the serial numbers of each step in the content of the invention and the embodiments of the present invention does not absolutely mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

Claims

1. A vehicle detection model training method for a slow-moving traffic system, characterized in that: include: Acquire an initial detection model, wherein the initial detection model includes a Yolo model; Collect multiple sets of non-motorized vehicle lane video data of the target road section at different time periods and environments; Preprocessing the non-motorized vehicle lane video data to obtain a video image sequence and prepare a video data set; Annotate the images in the video data set according to the preset classification categories, and generate a corresponding label for each image, wherein the label includes category information and location information; The initial detection model is trained using the annotated video data set until a vehicle detection model that meets preset conditions is obtained; The preprocessing of the non-motorized vehicle lane video data to obtain a video image sequence and prepare a video data set includes: Using the ffmpeg tool, capture pictures every 8-12 frames in the non-motorized vehicle lane video data to obtain a video image sequence; Constructing a video dataset from a plurality of pictures in the video image sequence; Methods for training the initial detection model include: Divide the images in the annotated video dataset to generate training sets, validation sets, and test sets; Inputting the training set into the initial detection model for training to obtain a first training model; Inputting the verification set into the first training model for adjustment to obtain a second training model; Inputting the test set into the second training model for testing to obtain the final vehicle detection model; The invention also includes a vehicle monitoring method for a slow-moving traffic system based on the vehicle detection model, including: Acquire monitoring video, where the monitoring video includes the driving conditions of vehicles on the current road section; Determine the non-motorized vehicle lane area in the monitoring video; Using a target vehicle detection model to detect vehicles in the non-motorized vehicle lane area and identify the target vehicle; and using a target tracking model to track the identified target vehicle and dynamically monitor the intrusion time of the target vehicle in the non-motorized vehicle lane area; The target vehicle detection model is obtained based on the vehicle detection model training method; The detecting of the vehicles in the non-motor vehicle lane area by using the target vehicle detection model to identify the target vehicle includes: Inputting the monitoring video into the target vehicle detection model; The target vehicle detection model identifies the target vehicle in the monitoring video and marks it by a bounding box; wherein the target vehicle includes a motor vehicle traveling in the non-motor vehicle lane area; Acquire characteristic information of the target vehicle and save it in a detection list, wherein the detection list includes a mapping relationship between the characteristic information of the target vehicle and the tracking ID of the target vehicle; wherein the characteristic information includes pixel position, width and height information, confidence threshold and category; The method of tracking the identified target vehicle by using the target tracking model and dynamically monitoring the intrusion time of the target vehicle in the non-motor vehicle lane area includes: Obtain the target vehicle that first appears in the first frame of the monitoring video, record the intrusion time of the target vehicle as 0, and simultaneously establish a mapping relationship between the tracking ID of the target vehicle and the intrusion time to generate a mapping set; According to the characteristic information of the target vehicle, a target vehicle tracking step is performed, and the target vehicle tracking step includes: According to the tracking ID, determining whether a target vehicle in the mapping set appears in a subsequent frame of the monitoring video; If the target vehicle in the mapping set appears in the next frame of the monitoring video, the intrusion time corresponding to the target vehicle in the mapping set is updated according to the interval time between two adjacent frames; or, if the target vehicle in the mapping set does not appear in the next frame of the monitoring video, the existing relevant information of the target vehicle is deleted from the mapping set; Repeat the target vehicle tracking step.

2. The vehicle detection model training method according to claim 1, characterized in that: The step of labeling the images in the video data set according to the preset classification categories and generating a corresponding label for each image includes: Using the Labelimg tool, label each picture in the video dataset according to the preset classification category, and generate category information and location information of each picture; Among them, the preset classification categories include motor vehicle category, cycling category and pedestrian category.

3. The vehicle detection model training method according to claim 1, characterized in that: The initial detection model is trained using the annotated video data set until a vehicle detection model that meets preset conditions is obtained, including: Input the annotated video data set into the initial detection model, train the initial detection model according to preset parameters until the weight file with the highest accuracy in the training round is obtained, and export the trained vehicle detection model; The preset parameters include the batch size and training rounds of training.

4. The vehicle detection model training method according to claim 1, characterized in that: The determining whether a target vehicle in the mapping set appears in a subsequent frame of the monitoring video further includes: If a target vehicle that does not exist in the mapping set appears in the next frame of the monitoring video, it is deemed that the target vehicle appears for the first time, the intrusion time of the target vehicle is recorded as 0, and the mapping relationship between the tracking ID of the target vehicle and the intrusion time is added to the mapping set; and the target vehicle tracking step is executed at the same time.

5. A vehicle detection model training device for a slow-moving traffic system, referring to the vehicle detection model training method according to any one of claims 1 to 4, characterized in that: include: An acquisition module, used to acquire an initial detection model, wherein the initial detection model includes a Yolo model; A collection module, used to collect multiple sets of non-motorized vehicle lane video data of the target road section at different time periods and environments; A processing module, used for preprocessing the non-motorized vehicle lane video data to obtain a video image sequence and generate a video data set; A labeling module, used to label the pictures in the video data set according to preset classification categories, and generate a corresponding label for each picture, wherein the label includes category information and location information; The training module is used to train the initial detection model using the annotated video data set until a vehicle detection model that meets preset conditions is obtained.

6. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store the computer program; The processor is used to execute the computer program to implement the vehicle detection model training method as described in any one of claims 1 to 4.