Traffic detection method, device, electronic equipment and storage medium
By using regional images in road video streams and combining vehicle detection and tracking technology to determine traffic congestion information, the problems of high cost, limited coverage and low accuracy of existing traffic congestion identification methods are solved, and more efficient and Accurate traffic congestion monitoring.
Patent Information
- Application Number
- CN202110838044.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-23
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2041-07-23
AI Technical Summary
The existing traffic congestion identification methods are costly, damage road surfaces, limited coverage, and low accuracy, and low accuracy in identification of floating vehicle feedback data.
The area images of the area of interest are obtained by using road video streams, the average area speed and vehicle density are determined through vehicle detection and tracking, and the road congestion information is judged based on the vehicle speed threshold and density threshold, so as to avoid the installation of special equipment and improve coverage and accuracy.
It reduces installation costs, protects the road surface, improves the coverage and accuracy of traffic congestion identification, and more accurately reflects congestion conditions through the regional average vehicle speed and vehicle density, improving the certainty of road congestion information.
Smart Images

Figure CN113553955B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a traffic detection method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of the national economy, the number of motor vehicles has gradually increased in recent years, and traffic congestion problems of varying degrees have emerged. The identification of traffic congestion can provide effective information to relevant departments to facilitate traffic management and congestion relief.
[0003] When identifying traffic congestion, it is generally necessary to install radar, infrared detectors and other equipment on the road section to be identified, which not only increases the cost of congestion identification, but also damages the road surface, and the coverage of congestion identification is limited. Another method of identifying congestion is to use the data related to traffic congestion fed back by floating vehicles to identify it. This method is affected by the occupancy rate of floating vehicles among all vehicles on the road and the occupancy rate of roads with floating lanes among all roads, and the traffic congestion information obtained by identification is not accurate enough. Summary of the invention
[0004] The embodiments of the present disclosure at least provide a traffic detection method and device.
[0005] In a first aspect, an embodiment of the present disclosure provides a traffic detection method, including:
[0006] Acquire at least two area images including a preset area of interest from a road video stream;
[0007] Determine the average vehicle speed information of the area corresponding to the area of interest based on the shooting time of the at least two area images and the detection and tracking of the vehicles in the at least two area images;
[0008] Determining vehicle density information based on the size information of the area of interest and the number of vehicles in the area of interest;
[0009] Based on the average vehicle speed information in the area and the vehicle density information, road congestion information corresponding to the area of interest is determined.
[0010] In this aspect, the road congestion information can be determined by using the regional images collected by the existing video acquisition equipment on the road, avoiding the installation of congestion identification equipment, reducing the installation cost, protecting the existing road surface, and improving the coverage of congestion identification; at the same time, it overcomes the defect of low recognition accuracy caused by using the data feedback from floating vehicles to identify congestion. Furthermore, the above-mentioned regional average speed information represents the average speed of all vehicles in the area of interest in the area of interest. Compared with the average value of the instantaneous speed of all vehicles in the area of interest, the regional average speed information can more accurately reflect the congestion situation in the area of interest; combining the regional average speed information with the vehicle density information can effectively improve the accuracy of the determined road congestion information.
[0011] In a possible implementation manner, determining the road congestion information corresponding to the area of interest based on the average vehicle speed information of the area and the vehicle density information includes:
[0012] Get density threshold and vehicle speed threshold;
[0013] When the value corresponding to the average vehicle speed information of the area is less than the vehicle speed threshold, and the value corresponding to the vehicle density information is greater than the density threshold, it is determined that the road congestion information of the area of interest is in a congested state.
[0014] In this embodiment, the regional average vehicle speed information represents the average speed of all vehicles in the region of interest; the vehicle density information can reflect the density of vehicles in the region of interest, and the road congestion information of the region of interest can be accurately determined by combining the regional average vehicle speed information and the vehicle density information.
[0015] In a possible implementation manner, the road congestion information includes a congestion level;
[0016] The determining of the road congestion information corresponding to the area of interest based on the area average vehicle speed information and the vehicle density information further includes:
[0017] When it is determined that the road congestion information of the interest area is in a congested state, obtaining the speed limit information corresponding to the interest area;
[0018] Based on the speed limit information, determining speed ranges corresponding to different congestion levels;
[0019] Based on the average vehicle speed information of the area and the vehicle speed range, a congestion level corresponding to the area of interest is determined.
[0020] In this implementation manner, different speed limit information corresponds to different speed intervals. When judging the congestion level, the speed interval is determined in combination with the speed limit information of the area of interest, and the accuracy of the determined target congestion level can be improved based on the speed interval.
[0021] In a possible implementation, the determining the regional average vehicle speed information corresponding to the region of interest based on the shooting time of the at least two regional images and the detection and tracking of the vehicles in the at least two regional images includes:
[0022] Detecting the at least two area images to obtain vehicles contained in the area images;
[0023] Tracking the vehicles detected in the at least two area images, and matching the same vehicles detected in different area images;
[0024] Determining the displacement of the vehicle based on the position of the same vehicle in any two images;
[0025] Determining the instantaneous speed of each of the vehicles based on the shooting time of the arbitrary two area images and the displacement of the vehicles;
[0026] Based on the instantaneous speed of each of the vehicles, regional average vehicle speed information corresponding to the region of interest is determined.
[0027] This implementation can accurately determine the instantaneous speed of vehicles in the area of interest that exist in both area images based on the shooting time of the two area images and the displacement of the vehicles; and can accurately determine the area average vehicle speed information corresponding to the area of interest based on the instantaneous speed of each vehicle.
[0028] In a possible implementation manner, determining the regional average vehicle speed information corresponding to the region of interest based on the instantaneous speed of each of the vehicles includes:
[0029] For each of the vehicles, determining a first average speed of the vehicle in the area of interest based on a plurality of instantaneous speeds of the vehicle in the area of interest;
[0030] Based on a first average speed of each of the vehicles in the region of interest, determining a variance corresponding to a second average speed of all the vehicles in the region of interest and the first average speed;
[0031] Based on the second average speed and the variance, regional average vehicle speed information corresponding to the region of interest is determined.
[0032] This implementation can accurately determine regional average vehicle speed information within the area of interest that represents all vehicles within the area of interest based on the average speed of each vehicle within the area of interest and the variance of the average speed of each vehicle.
[0033] In a possible implementation manner, determining the vehicle density information based on the size information of the area of interest and the number of vehicles in the area of interest includes:
[0034] Determine the number of vehicles in the area of interest based on position information of the area of interest in the area image and the detected vehicles contained in the area image;
[0035] Determining size information of the region of interest based on position information of the region of interest in the region image and calibration information of a photographing device that photographs the region image;
[0036] Vehicle density information is determined based on the size information of the area of interest and the number of vehicles in the area of interest.
[0037] In this embodiment, based on the position information of the area of interest in the area image and the vehicles contained in the detected area image, the vehicles outside the area of interest can be eliminated, or the vehicles within the area of interest can be screened out, that is, the number of vehicles in the area of interest can be determined more accurately; based on the calibration information of the shooting equipment and the position information of the area of interest in the area image, the size information of the area of interest in the world coordinate system can be determined more accurately; finally, based on the above-mentioned more accurate size information and the above-mentioned number of vehicles, the above-mentioned vehicle density information can be determined more accurately.
[0038] In a possible implementation manner, the size information of the region of interest includes: actual length information of the region of interest in the world coordinate system and actual width information of the region of interest in the world coordinate system;
[0039] The determining of vehicle density information based on the size information of the area of interest and the number of vehicles in the area of interest includes:
[0040] Determining the number of lanes in the region of interest based on the actual width information and a preset lane width;
[0041] Based on the number of vehicles in the area of interest, the number of lanes and the actual length information, vehicle density information corresponding to the area of interest is determined.
[0042] In this embodiment, the vehicle density information in the area of interest is not only related to the number of vehicles inside the area of interest, but also to the number of lanes and the actual length of the area of interest. Therefore, by using the number of vehicles in the area of interest, the number of lanes and the actual length of the area of interest, the vehicle density information in the area of interest can be determined more accurately.
[0043] In a possible implementation, determining the displacement of the vehicle based on the position of the same vehicle in any two images includes:
[0044] For each of the vehicles, determining first actual position information and second actual position information of the vehicle in a world coordinate system based on position information of the vehicle in each of the two area images and calibration information of a photographing device that photographs the area image;
[0045] Based on the first actual position information and the second actual position information, a displacement of the vehicle is determined.
[0046] This embodiment, based on the calibration information of the shooting device and the position information of the vehicle in each area image, can accurately determine the actual position information of the vehicle corresponding to each area image, that is, the first actual position information and the second actual position information mentioned above, and then can accurately determine the displacement of the vehicle.
[0047] In a possible implementation manner, the calibration information of the photographing device may be determined by the following steps:
[0048] Acquire a calibration image captured by the capturing device;
[0049] identifying a plurality of calibration objects in the calibration image;
[0050] The calibration information of the photographing device is determined based on the coordinate information of the key points of the multiple calibration objects in the calibration image and the actual coordinate information of the key points in the world coordinate system.
[0051] In this implementation, the calibration information of the photographing device can be accurately determined by using the coordinate information of the calibration object in the calibration image and the actual coordinate information of the calibration object in the world coordinate system.
[0052] In a possible implementation manner, the calibration object includes a vehicle; and the key points of the calibration object include key points corresponding to wheels of the vehicle.
[0053] In this implementation, since the distance between the wheels of the vehicle is within a specific range, the key points of the wheels of the vehicle are used to calibrate the parameters of the shooting device, which is beneficial to improving the calibration efficiency and calibration accuracy.
[0054] In a possible implementation, determining the calibration information of the shooting device based on the coordinate information of the key points of the multiple calibration objects in the calibration image and the actual coordinate information of the key points in the world coordinate system includes:
[0055] Determining the number of pixels of a preset part of the calibration object in the calibration image based on the coordinate information of the key points of the multiple calibration objects in the calibration image;
[0056] When the number of pixels is different from the preset number, the calibration information of the shooting device is determined based on the coordinate information of the key points of the multiple calibration objects in the calibration image and the actual coordinate information of the key points in the world coordinate system.
[0057] In this implementation, the number of pixels of the preset part of the calibration object is different from the preset number, indicating that the calibration information of the shooting device has changed. At this time, the calibration information of the shooting device needs to be calibrated to ensure the accuracy of congestion identification.
[0058] In a possible implementation, when the number of pixels is different from the preset number, determining the calibration information of the shooting device based on the coordinate information of the key points of the multiple calibration objects in the calibration image and the actual coordinate information of the key points in the world coordinate system includes:
[0059] In a case where the number of pixel points is different from the preset number, determining reprojection error information between a camera coordinate system corresponding to the shooting device and a world coordinate system based on coordinate information of key points of the multiple calibration objects in the calibration image and actual coordinate information of the key points in the world coordinate system;
[0060] Based on the reprojection error information, calibration information of the photographing device is determined.
[0061] This implementation method utilizes the reprojection error information of key points between the camera coordinate system and the world coordinate system to perform parameter calibration more accurately.
[0062] In a possible implementation, the calibration information includes external reference information and internal reference information of the photographing device;
[0063] The determining, based on the reprojection error information, calibration information of the photographing device includes:
[0064] Setting the intrinsic parameter information of the shooting device to fixed information, and determining the extrinsic parameter information of the shooting device based on the reprojection error information; and / or,
[0065] The external parameter information of the shooting device is set as fixed information, and the internal parameter information of the shooting device is determined based on the reprojection error information.
[0066] In this implementation, the internal parameter information of the shooting device is fixed and combined with the reprojection error information, so that the external parameter information of the shooting device can be determined more accurately; at the same time, the external parameter information of the shooting device is fixed and combined with the reprojection error information, so that the internal parameter information of the shooting device can be determined more accurately.
[0067] In a second aspect, the present disclosure provides a traffic detection device, comprising:
[0068] An image acquisition module, used to acquire at least two area images including a preset area of interest from a road video stream;
[0069] A vehicle speed determination module, configured to determine the regional average vehicle speed information corresponding to the region of interest based on the shooting time of the at least two region images and the detection and tracking of the vehicles in the at least two region images;
[0070] A density determination module, configured to determine vehicle density information based on the size information of the interest area and the number of vehicles in the interest area;
[0071] The congestion identification module is used to determine the road congestion information corresponding to the interest area based on the average vehicle speed information of the area and the vehicle density information.
[0072] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are performed.
[0073] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are executed.
[0074] For a description of the effects of the above-mentioned traffic detection device, electronic device, and computer-readable storage medium, please refer to the description of the above-mentioned traffic detection method, which will not be repeated here.
[0075] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0077] Figure 1 A flow chart of a traffic detection method provided by an embodiment of the present disclosure is shown;
[0078] Figure 2 A congestion level segmentation diagram in the traffic detection method provided by an embodiment of the present disclosure is shown;
[0079] Figure 3 A flowchart showing a specific method for determining the regional average vehicle speed information corresponding to the region of interest in the traffic detection method provided by the embodiment of the present disclosure;
[0080] Figure 4 A flowchart showing a specific method for calibrating calibration information of a camera in a traffic detection method provided by an embodiment of the present disclosure;
[0081] Figure 5A A schematic diagram of a network structure for identifying object types in a traffic detection method provided by an embodiment of the present disclosure is shown;
[0082] Figure 5B A schematic diagram of a network structure for identifying key points in a traffic detection method provided by an embodiment of the present disclosure is shown;
[0083] Figure 6 A schematic diagram of a traffic detection device provided by an embodiment of the present disclosure is shown;
[0084] Figure 7 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0085] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0086] After research, it was found that there are the following problems in congestion identification: high cost of congestion identification, damage to existing road surfaces, limited coverage of congestion identification, and low accuracy of congestion identification. In view of the above defects, the present disclosure at least provides a traffic detection method and device. The present disclosure uses the regional images collected by the existing video acquisition equipment on the road to determine the road congestion information, avoids the installation of congestion identification equipment, reduces the installation cost, protects the existing road surface, and improves the coverage of congestion identification; at the same time, it overcomes the defect of low recognition accuracy caused by using the data feedback from floating vehicles to identify congestion. Furthermore, the regional average speed information in the present disclosure represents the average speed of all vehicles in the area of interest in the area of interest. Compared with the average value of the instantaneous speed of all vehicles in the area of interest, the regional average speed information can more accurately reflect the congestion situation in the area of interest; based on the regional average speed information, combined with the vehicle density information, it can effectively improve the accuracy of the determined road congestion information.
[0087] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0088] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0089] The traffic detection method provided by the embodiment of the present disclosure is described below by taking an execution subject as a device with computing capabilities as an example.
[0090] like Figure 1 As shown, the traffic detection method provided by the present disclosure includes the following steps:
[0091] S110: Acquire at least two area images including a preset area of interest from a road video stream.
[0092] The shooting device for capturing the regional image here can be an existing image acquisition device on the road, for example, the shooting device can be a surveillance camera, electronic police, checkpoint equipment, etc. on expressways and urban roads, avoiding the installation of dedicated hardware for congestion identification, reducing costs, and facilitating large-scale deployment and application.
[0093] The above-mentioned region of interest is a region that needs to be congested, and the region image includes the region of interest. The shooting time interval of the above-mentioned two region images may be a predetermined time interval, for example, may be 0.4 seconds.
[0094] S120: Determine average vehicle speed information of the area corresponding to the area of interest based on shooting time of the at least two area images and detection and tracking of vehicles in the at least two area images.
[0095] The regional average vehicle speed information represents the average speed of all vehicles in the region of interest, which is different from the average value of the instantaneous speed of all vehicles in the region of interest and can more accurately reflect the congestion situation in the region of interest.
[0096] When determining the above-mentioned regional average vehicle speed information, it is first necessary to detect the at least two regional images to obtain the vehicles contained in the regional images; then, track the vehicles detected in the at least two regional images, match the same vehicles detected in different regional images, and determine the vehicles that are simultaneously located in the interest area in the two regional images; then, based on the position of the same vehicle in any two images, determine the displacement of the vehicle; then, based on the shooting time of the any two regional images and the displacement of the vehicle, determine the instantaneous speed of each of the vehicles; finally, then, based on the instantaneous speed of each of the vehicles, determine the regional average vehicle speed information corresponding to the interest area.
[0097] The above method may firstly utilize image recognition technology to identify vehicles in each area image, and track the identified vehicles, thereby determining vehicles that exist in the area of interest in both area images at the same time.
[0098] Based on the shooting time of the two area images and the displacement of the vehicle, the instantaneous speed of the vehicles in the interest area in the two area images can be accurately determined; based on the instantaneous speed of each vehicle, the regional average vehicle speed information corresponding to the interest area can be accurately determined.
[0099] The two area images used to determine the instantaneous speed may be two images shot at a short time interval, for example, two area images shot at a time interval of 0.4 seconds.
[0100] S130: Determine vehicle density information based on the size information of the area of interest and the number of vehicles in the area of interest.
[0101] The above vehicle density information reflects the density of vehicles in the area of interest. Compared with the number of vehicles in the area of interest, it can more accurately represent the congestion situation in the area of interest.
[0102] When determining vehicle density information, it is necessary to first identify the vehicles in the area image, then count the number of vehicles located in the area of interest based on the location information of the area of interest, and then determine the vehicle density information of the area of interest by combining the size information of the area of interest and the number of vehicles in the area of interest obtained by counting.
[0103] Exemplarily, the position information of the region of interest in the region image may be first acquired, and then the size information of the region of interest may be determined based on the position information of the region of interest in the region image and the calibration information of the shooting device that shoots the region image.
[0104] Based on the position information of the area of interest in the area image and the vehicles contained in the detected area image, the vehicles outside the area of interest can be eliminated, or the vehicles within the area of interest can be screened out, that is, the number of vehicles in the area of interest can be determined more accurately; based on the calibration information of the shooting equipment and the position information of the area of interest in the area image, the size information of the area of interest in the world coordinate system can be determined more accurately; finally, based on the above-mentioned more accurate size information and the above-mentioned number of vehicles, the above-mentioned vehicle density information can be determined more accurately.
[0105] In addition, the size information of the above-mentioned area of interest and the number of vehicles in the area of interest can also be determined by other methods, for example, they can be obtained from a shooting device, and the shooting device is an intelligent shooting device, which can determine the above-mentioned size information and the number of vehicles in the area of interest based on the area image captured by it.
[0106] S140: Determine the road congestion information corresponding to the area of interest based on the average vehicle speed information and the vehicle density information in the area.
[0107] For example, when the following two conditions are met, it can be determined that the road congestion information corresponding to the area of interest is in a congested state:
[0108] The value corresponding to the average vehicle speed information of the area is less than the vehicle speed threshold;
[0109] When the value corresponding to the vehicle density information is greater than the density threshold.
[0110] If the above two conditions are met, it means that the vehicles in the interest area are dense and the average speed of all vehicles is low, and the interest area is in a congested state. If only any one of the above two conditions is met, it cannot be determined that the interest area is in a congested state.
[0111] Exemplarily, when only one of the above two conditions is met or both conditions are not met, it can be determined that the region of interest is in an unobstructed state.
[0112] Different roads have different speed limit information, and the corresponding speed ranges are also different. The congestion level is not only related to the speed, but also directly related to the speed limit information. Therefore, when determining the congestion level, it is necessary to combine the corresponding speed limit information. Specifically, when the area of interest is in a congested state, the target congestion level of the area of interest can be determined using the following steps:
[0113] When it is determined that the road congestion information of the area of interest is in a congested state, the speed limit information corresponding to the area of interest is obtained; based on the speed limit information, the speed ranges corresponding to different congestion levels are determined; based on the average speed information of the area and the speed range, the congestion level corresponding to the area of interest is determined.
[0114] Exemplarily, speed limit information corresponding to multiple interest areas may be pre-stored, specifically, a mapping relationship between an identifier of an interest area and the speed limit information may be stored. After the interest area for congestion identification is determined, the speed limit information corresponding to the interest area may be determined based on the identifier of the interest area and the above mapping relationship.
[0115] In the implementation manner of the present invention, the region of interest may be known, may be determined by identifying a region image, or may be manually marked in the video.
[0116] Each of the above speed intervals corresponds to a congestion level. Exemplarily, a congestion level that matches the speed corresponding to the regional average speed information is screened from various congestion levels, and the screened congestion level is used as the above target congestion level.
[0117] For example, Figure 2As shown, when the speed limit value corresponding to the speed limit information is 120 km / h, the speed intervals are [0, 30), [30, 50), [50, 70). When the value corresponding to the regional average speed information is in the speed interval [0, 30), the target congestion level is level I; when the value corresponding to the regional average speed information is in the speed interval [30, 50), the target congestion level is level II; when the value corresponding to the regional average speed information is in the speed interval [50, 70), the target congestion level is level III. When the value corresponding to the regional average speed information is greater than or equal to 70, the area of interest is in a smooth state.
[0118] When the speed limit value corresponding to the speed limit information is 110 km / h, the speed intervals are [0, 25), [25, 45), [45, 65). When the value corresponding to the regional average speed information is in the speed interval [0, 25), the target congestion level is level I; when the value corresponding to the regional average speed information is in the speed interval [25, 45), the target congestion level is level II; when the value corresponding to the regional average speed information is in the speed interval [45, 65), the target congestion level is level III. When the value corresponding to the regional average speed information is greater than or equal to 65, the area of interest is in a smooth state.
[0119] The above symbol [ indicates a closed value, that is, it includes the value after [; the symbol ) indicates an open value, that is, it does not include the value before ); for example, in [25, 45), the vehicle speed interval is greater than or equal to 25 and less than 45; for another example, in [45, 65), the vehicle speed interval is greater than or equal to 45 and less than 65.
[0120] It can be seen that different speed limit information has different speed ranges. The speed range is determined in combination with the speed limit information of the area of interest, and the accuracy of the determined target congestion level can be improved based on the speed range.
[0121] The unblocked state may also correspond to a congestion level, for example, Figure 2 As shown, the congestion level of the smooth state is level IV. In addition, the level I congestion level may correspond to a severe congestion state, the level II congestion level may correspond to a moderate congestion state, and the level III congestion level may correspond to a light congestion state.
[0122] The above-mentioned regional average vehicle speed information represents the average speed of all vehicles in the area of interest; the above-mentioned vehicle density information can reflect the density of vehicles in the area of interest. Combining the regional average vehicle speed information and the vehicle density information can accurately determine the road congestion information of the area of interest.
[0123] In some embodiments, the instantaneous speed of the vehicle may be determined using the following steps:
[0124] First, based on the position information of the vehicle in each of the two area images and the calibration information of the shooting device that shoots the area images, the first actual position information and the second actual position information of the vehicle in the world coordinate system are determined; then, based on the first actual position information and the second actual position information, the displacement of the vehicle is determined; finally, based on the above displacement and the shooting time of each of the area images, the instantaneous speed of the vehicle is determined.
[0125] For example, the following formula may be used to determine the position of the vehicle in the real world, that is, to determine the actual position information of the vehicle in the world coordinate system:
[0126]
[0127]
[0128]
[0129] In the formula, (X i t , Y i t ) represents the position coordinates of vehicle i in the area image captured at time t, (x i t ,y i t ) represents the actual position information of vehicle i in the world coordinate system (corresponding to the real world) at time t, and H represents the calibration information of the shooting device of the shooting device area image.
[0130] The instantaneous speed V of vehicle i at time t can be determined using the following formula: i t :
[0131]
[0132] Wherein, Δt represents the interval between the shooting times of two area images. Δt can be 0.4 seconds.
[0133] Based on the calibration information of the shooting device and the position information of the vehicle in each area image, the actual position information of the vehicle corresponding to each area image, that is, the first actual position information and the second actual position information mentioned above, can be accurately determined, and then the displacement of the vehicle can be accurately determined.
[0134] In some embodiments, Figure 3 As shown, the above-mentioned determination of the regional average vehicle speed information corresponding to the region of interest based on the instantaneous speed of each vehicle can be achieved by the following steps:
[0135] S310: For each of the vehicles, determine a first average speed of the vehicle in the area of interest based on multiple instantaneous speeds of the vehicle in the area of interest.
[0136] After determining the instantaneous speed of vehicle i, a first average speed of vehicle i in the area of interest may be determined based on multiple instantaneous speeds of vehicle i in the area of interest.
[0137] Then, based on Gaussian distribution, data preprocessing is performed on the first average speeds of all vehicles to remove abnormal data. For example, abnormal first average speeds are removed based on the 3σ principle. For example, eight first average speeds are determined, 65, 70, 55, 60, 200, 66, 58, and 59. Abnormal data removal is performed on the above first average speeds, and 200 can be removed. The first average speed calculated using the remaining values can improve the accuracy of the second average speed and variance determined subsequently.
[0138] S320: Determine, based on the first average speed of each of the vehicles in the region of interest, a variance corresponding to the second average speed of all the vehicles in the region of interest and the first average speed.
[0139] For example, the second average speed μ can be determined using the following formula: T :
[0140]
[0141] In the formula, n represents the number of vehicles.
[0142] S330: Determine regional average vehicle speed information corresponding to the region of interest based on the second average speed and the variance.
[0143] For example, the average vehicle speed information of the above area can be determined using the following formula:
[0144]
[0145] In the formula, represents the variance corresponding to all the first average velocities.
[0146] Based on the average speed of each vehicle in the region of interest and the variance of the average speed of each vehicle, the regional average vehicle speed information in the region of interest that represents all vehicles in the region of interest can be accurately determined. The determination process of the regional average vehicle speed information combines the variance corresponding to the first average speed and the average speed of all vehicles in the region of interest, that is, the second average speed, which can more accurately represent the driving status of the vehicles in the region of interest, and then more accurately determine the road congestion information in the region of interest.
[0147] In some embodiments, the vehicle density information is determined based on the size information of the region of interest and the number of vehicles in the region of interest, and the following steps may be used to determine the vehicle density information:
[0148] First, based on the actual width information and the preset lane width, the number of lanes in the area of interest is determined; then, based on the number of vehicles in the area of interest, the number of lanes and the actual length information, the vehicle density information corresponding to the area of interest is determined.
[0149] Here, the image recognition technology may be first used to identify vehicles in the area image, and then the number of vehicles located in the area of interest may be counted based on the position information of the area of interest in the area image.
[0150] When determining the number of lanes, the actual width information of the region of interest in the world coordinate system can be determined based on the position information of the region of interest in the region image; and then the number of lanes in the region of interest can be determined based on the actual width information and the preset lane width.
[0151] Exemplarily, the size information of the region of interest in the world coordinate system is determined using the calibration information of the shooting device that shoots the area image and the position information of the region of interest in the area image. Then, the actual length information and actual width information of the region of interest in the world coordinate system are determined based on the size information of the region of interest in the world coordinate system.
[0152] For example, after determining the actual width information w of the region of interest in the world coordinate system, the number of lanes lane can be determined using the following formula: num :
[0153]
[0154] Where w represents the preset lane width, and w represents the width of the region of interest in the real world.
[0155] For example, after determining the number of vehicles, the number of lanes and the actual length information of the region of interest, the vehicle density information traffic_K corresponding to the region of interest may be determined using the following formula:
[0156]
[0157] Where num represents the number of vehicles in the area of interest, 1000 represents a constant parameter, and L represents the actual length information.
[0158] In the above embodiment, the vehicle density information in the area of interest is not only related to the number of vehicles inside the area of interest, but also to the number of lanes and the actual length of the area of interest. Therefore, by using the number of vehicles in the area of interest, the number of lanes and the actual length of the area of interest, the vehicle density information in the area of interest can be determined more accurately.
[0159] According to the above statement, when determining the instantaneous speed and determining the actual length information and actual width information of the region of interest in the world coordinate system, the calibration information of the shooting device that shoots the region image is used. In the prior art, the above calibration information needs to be manually calibrated, which is not only a waste of manpower and inefficient, but also affects the efficiency and accuracy of congestion identification.
[0160] The present disclosure provides a method for automatically calibrating calibration information of a photographing device. The method effectively improves the calibration efficiency of the photographing device calibration information, reduces the workload of manual calibration, and can still achieve automatic calibration even after the camera of the photographing device rotates, thereby increasing the applicable scenarios of congestion identification.
[0161] The following describes how and when to calibrate the internal and external parameter information of a shooting device through an embodiment.
[0162] Before determining or adjusting (calibrating) the calibration information of the above-mentioned photographing device, the calibration principle of the calibration information is first explained.
[0163] According to the imaging model of the shooting device, set (u, v, 1) T is the coordinate of point P in the camera coordinate system, (x, y, 1) T is the coordinate of point P in the world coordinate system. According to the principle of distortion-free pinhole imaging, there is the following mapping relationship:
[0164]
[0165] In the formula, 1 / Z represents a normalization factor, Z is a preset value, K represents the intrinsic parameter information of the shooting device, and T represents the extrinsic parameter information of the shooting device.
[0166] in,
[0167] In the formula, f x Indicates the focal length of the camera in the x direction, f y Indicates the focal length of the camera in the y direction, c x represents the coordinate of the center point of the image in the x direction, c y Indicates the coordinate of the center point of the image in the y direction. R indicates rotation information, and t indicates translation information.
[0168] The internal reference information and external reference information of the shooting device are collectively referred to as the calibration information of the shooting device. H can be set to be K×T, where H represents the calibration information of the shooting device.
[0169] The above formula (9) can be expressed as:
[0170]
[0171] The following specifically describes how to calibrate the calibration information.
[0172] like Figure 4 As shown, the calibration information of the camera can be calibrated using the following steps:
[0173] S410: Acquire a calibration image captured by the shooting device.
[0174] The shooting position of the calibration image may be the same as the shooting position of the above-mentioned regional image.
[0175] S420: Identify multiple calibration objects in the calibration image.
[0176] Here, image recognition technology may be used to identify each object in the calibration image and the object category of each object; and based on the object category of each object, an object with a preset object category is used as a calibration object.
[0177] Exemplarily, the object identified above is a vehicle. When identifying each object in the calibration image, the convolutional neural network can be used to extract features of the calibration image first, and then the candidate target region in the calibration image can be extracted through the Region Proposal Layer; and based on the candidate target region, the extracted features are subjected to ROI Pooling, that is, category classification and coordinate regression are performed to obtain the vehicle detection frame and the confidence of each detection frame; finally, the maximum suppression algorithm is used to merge the detection frames whose intersection-over-union ratio is greater than the threshold, and the final vehicle detection result is output.
[0178] After detecting the vehicles in the calibration image, it is also necessary to identify the attributes of the vehicles, that is, to determine the object category of each detected vehicle.
[0179] Exemplarily, the object categories may include cars, vans, pickup trucks, large trucks, SUVs, buses, and other non-motor vehicles.
[0180] For example, Figure 5A As shown in the figure, the sub-image corresponding to the vehicle can be extracted from the calibration image, and then the extracted sub-image is input into a neural network with resnet18 as the backbone network. The image features of the sub-image are extracted using the neural network, and then a two-layer full-connection network is used to classify based on the extracted image features and output the object type of the vehicle.
[0181] For example, a car can be used as a preset object category, that is, a car can be used as a calibration object. Since the distance between the wheels of a car is within a specific range, the key points of the car's wheels are used to calibrate the parameters of the shooting device, which is conducive to improving the calibration efficiency and calibration accuracy.
[0182] After determining the calibration object, it is necessary to further screen the calibration object to improve the accuracy of the internal calibration information calibration. Specifically, the following steps can be used to screen the calibration object:
[0183] First, objects with preset object categories, namely key points of calibration objects, are determined; then, based on the confidence of the key points, final calibration objects are screened from the objects with preset object categories.
[0184] For example, the key points can be determined according to the following steps: Figure 5B As shown in the figure, the sub-image corresponding to the vehicle can be extracted from the calibration image, and then the extracted sub-image is input into the backbone network resnet. The sub-image is subjected to the convolution operation of the backbone network to extract image features, and the feature pyramid network (FPN) is used to extract multi-scale features. After further convolution operation on the output of FPN, 5 positioning heat maps are output and predicted, corresponding to the left front wheel, left rear wheel, right rear wheel, right front wheel and background of the vehicle, and the key points corresponding to the left front wheel, the left rear wheel, the right rear wheel and the right front wheel are obtained.
[0185] Exemplarily, after determining the key points, the key points with a confidence greater than a preset confidence are taken as valid key points. Then, the calibration object with a number of valid key points greater than a preset number is taken as the final calibration object. The final calibration object is used to determine the calibration information.
[0186] The above preset confidence can be set to 0.7, and the preset number can be set to 3.
[0187] By using the confidence of key points, calibration objects with key points of higher confidence can be screened out, thereby improving the accuracy of internal and external parameter calibration.
[0188] S430: Determine calibration information of the photographing device based on coordinate information of key points of the multiple calibration objects in the calibration image and actual coordinate information of the key points in the world coordinate system.
[0189] Here, it is necessary to first determine which key points can be used for calibration. For example, a preset number of key points with the highest confidence in the calibration object can be used as target key points, and the calibration information of the shooting device can be determined based on the coordinate information of the target key points in the calibration image and the actual coordinate information of the target key points in the world coordinate system.
[0190] Exemplarily, the preset number of key points with the highest confidence levels may be the three key points with the highest confidence levels.
[0191] After determining the target key points, the following steps can be used for calibration:
[0192] First, based on the coordinate information of the target key points of the multiple calibration objects in the calibration image and the actual coordinate information of the target key points in the world coordinate system, the reprojection error information between the camera coordinate system corresponding to the shooting device and the world coordinate system is determined; then, based on the reprojection error information, the calibration information of the shooting device is determined.
[0193] Exemplarily, the above reprojection error information may be determined using the following formula:
[0194]
[0195]
[0196] In the formula, K * , T * Represents the reprojection error information; i represents the order of the calibration objects, j represents the order of the key points, represents the coordinates of key point i of calibration object i in the camera coordinate system, represents the coordinates of key point j of calibration object i in the world coordinate system; n represents the number of calibration objects.
[0197] Exemplarily, after the above-mentioned reprojection error information is determined, the extrinsic parameter information of the shooting device may be determined by using the following steps:
[0198] The intrinsic parameter information of the shooting device is set as fixed information, and the extrinsic parameter information of the shooting device is determined based on the reprojection error information.
[0199] The internal parameter information K of the fixed shooting device remains unchanged. The above reprojection error can be converted into a two-dimensional point cloud matching problem, and the extrinsic parameter information T of the calibration vehicle i is solved using SVD (singular value decomposition) i .
[0200] Since the camera extrinsic information corresponding to each car is independent of each other, the following derivation only considers the extrinsic information corresponding to one of the cars. The solution process.
[0201] Specifically, According to formula (10) and formula (12), a new objective function is set:
[0202]
[0203] make p′ j =p j -u p , q′ j =q j -u q , expand the objective function (13) to obtain:
[0204]
[0205] in,
[0206] Therefore, the new objective function (13) is simplified to:
[0207]
[0208] After that, we can optimize in two steps and get:
[0209]
[0210] t * =u q -R * u p′ (17)
[0211] Solve R by singular value decomposition (SVD) * The least squares solution is Perform singular value decomposition on W and get:
[0212]
[0213] make Where Q * satisfy Q * The determinant of |Q *|=±1;
[0214]
[0215] t * =u q -R * u p (20)
[0216] Exemplarily, after the above-mentioned reprojection error information is determined, the intrinsic parameter information of the shooting device may be determined by using the following steps:
[0217] The external information of the shooting device is set as fixed information, and the internal parameter information of the shooting device is determined based on the reprojection error information.
[0218] After setting the external information of the shooting device as fixed information, a new objective function is set according to formula (12):
[0219]
[0220] set up
[0221] In order to improve the convergence of the algorithm, the external parameter T0 is introduced when solving K, and H = KT0. Formula (21) is optimized as follows:
[0222]
[0223] At this point, the direct linear transform model (DLT) method can be used to solve H, and then decomposed to get The calibration information of the above-mentioned camera device can be finally determined through multiple iterations. During initialization, H=1 is set, and the maximum number of iterations is set. The condition for stopping the iteration can be that the maximum number of iterations is reached, or the function value corresponding to Formula (12) in the current iteration decreases less than a preset value relative to the function value corresponding to Formula (12) in the previous iteration, such as a decrease of less than 10 -5 .
[0224] Finally, the internal reference information of the shooting device and n sets of external reference information are obtained.
[0225] The above describes how to calibrate, and the following describes when to calibrate.
[0226] Exemplarily, calibration may be performed when the camera of the shooting device rotates, or whether to perform calibration may be determined in the following manner:
[0227] First, based on the coordinate information of the key points of the multiple calibration objects in the calibration image, the number of pixel points of the preset part of the calibration object in the calibration image is determined; then, when the number of pixel points is different from the preset number, the shooting device is calibrated.
[0228] If the number of pixels at the preset part of the calibration object is different from the preset number, it indicates that the calibration information of the shooting device has changed. In this case, the shooting device needs to be calibrated to ensure the accuracy of congestion identification.
[0229] For example, since the sizes of cars are relatively concentrated within a small numerical range, the car can be used as a preset object category, and the bearings of the front and rear wheels of the car can be used as the center points of the front and rear wheels of the car. Then, the preset position is determined based on the determined midpoint.
[0230] In the calibration information calibration process, n key points of the wheels of a small car are used as input to construct n sets of equality constraints, each set of equality constraints has the same internal parameter information and independent external parameter information. The equality constraints are constructed and the calibration information is calculated.
[0231] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0232] Based on the same inventive concept, a traffic detection device corresponding to the traffic detection method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned traffic detection method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method.
[0233] like Figure 6 FIG. 1 is a schematic diagram of the architecture of a traffic detection device provided by an embodiment of the present disclosure, including:
[0234] The image acquisition module 610 is used to acquire at least two area images including a preset area of interest from the road video stream.
[0235] The vehicle speed determination module 620 is used to determine the regional average vehicle speed information corresponding to the region of interest based on the shooting time of the at least two regional images and the detection and tracking of the vehicles in the at least two regional images.
[0236] The density determination module 630 is used to determine vehicle density information based on the size information of the interest area and the number of vehicles in the interest area.
[0237] The congestion identification module 640 is used to determine the road congestion information corresponding to the interest area based on the average vehicle speed information and the vehicle density information in the area.
[0238] In some embodiments, when determining the road congestion information corresponding to the area of interest based on the average vehicle speed information of the area and the vehicle density information, the congestion identification module 640 is used to:
[0239] Get density threshold and vehicle speed threshold;
[0240] When the value corresponding to the average vehicle speed information of the area is less than the vehicle speed threshold, and the value corresponding to the vehicle density information is greater than the density threshold, it is determined that the road congestion information of the area of interest is in a congested state.
[0241] In some embodiments, the road congestion information includes a congestion level;
[0242] When determining the road congestion information corresponding to the area of interest based on the area average vehicle speed information and the vehicle density information, the congestion identification module 640 is used to:
[0243] When it is determined that the road congestion information of the interest area is in a congested state, obtaining the speed limit information corresponding to the interest area;
[0244] Based on the speed limit information, determining speed ranges corresponding to different congestion levels;
[0245] Based on the average vehicle speed information of the area and the vehicle speed range, a congestion level corresponding to the area of interest is determined.
[0246] In some embodiments, when determining the regional average vehicle speed information corresponding to the region of interest based on the shooting time of the at least two regional images and the detection and tracking of the vehicles in the at least two regional images, the vehicle speed determination module 620 is used to:
[0247] Detecting the at least two area images to obtain vehicles contained in the area images;
[0248] Tracking the vehicles detected in the at least two images, and matching the same vehicles detected in images of different regions;
[0249] Determining the displacement of the vehicle based on the position of the same vehicle in any two images;
[0250] Determining the instantaneous speed of each of the vehicles based on the shooting time of the arbitrary two area images and the displacement of the vehicles;
[0251] Based on the instantaneous speed of each of the vehicles, regional average vehicle speed information corresponding to the region of interest is determined.
[0252] In some embodiments, when determining the regional average vehicle speed information corresponding to the region of interest based on the instantaneous speed of each of the vehicles, the vehicle speed determination module 620 is used to:
[0253] For each of the vehicles, determining a first average speed of the vehicle in the area of interest based on a plurality of instantaneous speeds of the vehicle in the area of interest;
[0254] Based on a first average speed of each of the vehicles in the region of interest, determining a variance corresponding to a second average speed of all the vehicles in the region of interest and the first average speed;
[0255] Based on the second average speed and the variance, regional average vehicle speed information corresponding to the region of interest is determined.
[0256] In some embodiments, when determining the vehicle density information based on the size information of the region of interest and the number of vehicles in the region of interest, the density determination module 630 is configured to:
[0257] Determine the number of vehicles in the area of interest based on position information of the area of interest in the area image and the detected vehicles contained in the area image;
[0258] Determining size information of the region of interest based on position information of the region of interest in the region image and calibration information of a photographing device that photographs the region image;
[0259] Vehicle density information is determined based on the size information of the area of interest and the number of vehicles in the area of interest.
[0260] In some embodiments, the size information of the region of interest includes: actual length information of the region of interest in the world coordinate system and actual width information of the region of interest in the world coordinate system;
[0261] When determining the vehicle density information based on the size information of the region of interest and the number of vehicles in the region of interest, the density determination module 630 is used to:
[0262] Determining the number of lanes in the region of interest based on the actual width information and a preset lane width;
[0263] Based on the number of vehicles in the area of interest, the number of lanes and the actual length information, vehicle density information corresponding to the area of interest is determined.
[0264] In some embodiments, the vehicle speed determination module 620, when determining the displacement of the vehicle based on the position of the same vehicle in any two images, is configured to:
[0265] For each of the vehicles, determining first actual position information and second actual position information of the vehicle in a world coordinate system based on position information of the vehicle in each of the two area images and calibration information of a photographing device that photographs the area image;
[0266] Based on the first actual position information and the second actual position information, a displacement of the vehicle is determined.
[0267] In some embodiments, a calibration module 650 is further included, which is used to calibrate the calibration information of the shooting device:
[0268] Acquire a calibration image captured by the capturing device;
[0269] identifying a plurality of calibration objects in the calibration image;
[0270] The calibration information of the photographing device is determined based on the coordinate information of the key points of the multiple calibration objects in the calibration image and the actual coordinate information of the key points in the world coordinate system.
[0271] In some embodiments, the calibration object includes a vehicle; and the key points of the calibration object include key points corresponding to wheels of the vehicle.
[0272] In some embodiments, when determining the calibration information of the photographing device based on the coordinate information of the key points of the multiple calibration objects in the calibration image and the actual coordinate information of the key points in the world coordinate system, the calibration module 650 is used to:
[0273] Determining the number of pixel points of a preset part of the calibration object in the calibration image based on the coordinate information of the key points of the multiple calibration objects in the calibration image;
[0274] When the number of pixels is different from the preset number, the calibration information of the shooting device is determined based on the coordinate information of the key points of the multiple calibration objects in the calibration image and the actual coordinate information of the key points in the world coordinate system.
[0275] In some embodiments, when the number of pixels is different from the preset number, the calibration module 650, when determining the calibration information of the shooting device based on the coordinate information of the key points of the multiple calibration objects in the calibration image and the actual coordinate information of the key points in the world coordinate system, is used to:
[0276] In a case where the number of pixel points is different from the preset number, determining reprojection error information between a camera coordinate system corresponding to the shooting device and a world coordinate system based on coordinate information of key points of the multiple calibration objects in the calibration image and actual coordinate information of the key points in the world coordinate system;
[0277] Based on the reprojection error information, calibration information of the photographing device is determined.
[0278] In some embodiments, the calibration information includes external reference information and internal reference information of the photographing device;
[0279] When determining the calibration information of the photographing device based on the reprojection error information, the calibration module 650 is used to:
[0280] Setting the intrinsic parameter information of the shooting device to fixed information, and determining the extrinsic parameter information of the shooting device based on the reprojection error information; and / or,
[0281] The external parameter information of the shooting device is set as fixed information, and the internal parameter information of the shooting device is determined based on the reprojection error information.
[0282] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0283] Based on the same technical concept, the embodiment of the present disclosure also provides an electronic device. Figure 7 As shown, it is a schematic diagram of the structure of the electronic device 700 provided in the embodiment of the present disclosure, including a processor 71, a memory 72, and a bus 73. Among them, the memory 72 is used to store execution instructions, including a memory 721 and an external memory 722; the memory 721 here is also called an internal memory, which is used to temporarily store the operation data in the processor 71, and the data exchanged with the external memory 722 such as a hard disk. The processor 71 exchanges data with the external memory 722 through the memory 721. When the electronic device 700 is running, the processor 71 communicates with the memory 72 through the bus 73, so that the processor 71 executes the following instructions:
[0284] At least two area images including a preset area of interest are obtained from a road video stream; based on the shooting time of the at least two area images and the detection and tracking of vehicles in the at least two area images, the area average vehicle speed information corresponding to the area of interest is determined; based on the size information of the area of interest and the number of vehicles in the area of interest, the vehicle density information is determined; based on the area average vehicle speed information and the vehicle density information, the road congestion information corresponding to the area of interest is determined.
[0285] The embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the traffic detection method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0286] The computer program product of the traffic detection method provided in the embodiment of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the steps of the traffic detection method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0287] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0288] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0289] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0290] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0291] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0292] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A traffic detection method, characterized in that: include: Acquire at least two area images including a preset area of interest from a road video stream; Determine the average vehicle speed information of the area corresponding to the area of interest based on the shooting time of the at least two area images and the detection and tracking of the vehicles in the at least two area images; Determine vehicle density information based on size information of the region of interest and the number of vehicles in the region of interest; the number of vehicles in the region of interest is obtained by screening vehicles in the region image based on position information of the region of interest in the region image; Determining road congestion information corresponding to the area of interest based on the average vehicle speed information of the area and the vehicle density information; The method further comprises: a step of calibrating a photographing device of the regional image, wherein the calibration of the photographing device may comprise the following steps: Acquire a calibration image captured by the capturing device; identifying a plurality of calibration objects in the calibration image; Determining the number of pixels of a preset part of the calibration object in the calibration image based on the coordinate information of the key points of the multiple calibration objects in the calibration image; When the number of pixels is different from the preset number, the calibration information of the shooting device is determined based on the coordinate information of the key points of the multiple calibration objects in the calibration image and the actual coordinate information of the key points in the world coordinate system.
2. The method according to claim 1, characterized in that The determining the road congestion information corresponding to the area of interest based on the average vehicle speed information of the area and the vehicle density information includes: Get density threshold and vehicle speed threshold; When the value corresponding to the average vehicle speed information of the area is less than the vehicle speed threshold, and the value corresponding to the vehicle density information is greater than the density threshold, it is determined that the road congestion information of the area of interest is in a congested state.
3. The method according to claim 2, characterized in that The road congestion information includes a congestion level; The determining of the road congestion information corresponding to the area of interest based on the area average vehicle speed information and the vehicle density information further includes: When it is determined that the road congestion information of the interest area is in a congested state, obtaining the speed limit information corresponding to the interest area; Based on the speed limit information, determining speed ranges corresponding to different congestion levels; Based on the average vehicle speed information of the area and the vehicle speed range, a congestion level corresponding to the area of interest is determined.
4. The method according to any one of claims 1 to 3, characterized in that: The determining of the regional average vehicle speed information corresponding to the region of interest based on the shooting time of the at least two region images and the detection and tracking of the vehicles in the at least two region images includes: Detecting the at least two area images to obtain vehicles contained in the area images; Tracking the vehicles detected in the at least two images, and matching the same vehicles detected in images of different regions; Determining the displacement of the vehicle based on the position of the same vehicle in any two area images; Determining the instantaneous speed of each of the vehicles based on the shooting time of the arbitrary two area images and the displacement of the vehicles; Based on the instantaneous speed of each of the vehicles, regional average vehicle speed information corresponding to the region of interest is determined.
5. The method according to claim 4, characterized in that The determining, based on the instantaneous speed of each of the vehicles, the regional average vehicle speed information corresponding to the region of interest includes: For each of the vehicles, determining a first average speed of the vehicle in the area of interest based on a plurality of instantaneous speeds of the vehicle in the area of interest; Based on a first average speed of each of the vehicles in the region of interest, determining a variance corresponding to a second average speed of all the vehicles in the region of interest and the first average speed; Based on the second average speed and the variance, regional average vehicle speed information corresponding to the region of interest is determined.
6. The method according to any one of claims 1 to 3, characterized in that: The determining of vehicle density information based on the size information of the area of interest and the number of vehicles in the area of interest includes: Determine the number of vehicles in the area of interest based on position information of the area of interest in the area image and the detected vehicles contained in the area image; Determining size information of the region of interest based on position information of the region of interest in the region image and calibration information of a photographing device that photographs the region image; Vehicle density information is determined based on the size information of the area of interest and the number of vehicles in the area of interest.
7. The method according to claim 6, characterized in that The size information of the region of interest includes: actual length information and actual width information of the region of interest in the world coordinate system; The determining of vehicle density information based on the size information of the area of interest and the number of vehicles in the area of interest includes: Determining the number of lanes in the region of interest based on the actual width information and a preset lane width; Based on the number of vehicles in the area of interest, the number of lanes and the actual length information, vehicle density information corresponding to the area of interest is determined.
8. The method according to claim 4, characterized in that The determining the displacement of the vehicle based on the position of the same vehicle in any two area images includes: For each of the vehicles, based on the position information of the vehicle in the two arbitrary area images and the calibration information of the shooting device that shoots the area images, determine the first actual position information and the second actual position information of the vehicle in the world coordinate system; Based on the first actual position information and the second actual position information, a displacement of the vehicle is determined.
9. The method according to claim 1, characterized in that: The calibration object includes a vehicle; and the key points of the calibration object include key points corresponding to wheels of the vehicle.
10. The method according to claim 1, characterized in that When the number of pixels is different from the preset number, determining the calibration information of the shooting device based on the coordinate information of the key points of the plurality of calibration objects in the calibration image and the actual coordinate information of the key points in the world coordinate system includes: In a case where the number of pixel points is different from the preset number, determining reprojection error information between a camera coordinate system corresponding to the shooting device and a world coordinate system based on coordinate information of key points of the multiple calibration objects in the calibration image and actual coordinate information of the key points in the world coordinate system; Based on the reprojection error information, calibration information of the photographing device is determined.
11. The method according to claim 10, characterized in that The calibration information includes external reference information and internal reference information of the shooting device; The determining, based on the reprojection error information, calibration information of the photographing device includes: Setting the intrinsic parameter information of the shooting device to fixed information, and determining the extrinsic parameter information of the shooting device based on the reprojection error information; and / or, The external parameter information of the shooting device is set as fixed information, and the internal parameter information of the shooting device is determined based on the reprojection error information.
12. A traffic detection device, characterized in that: include: An image acquisition module, used to acquire at least two area images including a preset area of interest from a road video stream; A vehicle speed determination module, configured to determine the regional average vehicle speed information corresponding to the region of interest based on the shooting time of the at least two region images and the detection and tracking of the vehicles in the at least two region images; A density determination module, configured to determine vehicle density information based on size information of the region of interest and the number of vehicles in the region of interest; the number of vehicles in the region of interest is obtained by screening vehicles in the region image based on position information of the region of interest in the region image; A congestion identification module, used to determine the road congestion information corresponding to the interest area based on the average vehicle speed information of the area and the vehicle density information; The device further includes a calibration module, which is used to calibrate the calibration information of the shooting device of the regional image according to the following steps: Acquire a calibration image captured by the capturing device; identifying a plurality of calibration objects in the calibration image; Determining the number of pixels of a preset part of the calibration object in the calibration image based on the coordinate information of the key points of the multiple calibration objects in the calibration image; When the number of pixels is different from the preset number, the calibration information of the shooting device is determined based on the coordinate information of the key points of the multiple calibration objects in the calibration image and the actual coordinate information of the key points in the world coordinate system.
13. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the traffic detection method according to any one of claims 1 to 11 are performed.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the traffic detection method according to any one of claims 1 to 11 are executed.
Citation Information
Patent Citations
Video-based urban road traffic jam detecting system
CN105513354A
Traffic jam detection system and method based on deep learning
CN110688922A
Vehicle speed measurement method, device and system based on video and distance grid calibration
CN112053572A
Road congestion level determination method
CN112069944A
Image-based positioning method and device, and position relationship judgment method and device
CN112541419A
