CN113781796B - Traffic flow detection method and device based on video virtual coil - Google Patents

Traffic flow detection method and device based on video virtual coil Download PDF

Info

Publication number
CN113781796B
CN113781796B CN202110951430.1A CN202110951430A CN113781796B CN 113781796 B CN113781796 B CN 113781796B CN 202110951430 A CN202110951430 A CN 202110951430A CN 113781796 B CN113781796 B CN 113781796B
Authority
CN
China
Prior art keywords
vehicle
virtual coil
information
detection
virtual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110951430.1A
Other languages
Chinese (zh)
Other versions
CN113781796A (en
Inventor
范超
冯栋
张永
陈洪伟
刘浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Turing Technology Co ltd
Original Assignee
Qingdao Turing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Turing Technology Co ltd filed Critical Qingdao Turing Technology Co ltd
Priority to CN202110951430.1A priority Critical patent/CN113781796B/en
Publication of CN113781796A publication Critical patent/CN113781796A/en
Application granted granted Critical
Publication of CN113781796B publication Critical patent/CN113781796B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/01Detecting movement of traffic to be counted or controlled
    • G08G1/04Detecting movement of traffic to be counted or controlled using optical or ultrasonic detectors
    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/01Detecting movement of traffic to be counted or controlled
    • G08G1/0104Measuring and analyzing of parameters relative to traffic conditions
    • G08G1/0137Measuring and analyzing of parameters relative to traffic conditions for specific applications
    • G08G1/0145Measuring and analyzing of parameters relative to traffic conditions for specific applications for active traffic flow control
    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/065Traffic control systems for road vehicles by counting the vehicles in a section of the road or in a parking area, i.e. comparing incoming count with outgoing count
    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/07Controlling traffic signals
    • G08G1/08Controlling traffic signals according to detected number or speed of vehicles
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Chemical & Material Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Traffic Control Systems (AREA)

Abstract

The invention provides a traffic flow detection method and a device based on a video virtual coil, wherein at least one virtual coil for detecting traffic flow is configured in a video picture to obtain position information and number information of each virtual coil; acquiring a real-time video stream, and decoding the real-time video stream to obtain a video frame image; processing the video frame image by using a vehicle detection and tracking algorithm to obtain detection and tracking information of each vehicle; the detection tracking information of each vehicle comprises detection frame information and ID information of each vehicle; determining the current state of each virtual coil according to the detection tracking information of each vehicle and the position information of each virtual coil; wherein the current state of each virtual coil reflects the traffic flow of the road area corresponding to each virtual coil. According to the scheme of the invention, a geomagnetic coil does not need to be arranged below the road surface, the accurate detection of the road traffic flow is realized by using the video virtual coil, and the method has the advantages of strong real-time performance, accurate detection and low cost.

Description

Traffic flow detection method and device based on video virtual coil
Technical Field
The invention relates to the technical field of intelligent traffic, in particular to a traffic flow detection method and device based on a video virtual coil.
Background
With the promotion of the urbanization process of China, the urban road is continuously expanded, the living standard of people is continuously improved, automobiles become necessary transportation tools for people to live, and various urban transportation problems are highlighted.
In order to solve the urban traffic problem, particularly the problem of vehicle congestion on roads, more and more facilities such as electronic policemen, bayonets, geomagnetic coils and the like are put into use to assist in detecting the traffic flow of the roads, so that lanes with large traffic flow are dredged.
Therefore, on the basis of the existing equipment, the design of the traffic flow detection method with strong real-time performance, accurate detection and low cost is a hotspot of research in the technical field of intelligent traffic.
Disclosure of Invention
The invention provides a traffic flow detection method and a device based on a video virtual coil, wherein the virtual coil is configured in a video picture and used for simulating a geomagnetic coil in practice, the virtual coil is used for determining the virtual coil occupied by a vehicle in a video at any moment, and further the traffic flow of a road is determined.
In a first aspect, the present invention provides a traffic flow detection method based on a video virtual coil, including:
configuring at least one virtual coil for detecting traffic flow in a video picture to obtain position information and number information of each virtual coil;
acquiring a real-time video stream, and decoding the real-time video stream to obtain a video frame image;
processing the video frame image by using a vehicle detection tracking algorithm to obtain detection tracking information of each vehicle; the detection tracking information of each vehicle comprises detection frame information and ID information of each vehicle;
determining the current state of each virtual coil according to the detection tracking information of each vehicle and the position information of each virtual coil; and the current state of each virtual coil reflects the traffic flow of the road area corresponding to each virtual coil.
In an optional embodiment, the processing the video frame image by using the vehicle detection and tracking algorithm to obtain the detection and tracking information of each vehicle includes:
detecting all vehicles in the video frame image by using a Yolov5 model, and carrying out forward reasoning acceleration by adopting a TensorRT technology to obtain detection frame information of each vehicle;
and tracking each detected vehicle by utilizing a Sort tracking algorithm to determine the tracking result of each vehicle, and endowing the same ID information for the same vehicle in different images according to the tracking result of each vehicle.
In an optional embodiment, the determining the current state of each virtual coil according to the detection tracking information of each vehicle and the position information of each virtual coil includes:
comparing the detection frame information of each vehicle in the initial time image with the position information of each virtual coil to determine the virtual coil occupied by each vehicle at the initial time, so as to obtain the initial state of each virtual coil, and binding the ID information of each vehicle in the initial time image with the number information of the virtual coil occupied by each vehicle to obtain initial binding relationship information;
and taking the binding relationship information at the previous moment as the latest initial binding relationship information for determining the state of each virtual coil at the current moment, repeatedly comparing the detection frame information of each vehicle in the image at the current moment with the position information of each virtual coil based on the latest initial binding relationship information to determine the virtual coil occupied by each vehicle at the current moment, obtaining the current state of each virtual coil, and updating the latest initial binding relationship information according to the virtual coil occupied by each vehicle at the current moment.
Further, the determining the virtual coils occupied by the vehicles at the initial time by comparing the detection frame information of the vehicles in the image at the initial time with the position information of the virtual coils includes:
reducing the width of the detection frame of the vehicle to obtain the reduced detection frame information of the vehicle;
calculating the intersection area of the detection frame of the reduced vehicle and each virtual coil according to the detection frame information of the reduced vehicle and the position information of each virtual coil;
if the intersection area is larger than a preset area threshold value, determining a virtual coil occupied by the vehicle;
the above steps are repeated until the virtual coil occupied by each vehicle is determined.
Further, the determining the virtual coils occupied by the vehicles at the current time by comparing the detection frame information of the vehicles in the image at the current time with the position information of the virtual coils based on the latest initial binding relationship information includes:
determining whether each vehicle in the current image occupies the virtual coil or not according to the latest initial binding relationship information;
the method for determining the virtual coil occupied by the vehicle by comparing the detection frame information of the vehicle without occupying the virtual coil with the position information of each virtual coil is as claimed in claim 4.
Comparing the detection frame information of the vehicle occupying the virtual coil with the position information of the virtual coil occupied by the vehicle to determine whether the vehicle still occupies the virtual coil occupied by the vehicle;
if so, using the virtual coil occupied by the vehicle before as the virtual coil occupied by the vehicle at the current time, otherwise, comparing the detection frame information of the vehicle with the position information of other virtual coils to determine the virtual coil occupied by the vehicle at the current time, wherein the specific steps are as recited in claim 4.
Further, the comparing the detection frame information of the vehicle that has occupied the virtual coil with the position information of the virtual coil that has occupied by the vehicle to determine whether the vehicle still occupies the virtual coil that has been occupied by the vehicle before includes:
calculating the intersection area of the detection frame of the vehicle and the virtual coil occupied by the vehicle according to the detection frame information of the vehicle occupying the virtual coil and the position information of the virtual coil occupied by the vehicle;
if the intersection area is larger than a preset area threshold value, determining that the vehicle still occupies the virtual coil which is occupied by the vehicle before.
In an optional embodiment, the method further comprises:
binary assignment is carried out according to the current state of each virtual coil, and a virtual coil state code is generated;
and sending the virtual coil state code to a signal machine so as to dynamically adjust traffic lights at a traffic intersection in real time.
In a second aspect, the present invention provides a traffic flow detection device based on a video virtual coil, wherein the device is configured to execute the traffic flow detection method according to any one of the first aspect.
In a third aspect, the present invention provides a computer apparatus comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executes computer-executable instructions stored in the memory to cause the at least one processor to perform the method of detecting vehicle traffic according to any one of the first aspect.
The invention provides a traffic flow detection method and a device based on a video virtual coil.A video picture is provided with at least one virtual coil for detecting the traffic flow, and the position information and the number information of each virtual coil are obtained; acquiring a real-time video stream, and decoding the real-time video stream to obtain a video frame image; processing the video frame image by using a vehicle detection tracking algorithm to obtain detection tracking information of each vehicle; the detection tracking information of each vehicle comprises detection frame information and ID information of each vehicle; determining the current state of each virtual coil according to the detection tracking information of each vehicle and the position information of each virtual coil; and the current state of each virtual coil reflects the traffic flow of the road area corresponding to each virtual coil. Compared with the prior art, the traffic flow detection method based on the video virtual coils does not need to install a geomagnetic coil below the road surface, the virtual coils are configured in the video picture to simulate the geomagnetic coil in reality, the virtual coils are used for determining the position relation between the vehicle and the virtual coils in the video at any moment, and then the traffic flow of the road is determined.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic diagram of a scenario architecture upon which the present disclosure is based;
fig. 2 is a schematic flowchart of a traffic flow detection method based on a video virtual coil according to an embodiment of the present disclosure;
FIG. 3 is a schematic flow chart diagram illustrating a vehicle detection and tracking method provided by an embodiment of the present disclosure;
fig. 4 is a schematic flowchart of a method for detecting a state of a virtual coil according to an embodiment of the present disclosure;
fig. 5 is a schematic flow chart of another method for detecting traffic flow based on a video virtual coil according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a vehicle flow rate detection device based on a video virtual coil according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure.
Description of the preferred embodiment
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
At present, the intersections of cities are basically provided with geomagnetic coils to provide a basis for the tuning control of traffic signal lamps. However, the traditional geomagnetic coil has some defects, such as large-area damage to the road surface, higher technology for installation and construction requirements and high maintenance and replacement cost; in addition, wireless geomagnetism is also available, and although the wireless geomagnetism is convenient to install and does not damage the road surface greatly, part of the road surface still needs to be damaged during construction, and normal traffic is affected. And once the installation wants to change the position again, can only construct again, has improved the operation cost.
With the development of urban intelligent traffic, at present, electronic polices or bayonets are basically installed at each intersection for the requirements of traffic violation or control, and besides the above tasks, the devices can also be configured with a function of simulating an actual geomagnetic coil in a video, and the traffic flow detection is realized by combining a video analysis technology.
Fig. 1 is a schematic diagram of a scene architecture based on the present disclosure, and as shown in fig. 1, the scene architecture based on the present disclosure may include a traffic flow detection device 1 and a camera 2.
The traffic flow detection device 1 is hardware or software that can interact with the camera 2 through a network, and can be used to execute the traffic flow detection method described in each embodiment described below.
When the traffic flow rate detection device 1 is hardware, it may be an electronic device having an arithmetic function. When the traffic flow rate detection device 1 is software, it may be installed in an electronic device having an arithmetic function. Including but not limited to servers, notebook and desktop computers, and the like.
The camera 2 may be a hardware device having a shooting function, such as a gun camera, a ball camera, a micro-bayonet, and the like, and the traffic flow detection device 1 may be a server integrated or installed on the camera 2.
The traffic flow detection device 1 may operate on the camera 2 and provide a traffic flow detection service for the camera 2, and the traffic flow detection device 1 displays a traffic flow detection result to a user using a display or a display component thereof.
Of course, in other usage scenarios, the traffic flow detection device 1 may also be integrated into a server for processing vehicle video, in which case, the camera 2 may be a device including a bolt, a ball, a mini-bayonet, and the like, which can communicate and interact data with the aforementioned traffic flow detection device 1 through a network. The camera 2 can send the real-time video stream to the traffic flow detection device 1, so that the traffic flow detection device 1 performs traffic flow detection on the real-time video stream by using the following method.
The following further describes the traffic flow detection method and apparatus based on the video virtual coil provided in the present application:
fig. 2 is a schematic flow chart of a traffic flow detection method based on a video virtual coil according to an embodiment of the present disclosure. As shown in fig. 2, a traffic flow detection method based on a video virtual coil provided in the embodiment of the present disclosure includes:
s21, at least one virtual coil for detecting the traffic flow is configured in the video picture, and the position information and the number information of each virtual coil are obtained.
The virtual coils are wire frames configured in a video picture so as to simulate geomagnetic coils arranged on an actual road, the position information of the virtual coils is coordinates of the virtual coils in the video picture, and the number information of the virtual coils is a unique identity number given to the virtual coils when the virtual coils are configured so as to identify each virtual coil.
In the embodiment, when the virtual coil is configured in the video picture, the video player is used for displaying the road video picture needing to be configured with the virtual coil at present, the picture frame plug-in is used for drawing a line frame in the video picture according to requirements, the line frame is of a polygonal structure, and if the virtual coil is configured for the first time, the line frame is directly drawn in the video picture according to requirements; if the virtual coil is configured before, the wire frame drawn before can be deleted, and then a new wire frame can be drawn again according to the latest requirement. And after the configuration of the virtual coils is finished, obtaining the coordinates of each virtual coil in a video picture, and endowing each virtual coil with an identity number, wherein the identity number of each virtual coil is unique.
And S22, acquiring the real-time video stream, and decoding the real-time video stream to obtain a video frame image.
In this embodiment, after the virtual coil is configured, the real-time video stream may be accessed based on the RTSP, and the original image data may be decoded from the real-time video stream data by using a hardware decoding chip NVDEC provided by a hardware device Jetson Xavier NX.
S23, processing the video frame image by using a vehicle detection tracking algorithm to obtain detection tracking information of each vehicle; wherein the detection tracking information of each vehicle includes detection frame information and ID information of each vehicle.
The detection frame information of the vehicle comprises coordinates of the detection frame of the vehicle in the image, and the ID information of the vehicle is a unique identity number given to the detected vehicle.
In this embodiment, a vehicle detection algorithm may be first used to detect vehicles in an image, where the vehicle detection algorithm at least includes one of a YOLO algorithm, an SSD algorithm, and a fast-RCNN algorithm, and then a two-dimensional vehicle detection frame generated by the vehicle detection algorithm and an sortt multi-target tracking method are combined to track a detected vehicle target until the vehicle leaves a detection area, so as to finally obtain detection frame information and ID information of each vehicle in each frame of image.
For example, 3 cars are detected in a first frame image by using a vehicle detection algorithm, detection frames surrounding the cars are generated around each car, coordinates of the detection frames of the 3 cars in the image are obtained and are respectively numbered as 1, 2 and 3, the next frame image is continuously detected by using the vehicle detection algorithm, the detected vehicle target is tracked by combining a two-dimensional vehicle detection frame generated by the vehicle detection algorithm and an SORT multi-target tracking method, and 5 cars are detected, wherein 3 cars are in the first frame image, other 2 cars are just entering the detection area, the detection frames surrounding the cars are generated around each car, the coordinates of the detection frames of the 5 cars in the image are obtained, the numbers of the 3 cars existing before are still 1, 2 and 3, and the numbers of the other 2 cars are still numbered as 4 and 5.
S24, determining the current state of each virtual coil according to the detection tracking information of each vehicle and the position information of each virtual coil; and the current state of each virtual coil reflects the traffic flow of the road area corresponding to each virtual coil.
In this embodiment, in order to detect the traffic flow of the road area corresponding to each virtual coil in real time, whether each virtual coil is occupied by a vehicle is determined by using the detection tracking information of each vehicle and the position information of each virtual coil in each frame of image, specifically, the intersection area between the detection frame of each vehicle and each virtual coil is calculated according to the coordinates of the detection frame of each vehicle in the image and the coordinates of each virtual coil in the video image, the overlapping condition between the detection frame of each vehicle and each virtual coil is determined according to the intersection area, so as to determine the virtual coil occupied by each vehicle, and further determine the traffic flow of the road area corresponding to each virtual coil.
The embodiment provides a traffic flow detection method based on a video virtual coil, wherein at least one virtual coil for detecting traffic flow is configured in a video picture to obtain position information and number information of each virtual coil; acquiring a real-time video stream, and decoding the real-time video stream to obtain a video frame image; processing the video frame image by using a vehicle detection and tracking algorithm to obtain detection and tracking information of each vehicle; the detection tracking information of each vehicle comprises detection frame information and ID information of each vehicle; determining the current state of each virtual coil according to the detection tracking information of each vehicle and the position information of each virtual coil; and the current state of each virtual coil reflects the traffic flow of the road area corresponding to each virtual coil. The traffic flow detection method based on the video virtual coils provided by the embodiment configures virtual coils in a video picture to simulate geomagnetic coils in practice, and determines the current state of each virtual coil by using detection tracking information of each vehicle obtained by a detection tracking algorithm and position information of each virtual coil configured in the video picture, so that the traffic flow of a road is accurately detected, and the method has the advantages of strong real-time performance, accurate detection and low cost.
In order to accurately obtain the detection frame information and the ID information of each vehicle in each frame of image, on the basis of the embodiment shown in fig. 2, fig. 3 is a schematic flow chart of a vehicle detection and tracking method provided in the embodiment of the present disclosure, and the method provided in the embodiment of the present disclosure is further described with respect to the step S23 in the foregoing embodiment, as shown in fig. 3, S23 includes:
s231, detecting all vehicles in the video frame image by using a Yolov5 model, and carrying out forward reasoning acceleration by adopting a TensorRT technology to obtain detection frame information of each vehicle;
and S232, tracking each detected vehicle by utilizing a Sort tracking algorithm to determine the tracking result of each vehicle, and endowing the same vehicle in different images with the same ID information according to the tracking result of each vehicle.
In the embodiment, all vehicles in a video frame image are detected by adopting a Yolov5 model, a two-dimensional vehicle detection frame surrounding the vehicles is generated, forward reasoning acceleration is carried out by adopting a TensorRT technology to improve the detection speed, the detection frame information of each vehicle is obtained, then the detected vehicle target is tracked by combining the two-dimensional vehicle detection frame generated by the Yolov5 model and an SORT multi-target tracking algorithm until the vehicle leaves the detection area, and the same ID information is given to the same vehicle in different images according to the tracking result of each vehicle.
In order to accurately detect the traffic flow in the video, on the basis of the embodiment described in fig. 2, fig. 4 is a schematic flow chart of a method for detecting the state of the virtual coil provided in the embodiment of the present disclosure, where the method provided in the embodiment of the present disclosure is a further description of the step S24 in the foregoing embodiment, and as shown in fig. 4, S24 includes:
s241, comparing the detection frame information of each vehicle in the initial time image with the position information of each virtual coil to determine the virtual coil occupied by each vehicle at the initial time, obtaining the initial state of each virtual coil, and binding the ID information of each vehicle in the initial time image with the number information of the virtual coil occupied by each vehicle to obtain initial binding relation information.
In this embodiment, in order to reduce false detection caused by collision between the detection frame of the vehicle and the virtual coil of the adjacent lane, the detection frame of the vehicle may be adaptively reduced, the intersection area between the detection frame of each reduced vehicle and each virtual coil is calculated according to the coordinates of the detection frame of each reduced vehicle in the image and the coordinates of each virtual coil in the video image, and the overlapping condition between the detection frame of each vehicle and each virtual coil is determined according to the intersection area, so as to determine the virtual coil occupied by each vehicle.
Specifically, the width of a detection frame of the vehicle is reduced to obtain the reduced detection frame information of the vehicle; calculating the intersection area of the detection frame of the reduced vehicle and each virtual coil according to the detection frame information of the reduced vehicle and the position information of each virtual coil; if the intersection area is larger than a preset area threshold value, determining a virtual coil occupied by the vehicle; the above steps are repeated until the virtual coil occupied by each vehicle is determined.
In the first example, 3 virtual coils are configured in three lanes of an intersection, which are respectively numbered as 1, 2, and 3, 3 cars are detected in a first frame image, coordinates of detection frames of the 3 cars in the image are obtained, the 3 cars are respectively numbered as 1, 2, and 3, two sides of the width of the detection frames of the 3 cars are respectively reduced by 1/3, coordinates of the detection frames of the 3 reduced cars in the image are calculated, the intersection area of the detection frame of each car and each virtual coil is calculated by using the coordinates of the detection frames of the 3 reduced cars in the image and the coordinates of the 3 virtual coils in a video picture, the intersection area of the intersection of the detection frame of each car and each virtual coil is obtained, the intersection area of the car 1 and the virtual coil 1 is 508 pixels, the intersection area of the car 2 and the virtual coil 2 is 531 pixels, the car 3 does not intersect with any virtual coil, since the intersection area of the car 1 and the virtual coil 1 is 508 pixels larger than a preset area threshold value of 400 pixels, the car 1 occupies the virtual coil 1, and is similar, the intersection area of the virtual coil 2 is 531 pixels larger than the preset area of the virtual coil 2, the virtual coil, and the virtual coil is not bound with the car, and the other virtual coil 2, the virtual coil 1 and the virtual coil is bound with the virtual coil 2.
And S242, taking the binding relationship information at the previous moment as the latest initial binding relationship information for determining the state of each virtual coil at the current moment, repeatedly comparing the detection frame information of each vehicle in the image at the current moment with the position information of each virtual coil based on the latest initial binding relationship information to determine the virtual coil occupied by each vehicle at the current moment, obtaining the current state of each virtual coil, and updating the latest initial binding relationship information according to the virtual coil occupied by each vehicle at the current moment.
In this embodiment, since the vehicle is in a moving state in the video, the state of the virtual coil also changes along with the movement of the vehicle, and in order to ensure the speed of detecting the state of the virtual coil, it may be determined whether each vehicle occupies the virtual coil at the current time according to the binding relationship information, and different operations are performed on the vehicle that does not occupy the virtual coil and the vehicle that occupies the virtual coil to determine the current state of each virtual coil.
Specifically, in one possible embodiment, it is determined whether each vehicle in the image at the present time has occupied the virtual coil according to the latest initial binding relationship information; comparing the detection frame information of the vehicle without occupying the virtual coil with the position information of each virtual coil to determine the virtual coil occupied by the vehicle, wherein the specific steps are as described in the step S231; calculating the overlapping area of the detection frame of the vehicle and the virtual coil occupied by the vehicle according to the detection frame information of the vehicle occupying the virtual coil and the position information of the virtual coil occupied by the vehicle; judging whether the coincidence area is larger than a preset area threshold value or not; if so, the virtual coil occupied by the vehicle before is used as the virtual coil occupied by the vehicle at the current time, otherwise, the detection frame information of the vehicle is compared with the position information of other virtual coils to determine the virtual coil occupied by the vehicle at the current time, and the specific steps are as described in the foregoing step S231.
Example two, based on the foregoing example one, the latest initial binding relationship information is that the vehicle 1 is bound to the virtual coil 1 and the vehicle 2 is bound to the virtual coil 2, 5 cars are detected in the second frame image, wherein 3 cars are in the first frame image and 2 cars are just entering the detection area, and the number of the 3 cars that have existed before is still 1, 2, 3, and 2 cars are numbered 4, 5, since the vehicle 1 is bound to the virtual coil 1 and the vehicle 2 is bound to the virtual coil 2, it is determined that none of the vehicle 3, the vehicle 4, and the vehicle 5 occupies a virtual coil, it is determined that the vehicle 3 occupies a virtual coil 3 and none of the virtual coils is occupied by comparing the detection frame information of the vehicle 1 with the position information of the virtual coil 1, it is determined that the vehicle 1 still occupies a virtual coil 1, it is determined that the vehicle 2 no longer occupies a virtual coil 2 by comparing the detection frame information of the vehicle 2 with the position information of the virtual coil 1, it is determined that the vehicle 2 does not occupy a virtual coil 1, it is determined that the virtual coil 2 occupies a virtual coil 3, it is not occupied by comparing the detection frame information of the vehicle 2 with the virtual coil 2 with the other virtual coil 1, and the virtual coil 3, it is determined that the vehicle 2, and no virtual coil is finally determined that the vehicle 2, and no other virtual coil 1, it is not occupied by comparing the virtual coil 1, and the virtual coil 3, and the virtual coil.
After the current state of each virtual coil is determined, since the current state of each virtual coil can reflect the traffic flow of the road area corresponding to each virtual coil, the current state of each virtual coil can be used to control the traffic signal lamp, and on the basis of the above embodiment, fig. 5 is a schematic flow diagram of another traffic flow detection method based on a video virtual coil according to the embodiment of the present disclosure, where the method further includes:
and S25, performing binary assignment according to the current state of each virtual coil to generate a virtual coil state code.
In this embodiment, the virtual coil occupied by the vehicle may be coded as 1, and the virtual coil not occupied by the vehicle may be coded as 0.
And S26, sending the virtual coil state code to a signal machine to dynamically adjust traffic signal lamps of the traffic intersection in real time.
The signal machine is one of the important components of modern urban traffic system, and is mainly used for controlling and managing urban road traffic signals.
In this embodiment, the virtual coil state code may be sent to the annunciator through RS485 serial communication, and when the states of all the virtual coils do not change, the virtual coil state code is not sent to the annunciator, and when the state of at least one virtual coil changes, the newly generated virtual coil state code is sent to the annunciator.
The state of the virtual coil is converted into the binary code in the embodiment through the binary assignment mode, the binary assignment is sent to the signal machine, the signal machine can be assisted to control the traffic signal lamp of the traffic intersection, and real-time dynamic adjustment of the traffic signal lamp according to the traffic flow is achieved.
Fig. 6 is a schematic structural diagram of a traffic flow detection device based on a video virtual coil according to an embodiment of the present disclosure. For ease of illustration, only portions that are relevant to embodiments of the present disclosure are shown. Referring to fig. 6, the video virtual coil-based traffic flow detection apparatus includes:
a configuration module 61, configured to configure at least one virtual coil for detecting traffic flow in a video frame, and obtain position information and number information of each virtual coil;
a decoding module 62, configured to obtain a real-time video stream, and decode the real-time video stream to obtain a video frame image;
the vehicle detection tracking module 63 is configured to process the video frame image by using a vehicle detection tracking algorithm to obtain detection tracking information of each vehicle; the detection tracking information of each vehicle comprises detection frame information and ID information of each vehicle;
a determining module 64, configured to determine a current state of each virtual coil according to the detection tracking information of each vehicle and the position information of each virtual coil; and the current state of each virtual coil reflects the traffic flow of the road area corresponding to each virtual coil.
Optionally, the vehicle detecting and tracking module 63 is specifically configured to:
detecting all vehicles in the video frame image by using a Yolov5 model, and carrying out forward reasoning acceleration by adopting a TensorRT technology to obtain detection frame information of each vehicle;
and tracking each detected vehicle by utilizing a Sort tracking algorithm to determine the tracking result of each vehicle, and endowing the same ID information for the same vehicle in different images according to the tracking result of each vehicle.
Optionally, the determining module 64 is specifically configured to:
comparing the detection frame information of each vehicle in the initial time image with the position information of each virtual coil to determine the virtual coil occupied by each vehicle at the initial time, so as to obtain the initial state of each virtual coil, and binding the ID information of each vehicle in the initial time image with the number information of the virtual coil occupied by each vehicle to obtain initial binding relationship information;
and taking the binding relationship information at the previous moment as the latest initial binding relationship information for determining the state of each virtual coil at the current moment, repeatedly comparing the detection frame information of each vehicle in the image at the current moment with the position information of each virtual coil based on the latest initial binding relationship information to determine the virtual coil occupied by each vehicle at the current moment, obtaining the current state of each virtual coil, and updating the latest initial binding relationship information according to the virtual coil occupied by each vehicle at the current moment.
Further, the determining module 64 is specifically configured to:
reducing the width of the detection frame of the vehicle to obtain the reduced detection frame information of the vehicle;
calculating the intersection area of the detection frame of the reduced vehicle and each virtual coil according to the detection frame information of the reduced vehicle and the position information of each virtual coil;
if the intersection area is larger than a preset area threshold value, determining a virtual coil occupied by the vehicle;
the above steps are repeated until the virtual coil occupied by each vehicle is determined.
Further, the determining module 64 is specifically configured to:
determining whether each vehicle in the image at the current moment occupies a virtual coil or not according to the latest initial binding relation information;
comparing the detection frame information of the vehicle which does not occupy the virtual coil with the position information of each virtual coil to determine the virtual coil occupied by the vehicle;
calculating the coincidence area of the detection frame of the vehicle and the virtual coil occupied by the vehicle according to the detection frame information of the vehicle occupying the virtual coil and the position information of the virtual coil occupied by the vehicle, and judging whether the coincidence area is larger than a preset area threshold value or not;
if so, using the virtual coil occupied by the vehicle before as the virtual coil occupied by the vehicle at the current time, otherwise, comparing the detection frame information of the vehicle with the position information of other virtual coils to determine the virtual coil occupied by the vehicle at the current time, wherein the specific steps are as recited in claim 4.
Optionally, the apparatus further comprises: a sending module 65;
the sending module is used for carrying out binary assignment according to the current state of each virtual coil to generate a virtual coil state code; and sending the virtual coil state code to a signal machine to dynamically adjust traffic signal lamps of the traffic intersection in real time.
The embodiment provides a traffic flow detection device based on a video virtual coil, which is characterized in that a configuration module 61 is used for configuring at least one virtual coil for detecting traffic flow in a video picture, and obtaining position information and number information of each virtual coil; acquiring a real-time video stream through a decoding module 62, and decoding the real-time video stream to obtain a video frame image; processing the video frame image by using a vehicle detection tracking algorithm through a vehicle detection tracking module 63 to obtain detection tracking information of each vehicle; the detection tracking information of each vehicle comprises detection frame information and ID information of each vehicle; determining the current state of each virtual coil according to the detection tracking information of each vehicle and the position information of each virtual coil through a determination module 64; and the current state of each virtual coil reflects the traffic flow of the road area corresponding to each virtual coil. The traffic flow detection device based on the video virtual coils provided by the embodiment can configure the virtual coils in the video picture to simulate the geomagnetic coils in reality, and determine the current states of the virtual coils by using the detection tracking information of each vehicle obtained by the detection tracking algorithm and the position information of each virtual coil configured in the video picture, so that the accurate detection of the traffic flow of the road is realized, and the device has the advantages of strong real-time performance, accurate detection and low cost.
Fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure, and as shown in fig. 7, an electronic device 70 according to this embodiment may include: memory 71, processor 72.
A memory 71 for storing a computer program (such as an application program, a functional module, and the like implementing the above-described one video virtual coil-based traffic flow detection method), a computer instruction, and the like;
the computer programs, computer instructions, etc. described above may be stored in partitions in one or more memories 71. And the computer program, computer instructions, etc. described above may be invoked by the processor 72.
A processor 72 for executing the computer program stored in the memory 71 to implement the steps of the method according to the above embodiments.
Reference may be made in particular to the description relating to the previous method embodiments.
The memory 71 and the processor 72 may be separate structures or may be an integrated structure integrated together. When the memory 71 and the processor 72 are separate structures, the memory 71 and the processor 72 may be coupled by a bus 73.
The electronic device of this embodiment may execute the technical solutions in the methods shown in fig. 2 to fig. 5, and the specific implementation process and technical principle of the electronic device refer to the relevant descriptions in the methods shown in fig. 2 to fig. 5, which are not described herein again.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention. It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is only a logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed coupling or direct coupling or communication connection between each other may be through some ports, indirect coupling or communication connection of devices or units, and may be electrical, mechanical or other forms. Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims of the present invention.

Claims (5)

1. A traffic flow detection method based on a video virtual coil is characterized by comprising the following steps:
configuring at least one virtual coil for detecting traffic flow in a video picture to obtain position information and number information of each virtual coil;
acquiring a real-time video stream, and decoding the real-time video stream to obtain a video frame image;
processing the video frame image by using a vehicle detection and tracking algorithm to obtain detection and tracking information of each vehicle; the detection tracking information of each vehicle comprises detection frame information and ID information of each vehicle;
determining the current state of each virtual coil according to the detection tracking information of each vehicle and the position information of each virtual coil; the current state of each virtual coil reflects the traffic flow of the road area corresponding to each virtual coil;
the determining the current state of each virtual coil according to the detection tracking information of each vehicle and the position information of each virtual coil includes:
comparing the detection frame information of each vehicle in the initial time image with the position information of each virtual coil to determine the virtual coil occupied by each vehicle at the initial time, so as to obtain the initial state of each virtual coil, and binding the ID information of each vehicle in the initial time image with the number information of the virtual coil occupied by each vehicle to obtain initial binding relationship information;
the binding relationship information at the previous moment is used as latest initial binding relationship information for determining the state of each virtual coil at the current moment, the detection frame information of each vehicle in the image at the current moment is repeatedly compared with the position information of each virtual coil based on the latest initial binding relationship information to determine the virtual coil occupied by each vehicle at the current moment, the current state of each virtual coil is obtained, and the latest initial binding relationship information is updated according to the virtual coil occupied by each vehicle at the current moment;
the step of comparing the detection frame information of each vehicle in the initial time image with the position information of each virtual coil to determine the virtual coil occupied by each vehicle at the initial time includes:
reducing the width of the detection frame of the vehicle to obtain the reduced detection frame information of the vehicle;
calculating the intersection area of the detection frame of the reduced vehicle and each virtual coil according to the detection frame information of the reduced vehicle and the position information of each virtual coil;
if the intersection area is larger than a preset area threshold value, determining a virtual coil occupied by the vehicle;
repeating the above steps until the virtual coil occupied by each vehicle is determined;
the determining the virtual coils occupied by the vehicles at the current time by comparing the detection frame information of the vehicles in the image at the current time with the position information of the virtual coils based on the latest initial binding relationship information includes:
determining whether each vehicle in the image at the current moment occupies a virtual coil or not according to the latest initial binding relation information;
comparing the detection frame information of the vehicle which does not occupy the virtual coil with the position information of each virtual coil to determine the virtual coil occupied by the vehicle, wherein the specific steps are as described in the previous step;
calculating the overlapping area of the detection frame of the vehicle and the virtual coil occupied by the vehicle according to the detection frame information of the vehicle occupying the virtual coil and the position information of the virtual coil occupied by the vehicle, and judging whether the overlapping area is larger than a preset area threshold value or not;
if so, using the virtual coil occupied by the vehicle before as the virtual coil occupied by the vehicle at the current moment, otherwise, comparing the detection frame information of the vehicle with the position information of other virtual coils to determine the virtual coil occupied by the vehicle at the current moment, wherein the specific steps are as described in the foregoing steps.
2. The method for detecting the traffic flow according to claim 1, wherein the processing the video frame image by using the vehicle detection and tracking algorithm to obtain the detection and tracking information of each vehicle comprises:
detecting all vehicles in the video frame image by using a Yolov5 model, and carrying out forward reasoning acceleration by adopting a TensorRT technology to obtain detection frame information of each vehicle;
and tracking the detected vehicles by using a Sort tracking algorithm to determine the tracking result of each vehicle, and endowing the same ID information for the same vehicle in different images according to the tracking result of each vehicle.
3. The traffic flow detection method according to any one of claims 1 and 2, characterized by further comprising:
performing binary assignment according to the current state of each virtual coil to generate a virtual coil state code;
and sending the virtual coil state code to a signal machine so as to dynamically adjust traffic lights at a traffic intersection in real time.
4. A video virtual coil-based traffic flow detection apparatus, characterized in that the apparatus is configured to perform the traffic flow detection method according to any one of claims 1 to 3.
5. A computer device, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the method of detecting vehicle flow as recited in any of claims 1-3.
CN202110951430.1A 2021-08-18 2021-08-18 Traffic flow detection method and device based on video virtual coil Active CN113781796B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110951430.1A CN113781796B (en) 2021-08-18 2021-08-18 Traffic flow detection method and device based on video virtual coil

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110951430.1A CN113781796B (en) 2021-08-18 2021-08-18 Traffic flow detection method and device based on video virtual coil

Publications (2)

Publication Number Publication Date
CN113781796A CN113781796A (en) 2021-12-10
CN113781796B true CN113781796B (en) 2023-04-07

Family

ID=78838320

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110951430.1A Active CN113781796B (en) 2021-08-18 2021-08-18 Traffic flow detection method and device based on video virtual coil

Country Status (1)

Country Link
CN (1) CN113781796B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114387310A (en) * 2022-01-17 2022-04-22 北京联合大学 Urban trunk road traffic flow statistical method based on deep learning
CN114155721A (en) * 2022-02-07 2022-03-08 北京图盟科技有限公司 Data conversion method and device for geomagnetic vehicle detector

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102385803A (en) * 2011-10-28 2012-03-21 南京邮电大学 All-weather urban vehicle tracking and counting method based on video monitoring

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102324183B (en) * 2011-09-19 2013-10-30 华中科技大学 Method for detecting and shooting vehicle based on composite virtual coil
CN104183142B (en) * 2014-08-18 2017-03-15 安徽科力信息产业有限责任公司 A kind of statistical method of traffic flow based on image vision treatment technology
US11322021B2 (en) * 2017-12-29 2022-05-03 Traffic Synergies, LLC System and apparatus for wireless control and coordination of traffic lights
CN108647638B (en) * 2018-05-09 2021-10-12 东软睿驰汽车技术(上海)有限公司 Vehicle position detection method and device
CN110942636B (en) * 2019-12-17 2021-11-26 南京浦和数据有限公司 Method for realizing traffic flow statistics by multiple radar cascades
CN114613143B (en) * 2021-05-28 2023-08-25 三峡大学 Road vehicle counting method based on YOLOv3 model

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102385803A (en) * 2011-10-28 2012-03-21 南京邮电大学 All-weather urban vehicle tracking and counting method based on video monitoring

Also Published As

Publication number Publication date
CN113781796A (en) 2021-12-10

Similar Documents

Publication Publication Date Title
CN113781796B (en) Traffic flow detection method and device based on video virtual coil
US11631326B2 (en) Information providing system, server, onboard device, vehicle, storage medium, and information providing method
CN107389085B (en) Method and device for determining road traffic attributes, computer and storage medium
KR20210038852A (en) Method, apparatus, electronic device, computer readable storage medium and computer program for early-warning
CN109472884A (en) Unmanned vehicle date storage method, device, equipment and storage medium
CN109284801B (en) Traffic indicator lamp state identification method and device, electronic equipment and storage medium
US8849625B2 (en) Distributed process simulator
JP7214702B2 (en) Method for detecting length of train, apparatus for detecting length of train, electronic device, storage medium and computer program
CN114399916A (en) Virtual traffic light control reminding method for digital twin smart city traffic
CN113537362A (en) Perception fusion method, device, equipment and medium based on vehicle-road cooperation
JP2022023910A (en) Method for acquiring traffic state and apparatus thereof, roadside device, and cloud control platform
CN111142402B (en) Simulation scene construction method, device and terminal
CN114548512A (en) Road operation data estimation method and device for digital twins
CN114627659B (en) Control method of intelligent safety street-crossing control system based on pedestrian video analysis
CN115601983A (en) Method, device, equipment and storage medium for determining cycle duration of traffic signal lamp
CN109118797A (en) Information sharing method, device, equipment and storage medium
US10583828B1 (en) Position determination
CN114627409A (en) Method and device for detecting abnormal lane change of vehicle
CN112613469A (en) Motion control method of target object and related equipment
CN112616118A (en) ETC portal frame determination method and device for vehicle passing through and storage medium
CN116990768A (en) Predicted track processing method and device, electronic equipment and readable medium
US11673577B2 (en) System and methods of adaptive relevancy prediction for autonomous driving
CN109446437B (en) Information mining method, device, server and storage medium
CN115973190A (en) Decision-making method and device for automatically driving vehicle and electronic equipment
CN115830562A (en) Method for determining lane information, computer device, and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant