Road congestion detection method and related equipment
By acquiring video streams from highway cameras, performing target detection and tracking, determining standard travel time, and adaptively adjusting congestion judgment criteria, the problem of high false alarm rate and high cost of manual adjustment in highway congestion detection is solved, achieving more efficient congestion detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-03-13
AI Technical Summary
Existing technologies for highway congestion detection suffer from high false alarm rates, high costs of manual calibration, and low detection efficiency, making it difficult to achieve real-time and accurate congestion assessment.
By acquiring video streams from road cameras, target detection and tracking are performed to determine standard passage durations. These standard passage durations are then used for vehicle identification and intersection calculations to adaptively adjust congestion judgment criteria, reducing the need for manual adjustments.
It improves the sensitivity and accuracy of congestion detection, reduces the time cost of manual deployment and calibration, and enhances the adaptability of the scenario.
Smart Images

Figure CN121661825A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of traffic monitoring technology, and in particular to a method and related equipment for detecting road congestion. Background Technology
[0002] With the rapid development of the automotive industry, the highway network is becoming increasingly dense, and traffic flow continues to rise. The resulting traffic congestion problem is becoming increasingly severe, causing not only huge time and economic losses (such as increased fuel consumption and delayed logistics), but also a series of social and environmental problems, including increased exhaust pollution and a higher risk of traffic accidents. Therefore, real-time, accurate, and intelligent detection of highway congestion has become a key link in improving road network operational efficiency, ensuring public travel safety, and building a smart transportation system.
[0003] In related technologies, when dynamically detecting congestion events based on object detection, it is necessary to set the basic parameters of the corresponding road to determine the current road status. However, due to differences in field of view distance and number of lanes, the basic parameters of different highways vary significantly. When performing congestion detection on different road sections, using default values often results in numerous false alarms, and subsequent adjustments based on these false alarms are inefficient.
[0004] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the Invention
[0005] The main objective of this application is to propose a road congestion detection method and related equipment, which can improve the sensitivity and accuracy of congestion detection and reduce the time cost of manual deployment and adjustment.
[0006] To achieve the above objectives, one aspect of this application proposes a road congestion detection method, the method comprising: Acquire video streams from road surveillance cameras; Target detection is performed on the video footage of the video stream to identify target vehicles on the road; The standard passage duration is determined based on the passage duration of the target vehicle in the video footage; Based on the standard passage duration, target identification is performed on the same vehicle between two different video frames to obtain the number of intersections between the video frames. Based on the number of intersections, road congestion is assessed to determine whether the current road is congested.
[0007] In some embodiments, the step of performing target detection on the video frame of the video stream to determine target vehicles on the road includes: The target vehicle is identified by using a target detection model to identify vehicles in the video stream. The target vehicle is tracked using a tracking model to determine its appearance and disappearance times.
[0008] In some embodiments, determining the standard passage duration based on the passage duration of the target vehicle in the video footage includes: The passage time is calculated based on the appearance and disappearance times of the target vehicle; Compare the number of records passed over the specified time period with the preset number; If the number of records is greater than the preset number, the records are sorted by their throughput to obtain a throughput sequence. The median of the duration sequence is determined as the standard passage duration.
[0009] In some embodiments, the step of identifying the same vehicle between two different video frames based on the standard passage duration to obtain the number of intersections between the video frames includes: Based on the current video frame's time and the aforementioned standard passage duration, historical video frames are determined; Vehicle target recognition is performed on the current video frame and the historical video frame respectively to obtain the target vehicle number in each frame; The number of intersections is obtained based on the same target vehicle number in the current video frame and the historical video frame.
[0010] In some embodiments, before identifying the same vehicle between two different video frames based on the standard travel duration, the method further includes calculating a congestion threshold based on the standard travel duration to obtain a congested vehicle number threshold. The calculation of the congestion threshold based on the standard travel duration to obtain the congested vehicle number threshold includes: The target vehicles are classified according to their coordinates to determine the number of lanes on one side of the road. Multiply the number of lanes on one side by the standard travel time to obtain the threshold number of congested vehicles.
[0011] In some embodiments, determining whether the current road is congested based on the number of intersections includes: Vehicle target recognition is performed on the historical video footage to obtain the number of vehicles; The intersection percentage is calculated based on the number of intersections and the number of vehicles. If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is greater than the preset congestion value, then the current road is determined to be congested to varying degrees.
[0012] In some embodiments, the congestion preset value includes a first preset value and a second preset value. The step of determining different levels of congestion on the current road if the number of intersections is greater than the threshold for the number of congested vehicles and the proportion of intersections is greater than the congestion preset value includes: If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is greater than a first preset value, then the current road is determined to be severely congested. If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is less than or equal to the first preset value and greater than the second preset value, then the current road is determined to be generally congested. If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is less than or equal to the second preset value, then the current road is determined to be in a smooth state.
[0013] To achieve the above objectives, another aspect of this application provides a road congestion detection device, the device comprising: The acquisition module is used to acquire the video stream from the road surveillance cameras; The detection module is used to perform target detection on the video frame of the video stream to identify target vehicles on the road; The calculation module is used to determine the standard passage duration based on the passage duration of the target vehicle in the video footage; The identification module is used to identify the same vehicle between two different video frames based on the standard passage duration, and to obtain the number of intersections between the video frames. The judgment module is used to judge road congestion based on the number of intersections and determine whether the current road is congested.
[0014] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described above.
[0015] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the methods described above.
[0016] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer program product, including a computer program that, when executed by a processor, implements the aforementioned method.
[0017] The embodiments of this application include at least the following beneficial effects: This application provides a road congestion detection method, device, electronic device, storage medium, and program product. This solution acquires video streams from road cameras; performs target detection on the video stream frames to identify target vehicles on the road; determines a standard travel time based on the travel duration of the target vehicles in the video frames; identifies the same vehicles between two different video frames based on the standard travel time to obtain the number of intersections between the video frames; and judges road congestion based on the number of intersections to determine whether the current road is congested. This application performs target detection based on the video stream frames, automatically determines the standard travel time of the current road, adaptively adjusts the road congestion judgment criteria, reduces manual parameter adjustments, and uses the standard travel time as the basis for judgment to determine the number of intersections between two different video frames, which helps improve the sensitivity and accuracy of congestion detection, as well as the scene's adaptive capability. Attached Figure Description
[0018] Figure 1 This is a flowchart of the road congestion detection method provided in the embodiments of this application; Figure 2 This is a flowchart of the congestion detection method based on a classification model provided in an embodiment of this application; Figure 3 This is a flowchart of a method for determining congestion status based on traffic flow provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of the highway congestion adaptive detection device provided in the embodiments of this application; Figure 5 This is a complete flowchart of the road congestion detection method provided in the embodiments of this application; Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0021] Before providing a detailed description of the embodiments of this application, some of the nouns and terms involved in the embodiments of this application will be explained first. The nouns and terms involved in the embodiments of this application are subject to the following interpretations.
[0022] With the rapid development of the economy and the automotive industry, the highway network is becoming increasingly dense, and traffic flow continues to rise. The resulting traffic congestion problem is becoming increasingly severe, causing not only huge time and economic losses (such as increased fuel consumption and delayed logistics), but also a series of social and environmental problems, including increased exhaust pollution and a higher risk of traffic accidents. Therefore, real-time, accurate, and intelligent detection of highway congestion has become a key link in improving road network operational efficiency, ensuring public travel safety, and building a smart transportation system.
[0023] There are three main categories of technologies for real-time detection of highway congestion based on visual inspection, such as... Figure 2 As shown, there are two approaches: one is to directly detect congestion events using a target detection model based on congestion event annotation, and the other is to determine whether congestion has occurred on the screen using a classification model. Target detection directly outputs congestion bounding boxes or screen classifications. Firstly, it requires collecting and annotating a large amount of data, which is time-consuming and labor-intensive. Secondly, this type of detection is static rather than dynamic, and cannot distinguish between slow-moving and completely blocked congestion states, leading to a high number of false alarms.
[0024] like Figure 3 As shown, the third method is to determine congestion status based on traffic flow calculated from target detection. Relying on traffic flow and speed to determine congestion requires pre-setting values for different road segments. Setting reasonable values requires prior debugging and testing, resulting in high implementation costs and difficulties. Furthermore, changes in traffic flow values require a long response time, reducing the sensitivity of congestion event reporting.
[0025] In object detection-based dynamic congestion detection methods, adjusting congestion thresholds for different road segments is challenging. When dynamically detecting congestion events using object detection, basic parameters such as quantity, traffic flow, and vehicle speed need to be set to determine the current road condition. However, these basic parameters vary significantly across different highways due to differences in field of view and number of lanes. Therefore, deploying congestion detection methods using traffic flow and speed on different road segments often results in numerous false alarms when using default values, requiring subsequent adjustments based on these false alarms, which is inefficient.
[0026] In view of this, this application provides a road congestion detection method and related equipment. This method performs target detection based on video footage from a video stream, automatically determines the standard travel time of the current road, adaptively adjusts the criteria for judging road congestion, reduces the time cost of manual deployment and adjustment, and determines the number of intersections between two different video footage based on the standard travel time, which helps to improve the sensitivity and accuracy of congestion detection.
[0027] The road congestion detection method provided in this application relates to the field of traffic monitoring technology. The road congestion detection method provided in this application can be applied to a terminal, a server, or software running on a terminal or server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, or vehicle terminal, but is not limited to these. The server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network. The software can be an application implementing the road congestion detection method, but is not limited to the above forms.
[0028] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0029] Figure 1 This is an optional flowchart of the road congestion detection method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S101 to S105.
[0030] Step S101: Obtain the video stream from the road surveillance camera; Step S102: Perform target detection on the video stream to identify target vehicles on the road; Step S103: Determine the standard passage duration based on the passage duration of the target vehicle in the video footage; Step S104: Based on the standard passage time, target identification is performed on the same vehicle between two different video frames to obtain the number of intersections between the video frames. Step S105: Determine whether the road is congested based on the number of intersections.
[0031] Steps S101 to S105 as shown in the embodiments of this application perform target detection based on the video images of the video stream, automatically determine the standard passage time of the current road, adaptively adjust the road congestion judgment criteria, reduce the time cost of manual deployment and adjustment, and determine the number of intersections between two different video images based on the standard passage time, which is beneficial to improving the sensitivity and accuracy of congestion detection.
[0032] In some embodiments, step S102 may include, but is not limited to, steps S201 to S202: The target vehicle is identified by using a target detection model to identify vehicles in the video stream. The target vehicle is tracked using a tracking model to determine its appearance and disappearance times.
[0033] In steps S201 to S202 of some embodiments, the target detection model can identify and locate targets such as vehicles, pedestrians, and traffic signs in the video stream. This model can be YOLO, Faster R-CNN, or SSD, etc. The tracking model can be a motion feature-based model that associates inter-frame targets using motion information such as the target's position and speed, or a appearance feature-based model that combines the target's visual features (such as color and texture) to improve the association accuracy. The target detection model and tracking model determine the encoding of each target vehicle, changes in its coordinates, and the times it appears and disappears on the road in the video frame. Target recognition based on the real-time video stream serves as the basis for subsequent adaptive adjustment of the standard passage duration.
[0034] In some embodiments, step S103 may include, but is not limited to, steps S301 to S304: Step S301: Calculate the passage time based on the appearance and disappearance times of the target vehicle; Step S302: Compare the number of records by duration with the preset number; Step S303: If the number of records is greater than the preset number, sort the records by their passage time to obtain a duration sequence; Step S304: Determine the median of the duration sequence as the standard passage duration.
[0035] In steps S301 to S304 of some embodiments, the disappearance time of each target vehicle appearing in the video frame is subtracted from its appearance time to obtain the passage time of each vehicle in the frame. The passage time of each vehicle is recorded. When the number of recorded passage times exceeds a preset number, the recorded passage times are sorted, and the median of the sequence is taken as the standard passage time. By limiting the number of records to no less than a preset number n, the impact of abnormal data on the calculation of the standard duration is reduced, and the calculation stability is improved.
[0036] In some embodiments, step S104 may include, but is not limited to, steps S401 to S403: Step S401: Determine the historical video frames based on the current video frame's time and the standard passage duration; Step S402: Perform vehicle target recognition on the current video frame and the historical video frame respectively to obtain the target vehicle number in each frame; Step S403: Calculate the number of intersections based on the same target vehicle number in the current video frame and the historical video frame.
[0037] In step S401 of some embodiments, the time of the current video frame is subtracted from the standard passage duration to obtain the time point of the historical video frame that can be used for comparison. The video frames before this time point can be used for discrimination comparison, that is, the difference between the time of the current video frame and the time of the historical video frame is greater than the standard passage duration Ts.
[0038] In step S402 of some embodiments, vehicle target recognition and tracking are performed on the current video frame and historical video frame respectively using the target detection model and tracking model of the above embodiments, and the number of each target vehicle in the frame is determined, with each vehicle using a unique number.
[0039] In step S403 of some embodiments, the same vehicles in the current video frame and the historical video frame can be determined based on the same encoding, and the number of the same vehicles, i.e. the number of intersections, can be further determined.
[0040] By setting the time difference between the current video frame and the historical video frame to be greater than the standard travel time, the number of overlapping vehicles under normal circumstances is reduced as much as possible, thereby reducing the number of intersections. This reduces the interference of excessive intersections on subsequent congestion judgments. If congestion occurs, the vehicle's travel time will be less than the standard travel time, and the number of intersections will be larger. Therefore, the number of intersections can be used as a basis for judging road congestion.
[0041] In some embodiments, before performing step S403, the road congestion detection method further includes step S410: Step S410: Calculate the congestion threshold based on the standard travel time to obtain the threshold for the number of vehicles stuck in congestion.
[0042] Step S410 may include, but is not limited to, steps S411 to S412: Step S411: Classify the target vehicles according to their coordinates and determine the number of lanes on one side of the road. Step S412: Multiply the number of lanes on one side by the standard travel time to obtain the threshold number of congested vehicles.
[0043] In step S411 of some embodiments, the coordinates and changes of the target vehicle are determined by the target detection model and tracking model of the above embodiments. Classification methods such as kmeans++ are used to classify the coordinates of the target vehicles in the image, which can determine the number of lanes on one side of the current road. For example, vehicles in the same lane have the same or similar horizontal coordinates, while vehicles in different lanes have significantly different horizontal coordinates. This allows for coordinate classification to determine the number of lanes on one side, i.e., the number of lanes in a single direction.
[0044] In step S412 of some embodiments, the standard travel time Ts and the number of lanes S are used to calculate the threshold W for the number of vehicles stuck in traffic congestion, as shown in the following formula.
[0045] W=Ts*S; The threshold for the number of vehicles stuck in congestion can be used as one of the criteria for judging subsequent road congestion. By introducing the calculation of standard travel time and number of lanes, the length of the road field of view and road capacity from the monitoring perspective can be directly estimated. This can reduce false alarms caused by the mismatch between default preset values and actual road conditions, and also reduce the time cost of manual adjustment when deploying the algorithm system.
[0046] In some embodiments, step S105 may include, but is not limited to, steps S501 to S503: Step S501: Perform vehicle target recognition on the historical video footage to obtain the number of vehicles; Step S502: Calculate the intersection ratio based on the number of intersections and the number of vehicles; Step S503: If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is greater than the preset congestion value, then the current road is determined to be congested to varying degrees.
[0047] In steps S501 to S503 of some embodiments, vehicle target recognition is performed on the historical video footage to obtain the number of vehicles L0. The intersection count Li is divided by the number of vehicles L0 to calculate the intersection ratio P, as shown in the following formula: P=Li / L0; Determine whether the intersection length Li is greater than the threshold W for the number of congested vehicles, and whether the intersection ratio P is greater than the preset congestion value X. If the above conditions are met, it is determined that the road is congested to varying degrees.
[0048] In some embodiments, step S503 may include, but is not limited to, steps S531 to S533: Step S531: If the number of intersections is greater than the threshold for the number of congested vehicles and the proportion of intersections is greater than the first preset value, then the current road is determined to be severely congested. Step S532: If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is less than or equal to the first preset value and greater than the second preset value, then the current road is determined to be generally congested. Step S533: If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is less than or equal to the second preset value, then the current road is determined to be in a smooth state.
[0049] In steps S531 to S533 of some embodiments, if it is only necessary to determine whether the road is congested, only one congestion preset value can be set. If it is necessary to determine different degrees of congestion, multiple preset values need to be set. For example, the first preset value can be set to 70%, and the second preset value can be set to 50%. When the number of intersections is greater than the threshold of the number of congested vehicles, if the intersection ratio is greater than 70%, the current road is determined to be severely congested. If the intersection ratio is less than or equal to 70% but greater than 50%, the current road is determined to be moderately congested. If the intersection ratio is less than or equal to 50%, the current road is determined to be in a smooth state.
[0050] This embodiment improves the sensitivity of the dynamic detection process through retention calculation, and can also achieve the function of classifying the degree of congestion by segmenting the intersection ratio.
[0051] In some embodiments, please refer to Figure 4 An adaptive highway congestion detection device, used to execute the aforementioned road congestion detection method in highway scenarios, includes: Target recognition module: responsible for connecting to the video stream of the highway camera to be detected and using the target detection model to obtain vehicle targets in the image.
[0052] The congestion detection cycle adaptive module is responsible for determining the standard passage time of vehicles through adaptive road segments and using this as the detection cycle for congestion status.
[0053] Calculation module: Responsible for calculating traffic congestion-related data for road sections.
[0054] Judgment module: Responsible for determining whether there is a congestion event on the current screen based on the values obtained from the calculation module.
[0055] In some embodiments, please refer to Figure 5 A road congestion detection method includes: S1: Acquire the video stream from the camera, and use the target detection model and tracking model to obtain the vehicle target in the image; S2: Record the time of vehicle appearance according to the legal driving direction and vehicle ID, and record the center coordinates of the vehicle appearing in the uphill direction; S3: When a vehicle with a certain ID is not present in the frame, the time Tx taken for the vehicle to pass through is calculated by the difference between the current time T1 and the time the vehicle appeared T0. The calculation process is as follows: Tx = T1 - T0; S4: Determine whether the number of recorded travel times N (i.e. the number of vehicles that have passed through the road) is greater than or equal to n; S5: If the number N is greater than or equal to n, sort all the recorded passage times and take the median as the standard passage time Ts for vehicles to pass through the road. Classify the coordinates when the uphill vehicle appears to obtain the number of lanes on one side S; otherwise, continue to record the travel time of passing vehicles on the road in the picture until the number of travel times N is greater than or equal to n. S6: Calculate the threshold W for the number of vehicles stuck in traffic congestion using the standard transit time Ts and the number of lanes S. The calculation process is as follows: W=Ts*S; S7: Record the current screen time and record the IDs of all vehicles on the road in the current screen according to the direction of travel; S8: Determine whether the difference between the current frame time and the last recorded frame time is greater than the standard road passage time Ts; S9: If so, obtain the IDs and quantities L1 of all vehicles on the road in the current view according to the direction, calculate the intersection of two ID records in the same direction, obtain the intersection length Li, and calculate the proportion of the quantity of this intersection in the initial record L0. The calculation process is as follows: P=Li / L0; Otherwise, continue waiting until the difference between the frame time and the last recorded frame time is greater than Ts; S10: Determine whether the intersection length Li is greater than the number of congested vehicles W, and whether the intersection ratio P is greater than the preset congestion value X; S11: If yes, then there is congestion in that direction on that road segment; otherwise, there is no congestion in that direction on that road segment.
[0056] This embodiment includes at least the following beneficial effects: By calculating standard passage time and lane number, congestion detection algorithms can estimate basic road conditions, thereby enabling adaptive detection on different highway sections, reducing deployment parameter adjustments, improving the algorithm's ability to be used immediately upon deployment, and enhancing the scenario's adaptability and the algorithm's robustness.
[0057] This application embodiment also provides a road congestion detection device that can implement the above-described method. The device includes: The acquisition module is used to acquire the video stream from the road surveillance cameras; The detection module is used to detect targets in the video stream and identify target vehicles on the road. The calculation module is used to determine the standard passage duration based on the passage duration of the target vehicle in the video footage; The recognition module is used to identify the same vehicle between two different video frames based on the standard passage duration, and to obtain the number of intersections between the video frames. The judgment module is used to judge road congestion based on the number of intersections and determine whether the current road is congested.
[0058] It is understood that the content of the above method embodiments is applicable to the present device embodiments. The specific functions implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0059] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0060] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0061] Please see Figure 6 , Figure 6 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 902 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 902 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called and executed by the processor 901 using the methods described in the embodiments of this application. The input / output interface 903 is used to implement information input and output; The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904); The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.
[0062] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0063] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0064] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0065] It is understood that the content of the above method embodiments is applicable to the embodiments of this program product. The specific functions implemented by the embodiments of this program product are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0066] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0067] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0068] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0069] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0070] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0071] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0072] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0073] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0074] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0075] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0076] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0077] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A method for detecting road congestion, characterized in that, The method includes the following steps: Acquire video streams from road surveillance cameras; Target detection is performed on the video footage of the video stream to identify target vehicles on the road; The standard passage duration is determined based on the passage duration of the target vehicle in the video footage; Based on the standard passage duration, target identification is performed on the same vehicle between two different video frames to obtain the number of intersections between the video frames. Based on the number of intersections, road congestion is assessed to determine whether the current road is congested.
2. The method according to claim 1, characterized in that, The step of performing target detection on the video stream to determine target vehicles on the road includes: The target vehicle is identified by using a target detection model to identify vehicles in the video stream. The target vehicle is tracked using a tracking model to determine its appearance and disappearance times.
3. The method according to claim 1, characterized in that, The step of determining the standard passage duration based on the passage duration of the target vehicle in the video footage includes: The passage time is calculated based on the appearance and disappearance times of the target vehicle; Compare the number of records passed over the specified time period with the preset number; If the number of records is greater than the preset number, the records are sorted by their throughput to obtain a throughput sequence. The median of the duration sequence is determined as the standard passage duration.
4. The method according to claim 1, characterized in that, The step of identifying the same vehicle between two different video frames based on the standard passage duration, and obtaining the number of intersections between the video frames, includes: Based on the current video frame's time and the aforementioned standard passage duration, historical video frames are determined; Vehicle target recognition is performed on the current video frame and the historical video frame respectively to obtain the target vehicle number in each frame; The number of intersections is obtained based on the same target vehicle number in the current video frame and the historical video frame.
5. The method according to claim 4, characterized in that, Before identifying the same vehicle between two different video frames based on the standard travel time, the method further includes calculating a congestion threshold based on the standard travel time to obtain a congested vehicle number threshold. The calculation of the congestion threshold based on the standard travel time to obtain the congested vehicle number threshold includes: The target vehicles are classified according to their coordinates to determine the number of lanes on one side of the road. Multiply the number of lanes on one side by the standard travel time to obtain the threshold number of congested vehicles.
6. The method according to claim 5, characterized in that, The step of determining whether the current road is congested based on the number of intersections includes: Vehicle target recognition is performed on the historical video footage to obtain the number of vehicles; The intersection percentage is calculated based on the number of intersections and the number of vehicles. If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is greater than the preset congestion value, then the current road is determined to be congested to varying degrees.
7. The method according to claim 6, characterized in that, The congestion preset values include a first preset value and a second preset value. If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is greater than the congestion preset value, then different levels of congestion on the current road are determined, including: If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is greater than a first preset value, then the current road is determined to be severely congested. If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is less than or equal to the first preset value and greater than the second preset value, then the current road is determined to be generally congested. If the number of intersections is greater than the threshold for the number of congested vehicles, and the proportion of intersections is less than or equal to the second preset value, then the current road is determined to be in a smooth state.
8. A road congestion detection device, characterized in that, The device includes: The acquisition module is used to acquire the video stream from the road surveillance cameras; The detection module is used to perform target detection on the video frame of the video stream to identify target vehicles on the road; The calculation module is used to determine the standard passage duration based on the passage duration of the target vehicle in the video footage; The identification module is used to identify the same vehicle between two different video frames based on the standard passage duration, and to obtain the number of intersections between the video frames. The judgment module is used to judge road congestion based on the number of intersections and determine whether the current road is congested.
9. An electronic device, characterized in that, include: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method as described in any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.