Traffic incident detection method, device, electronic device and readable storage medium
By identifying the shooting status of the video acquisition device, combining target detection and road detection, the problems of misjudgment and misjudgment in the intelligent cloud police system are solved, and the accuracy and comprehensiveness of traffic event detection are achieved.
Patent Information
- Application Number
- CN202111171655.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-08
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2041-10-08
AI Technical Summary
During traffic event detection, the existing intelligent cloud police system failed to identify the camera status of the gimbal camera, resulting in misjudgment or misjudgment, and the detection results were inaccurate and incomplete.
By acquiring multiple frame images, we can identify whether the shooting state of the video acquisition device is a stationary state or a motion state. If it is stationary, object detection and tracking and road detection are performed. If it is a motion state, wait for the state to stabilize before detection is performed to ensure the accuracy and comprehensiveness of the detection results.
It improves the accuracy and comprehensiveness of traffic event detection, avoids the impact of dynamic shooting on the detection results, and can more comprehensively determine the type of traffic event.
Smart Images

Figure CN113869258B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent security technology, and in particular to a traffic incident detection method, device, electronic device and readable storage medium. Background Art
[0002] With the continuous increase in urban road traffic volume, traffic accidents have increased significantly, and the intelligent cloud police system has come into being. It refers to a back-end service platform that detects traffic violations by pulling the network video streams of cameras on existing roads, effectively improving the efficiency of security work.
[0003] Currently, existing intelligent cloud alarm systems detect traffic incidents through surveillance videos obtained by pan-tilt cameras. The pan-tilt cameras can be operated to change the monitoring angle, thereby obtaining surveillance videos in various situations. However, existing traffic incident detection methods usually cannot identify the shooting status of the pan-tilt cameras, which can easily lead to misjudgments or missed judgments, resulting in inaccurate and incomplete detection results. Summary of the Invention
[0004] One of the objectives of the present invention is to provide a traffic incident detection method, device, electronic device and readable storage medium for improving the accuracy and comprehensiveness of traffic incident detection results.
[0005] The embodiments of the present invention can be implemented as follows:
[0006] In a first aspect, the present invention provides a traffic event detection method, the method comprising: acquiring multiple frame images, the multiple frame images coming from the same video acquisition device; identifying, based on the multiple frame images, whether the shooting state of the video acquisition device when shooting the multiple frame images is a stationary state or a moving state; if the shooting state is a stationary state, performing target detection and tracking, as well as road detection on the frame image, to determine the type of traffic event corresponding to the target appearing in the frame image; if the shooting state is a moving state, obtaining a new frame image to determine the shooting state, until it is determined that the shooting state is the stationary state, performing target detection and tracking, as well as road detection on the new frame image, to determine the type of traffic event corresponding to the target appearing in the new frame image.
[0007] In a second aspect, the present invention provides a traffic event detection device, comprising: an acquisition module for acquiring multiple frame images, wherein the multiple frame images are from the same video acquisition device; an identification module for identifying, based on the multiple frame images, whether the shooting state of the video acquisition device is a stationary state or a moving state; a detection module for performing target detection and tracking, as well as road detection on the frame image if the shooting state is a stationary state, to determine the type of traffic event corresponding to the target appearing in the frame image; the identification module is also used to obtain a new frame image to determine the shooting state if the shooting state is a moving state, until it is determined that the shooting state is the stationary state, and the detection module is also used to perform target detection and tracking, as well as road detection on the new frame image to determine the type of traffic event corresponding to the target appearing in the new frame image.
[0008] In a third aspect, the present invention provides an electronic device comprising a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the traffic event detection method described in the first aspect.
[0009] In a fourth aspect, the present invention provides a readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the traffic incident detection method described in the first aspect.
[0010] The present invention provides a traffic event detection method, device, electronic device and readable storage medium. The method includes: obtaining multiple frame images, where the multiple frame images come from the same video acquisition device, to identify whether the shooting state of the video acquisition device when shooting the multiple frame images is a static state or a moving state, thereby avoiding the influence of possible dynamic shooting on the detection results; if the shooting state is a static state, target detection and tracking, as well as road detection, are performed on the frame image to determine the type of traffic event corresponding to the target appearing in the frame image; if the shooting state is a moving state, a new frame image is obtained to determine the shooting state, until the shooting state is determined to be a static state, target detection and tracking, as well as road detection are performed on the new frame image to determine the type of traffic event corresponding to the target appearing in the new frame image; during the entire traffic event determination process, not only the target is detected and tracked, but also the road detection is performed, and then the traffic event type can be determined based on the results of the road detection, detection and tracking, and the traffic event type can be determined more comprehensively, thereby achieving the effect of increasing the accuracy and type of the detection results. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.
[0012] Figure 1 This is an architectural diagram of an intelligent cloud alarm system;
[0013] Figure 2 This is a diagram of the implementation framework of an existing traffic incident detection method;
[0014] Figure 3 A schematic flow chart of a traffic incident detection method provided by an embodiment of the present invention;
[0015] Figure 4 A schematic flowchart of a possible implementation of step S302 provided in an embodiment of the present invention;
[0016] Figure 5 An example diagram of a scenario provided for the implementation of the present invention;
[0017] Figure 6 A schematic flowchart of an implementation method of step S302-4 provided in an embodiment of the present invention;
[0018] Figure 7 A schematic flowchart of an implementation of step 303 provided in an embodiment of the present invention;
[0019] Figure 8 A functional module diagram of a traffic incident detection device provided by an embodiment of the present invention;
[0020] Figure 9 A block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations.
[0022] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention as claimed, but rather merely represents selected embodiments of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without creative effort shall fall within the scope of protection of the present invention.
[0023] 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, it does not need to be further defined or explained in subsequent drawings.
[0024] In addition, the terms "first", "second", etc., if used, are merely used to distinguish and describe, and should not be understood as indicating or implying relative importance.
[0025] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.
[0026] Before introducing the embodiments of the present invention, the terms involved in the embodiments of the present invention are first explained.
[0027] Smart Cloud Alarm: refers to the back-end service platform that detects traffic incidents by pulling the network video streams of cameras on existing roads, and issues an alarm when an abnormal traffic incident is detected.
[0028] Abnormal traffic incidents: refers to traffic incidents that are inconsistent with traffic rules, such as occupying the emergency lane, abnormal lane changes, driving on the line, abnormal parking, traffic congestion, etc.
[0029] PTZ camera: refers to a camera with a PTZ. It has a device that supports the camera's rotation, allowing the camera to shoot from multiple angles. It is the main video capture device.
[0030] At present, the intelligent cloud alarm system has been widely used in the field of intelligent security, used to assist in the analysis of the correlation between people and vehicles and the judgment of various traffic incidents. Figure 1 , Figure 1 This is an architecture diagram of an intelligent cloud alarm system, which may include: a network 10, a server 20 and at least one video acquisition device 30.
[0031] The network 10 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0032] The server 20 may be, but is not limited to, a server with data processing capabilities, or a server cluster consisting of several servers with data processing capabilities. The traffic event detection method provided in the embodiment of the present invention may be applied to the server 20 .
[0033] The video acquisition device 30 can be, but is not limited to, a pan-tilt camera and a fixed camera, and can be set near urban roads to capture surveillance videos of pedestrians, vehicles, etc.
[0034] For example, the video acquisition device 30 may send the monitoring video to the server 20. After the server obtains the monitoring video, it may process and analyze the monitoring video to determine the target traffic event that is occurring.
[0035] Continue with Figure 1 For example, see the system architecture shown in Figure 2 , Figure 2 This is an implementation framework diagram of an existing traffic incident detection method. It can be seen that the existing traffic incident detection method directly performs target detection on the obtained image data, and after distinguishing the vehicle area and pedestrian area, it determines whether the targets in these two areas are parking events, wrong-way events or pedestrian events.
[0036] The above implementation process demonstrates that, on the one hand, existing technologies ignore the impact of the video capture device's motion on traffic event detection. For example, when the gimbal rotates, a vehicle may be traveling forward, but appear to be traveling in the reverse direction in the image, leading to a misjudgment of a traffic event. On the other hand, existing technologies fail to incorporate road information to determine traffic event types, resulting in a limited range of traffic event types and an inability to comprehensively identify traffic events corresponding to various types of targets.
[0037] In order to solve the above problems, the present invention provides a method for detecting traffic incidents. Figure 3 , Figure 3 A schematic flow chart of a traffic incident detection method provided by an embodiment of the present invention, the method comprising:
[0038] S301, acquiring multiple frame images.
[0039] The multiple frame images are from the same video acquisition device.
[0040] S302: Identify, based on the multiple frame images, whether the shooting state of the video acquisition device when shooting the multiple frame images is a stationary state or a moving state.
[0041] In this embodiment, the shooting state refers to the change of the shooting angle of the video capture device during the video shooting process. If the shooting angle is constantly changing, it indicates that the shooting state is a moving state. If the shooting angle remains unchanged, it indicates that the shooting state is a stationary state.
[0042] For example, if the video acquisition device is a pan-tilt camera, then during the shooting process, the pan-tilt may need to be rotated due to shooting requirements, resulting in a change in the shooting angle. Therefore, the above-mentioned multiple frame images may be taken statically by the pan-tilt camera or in dynamic mode; if the video acquisition device is a fixed camera, the shooting angle remains unchanged. Therefore, it can be considered that the above-mentioned multiple frame images are taken statically by the fixed camera.
[0043] It is understandable that if the shooting state is a moving state, the movement of the target in the captured image may not match the actual movement, thereby affecting the subsequent determination result of the traffic event type. Therefore, the embodiment of the present invention first identifies the shooting state of the video acquisition device based on the obtained frame image, and then executes different processing flows based on the recognition result, so as to avoid the problem of inaccurate subsequent detection results due to dynamic shooting.
[0044] S303: If the shooting state is a stationary state, target detection and tracking, as well as road detection, are performed on the frame image to determine the type of traffic event corresponding to the target appearing in the frame image.
[0045] S304: If the shooting state is a moving state, a new frame image is obtained to determine the shooting state. After the shooting state is determined to be a stationary state, target detection and tracking, as well as road detection, are performed on the new frame image to determine the type of traffic event corresponding to the target appearing in the new frame image.
[0046] On the one hand, if the shooting state is static, it indicates that the action of the target in the frame image is consistent with the actual action, so the subsequent processing flow of determining the type of traffic event can be directly executed, thereby obtaining comprehensive and accurate detection results.
[0047] On the other hand, if the shooting state is in motion, the target's motion in the frame image may not match its actual motion. For example, in an image captured by a PTZ camera, a vehicle may be traveling forward, but the pan-tilt may rotate, causing the image to show it traveling in the opposite direction. Alternatively, a vehicle may be stationary, but the pan-tilt may rotate, causing the image to show it moving. To prevent this from affecting the detection results, after recognizing that the shooting state is in motion, the process of determining the traffic event type is not executed. Instead, the frame image is re-acquired and the shooting state is re-identified. The process of determining the traffic event type is not executed until the shooting state is determined to be stationary.
[0048] The traffic event detection method provided by the embodiment of the present invention is different from the existing technology in that the existing technology directly performs detection based on the obtained image, while the embodiment of the present invention first identifies the shooting status of the video acquisition device after obtaining the image, and only executes the subsequent traffic event determination process after determining that the video acquisition device is static shooting, thereby avoiding the possible impact of dynamic shooting on the detection results; furthermore, in the process of traffic event determination, the existing technology only determines the type of traffic event based on the detection and tracking results, making the detection results incomplete, while in the process of determining the type of traffic event, the embodiment of the present invention not only detects and tracks the target, but also performs road detection, and then can determine the type of traffic event based on road information, detection and tracking information, and can more comprehensively determine the type of traffic event, thereby achieving the effect of increasing the accuracy and type of detection results.
[0049] In some possible implementations, with respect to step S301 , the multiple frame images obtained may be obtained by the server decoding a real-time surveillance video stream, or may be transmitted to the server in real time by other devices having video decoding capabilities.
[0050] In some possible implementations, the number of frame images in step S301 can be determined based on the actual decoding capability. For example, if 25 frames of images can be decoded per second, all of these 25 frames of images can be used for subsequent state recognition and traffic event detection. The number of frame images can also be customized by the user based on actual needs and is not limited here.
[0051] Optionally, in order to reduce computational time and complexity, after obtaining multiple frame images, the following process may be performed:
[0052] The multiple frame images are scaled to obtain multiple frame images of a preset size.
[0053] It's understandable that scaling the acquired multi-frame images to a preset size has little impact on the overall recognition performance, and the reduced image size reduces computational complexity, thus reducing computational time. For example, if the original image size is 1920*1080, to reduce computational time, the original image can be scaled to 480*270, reducing the image's width and height to 1 / 4 of their original size. The computational complexity of the scaled image is reduced by 1 / 16 compared to the original image.
[0054] Optionally, after scaling the multiple frames of images, the embodiment of the present invention further provides an implementation method for identifying the shooting state of the video acquisition device, see Figure 4 , Figure 4 This is a schematic flowchart of a possible implementation of step S302 provided in an embodiment of the present invention, where step S302 may include the following sub-steps:
[0055] S302 - 1 : selecting a plurality of continuous target frame images according to the time sequence of the plurality of frame images, and determining the frame images other than the target frame images as detection frame images.
[0056] In this embodiment, the target frame image is used to identify the shooting state of the video acquisition device, and the detection frame image is used to detect the traffic event corresponding to the target when the video acquisition device is determined to be in a stationary state.
[0057] The number of target frames and detection frames can be defined based on actual needs and is not limited here. For example, if 10 consecutive frames are acquired, the first 9 frames can be used as target frames to identify the shooting status of the video acquisition device, and the 10th frame can be used as the detection frame to detect the traffic event corresponding to the target.
[0058] S302-2: Construct multiple Gaussian models for the target pixel position according to the pixel values of the same target pixel position in all target frame images.
[0059] The target pixel position is any position in the target frame image.
[0060] S302-3, traverse all target frame images to obtain multiple Gaussian models corresponding to each target pixel position.
[0061] It can be understood that the sizes of the multiple frame images obtained in this embodiment are the same, that is, each target frame image has the same pixel positions. For the same pixel position in all target frame images, the pixel values at this pixel position in all target frame images are statistically analyzed, and it can be determined that the pixel value distribution of this pixel position shows a Gaussian distribution trend. Therefore, for each pixel position, K Gaussian distribution models can be constructed, and K is preferably 3 to 5.
[0062] In this embodiment, the purpose of constructing the Gaussian model is to match foreground pixels and background pixels in the detection frame image, and then the shooting status of the video acquisition device can be quickly determined based on the proportion of foreground pixels and background pixels.
[0063] S302-4, matching the pixel value at the target pixel position in the detection image with multiple Gaussian models corresponding to the target pixel position to obtain a binary image corresponding to the detection image.
[0064] The binary image includes foreground pixels and background pixels, wherein the foreground pixels have a first pixel value and the background pixels have a second pixel value.
[0065] The first pixel value and the second pixel value can be selected according to actual needs, but the selection principle is that the difference between the two pixel values can clearly distinguish the foreground and background; for example, the first pixel value is 0 and the second pixel value is 255.
[0066] S302-5: When the ratio between the number of foreground pixels and the number of background pixels is greater than or equal to a first threshold, it is determined that the video acquisition device is in motion.
[0067] S302-6: When the ratio between the number of foreground pixels and the number of background pixels is less than a first threshold, it is determined that the video acquisition device is in a stationary state.
[0068] It can be understood that in the verification of this embodiment, taking the pan-tilt camera as an example, when the pan-tilt is stable and stationary, the ratio of foreground pixels to background pixels is usually less than 0.1. When the pan-tilt rotates, the ratio of foreground pixels to background pixels is usually greater than 0.1. Therefore, the embodiment of the present invention determines whether the video acquisition device is moving or stationary by the ratio of foreground pixels to background pixels in an image. In actual use, the first preset threshold is 0.1.
[0069] To facilitate understanding of the implementation process of the above process steps S302-1 to S302-6, please refer to Figure 5 , Figure 5 An example diagram of a scenario provided for the implementation of the present invention.
[0070] like Figure 5 As shown, assume that there are two target frame images, A and B, and one detection frame image C, where A, B, and C have the same size and all have 4 pixels as an example. The pixel positions in each image are shown in the figure, and each pixel position corresponds to a pixel value (the pixel values are omitted in this figure).
[0071] First, assume that the target pixel position is (1,1). According to the Gaussian distribution of the pixel values of A(1,1) and B(1,1), assuming that three Gaussian models are constructed, the Gaussian models corresponding to the pixel position (1,1) are: F1, F2, F3, and so on. After traversing each target pixel position, that is, (1,2), (2,1), and (2,2), three Gaussian models corresponding to each target pixel position can be constructed.
[0072] Then, for the detection frame image C, the pixel value at each target pixel position can be matched with F1, F2, and F3 corresponding to the target pixel position in sequence until each pixel position is matched, and then the binary image corresponding to C can be obtained. For example, the pixel value at C (1, 1) is matched with F1, F2, and F3 corresponding to (1, 1), and so on, to obtain the matching results for each pixel position, and the binary image corresponding to C is obtained based on the matching results.
[0073] Finally, for the obtained binary image, assuming that (1,1) corresponds to the foreground pixel, (1,2), (2,1), and (2,2) correspond to the background pixel, then the ratio between the number of foreground pixels and the number of background pixels is 1 / 3. If it is greater than 0.1, it is determined that the video acquisition device is in motion.
[0074] Through the above implementation process, the shooting status of the video acquisition device can be identified, and then different processes subsequent to step S302 can be executed according to the identification results. The entire process only needs to use the obtained multiple frames of images for identification, and can quickly and accurately identify the shooting status, thereby ensuring the accuracy of subsequent detection results.
[0075] Optionally, as can be seen from the above content, during the matching process, it is necessary to generate a final binary image based on the matching results, and then determine whether the video acquisition device is moving or stationary based on the ratio of foreground pixels to background pixels in the image. The following is a possible implementation method for how to perform matching, please refer to Figure 6 , Figure 6 This is a schematic flowchart of an implementation of step S302-4 provided in an embodiment of the present invention, where step S302 may include:
[0076] S302-4-1, input the pixel values at the target pixel position in the detection image into multiple Gaussian models corresponding to the target pixel values in sequence, and output the matching results corresponding to each Gaussian model.
[0077] S302-4-2, if there is a matching result, and the difference between the means of the Gaussian models corresponding to the matching result is less than a second threshold, then the pixel value at the target pixel position in the detection image is updated to a second pixel value.
[0078] S302-4-3, if the difference between each matching result and the mean of the Gaussian model corresponding to the matching result is greater than the second threshold, the pixel value at the target pixel position in the detection image is updated to the first pixel value.
[0079] In this embodiment, the second threshold is the basis for judging whether the pixel value fluctuation at the target pixel position is large. It can be considered that if the difference between the means of the Gaussian models corresponding to the matching results is less than the second threshold, it indicates that the pixel value at the target pixel position changes little, and it can be further considered that the background at the target pixel position has not changed, which indirectly reflects that the video acquisition device has not moved and is in a static state; on the contrary, if the difference is greater than or equal to the second threshold, it indicates that the pixel value at the target pixel position changes greatly, and it can be considered that the background at the target pixel position changes greatly, which indirectly reflects that the video acquisition device is moving.
[0080] S302-4-4, obtaining a binary image based on the updated detection image.
[0081] For example, see Figure 5 , assuming that the pixel value of the target pixel position C(1,1) is X, the corresponding means of F1, F2 and F3 are σ1 , σ2 and σ3 , the second threshold is 2.5.
[0082] Input X into F1, F2 and F3, and record the output matching results as F1(X), F2(X) and F3(X), respectively calculate F1(X) and σ1 、F2(X) and σ2 and F3(X) and σ3 The difference between .
[0083] If one of the differences is less than 2.5, it means that the pixel value at the pixel position (1,1) has not fluctuated much, and the object corresponding to the pixel position has not changed. This indirectly reflects that the video acquisition device has not moved and is in a static state. In this case, the pixel value at the pixel position (1,1) is updated to 0.
[0084] If all the differences are greater than 2.5, it means that the pixel value at the pixel position (1,1) fluctuates greatly, which indirectly reflects that the video acquisition device is moving and in motion. In this way, the pixel value at the pixel position (1,1) is updated to 255. Similarly, after updating the pixel value of each pixel position in C, the corresponding binary image is obtained.
[0085] Combined with the actual situation, the fluctuation of the pixel value of the target pixel position can be used to indirectly reflect whether the video acquisition device is moving, and the recognition result has certain reference significance and accuracy.
[0086] Optionally, as can be seen from the above step S302-4-3, it may happen that all the differences are greater than the second threshold. This indicates that some Gaussian models corresponding to the current pixel position are no longer suitable for the subsequent detection process. Therefore, in this case, the Gaussian model with large fluctuations can be updated based on the obtained difference to ensure the accuracy of the subsequent matching results. Therefore, a possible implementation method for updating the Gaussian model is also given below, namely:
[0087] According to the maximum difference among all the differences, the Gaussian model corresponding to the maximum difference is updated.
[0088] It is understandable that in the process of updating the Gaussian model, the maximum difference and the existing machine learning method can be combined to re-learn the Gaussian model corresponding to the pixel position. In this way, in the subsequent pixel position matching process, the updated Gaussian model can be used for matching, thereby ensuring the accuracy of the matching results.
[0089] Optionally, the above describes how to identify the shooting state of the video acquisition device. Only when the shooting state is in a stationary state can target detection and tracking, as well as road detection, be performed. In this way, the type of traffic event corresponding to the target can be determined more comprehensively and accurately by combining the results of target detection and tracking with the results of road detection. Therefore, the following describes how to determine the type of traffic event. Figure 7 , Figure 7 A schematic flowchart of an implementation of step 303 provided in an embodiment of the present invention includes:
[0090] S303-1, perform target detection and tracking on the frame image to obtain the target position.
[0091] S303-2: Perform road detection on the frame image to obtain road information appearing in the frame image.
[0092] S303-3, determining the type of traffic event corresponding to the target based on the location and road information.
[0093] For steps S303-1 and 303-2, the target can be a pedestrian, motor vehicle, non-motor vehicle, etc. in the current image. The target detection and tracking model and road perception model can be obtained through any existing deep learning method. In this way, the target's location information and road information can be obtained quickly and accurately, thereby ensuring the accuracy of the detection results of subsequent traffic events.
[0094] The road information may include, but is not limited to: traffic markings, such as lane markings, guide lines, zebra crossings, etc.; road types, such as emergency lanes, sidewalks, motor vehicle lanes, etc.
[0095] The following provides several implementation methods for determining the type of traffic event based on different road information and step 303-3:
[0096] In a possible implementation, it may be determined whether the target occupies a predefined prohibited road, and the implementation process of step 303 may be as follows:
[0097] Determine the type of road where the target is located based on the road information.
[0098] Determine whether the type of the road is a prohibited road type and whether the location information coincides with the location area of the road.
[0099] If so, it is determined that the target corresponds to an abnormal traffic type.
[0100] For example, assuming that the road type prohibited from occupation is the emergency lane, when the position of the target coincides with the position area of the emergency lane, it can be determined that the target is experiencing an abnormal traffic incident.
[0101] In another embodiment, it is also possible to determine whether the target crosses a predefined prohibited-crossing road line, and the implementation process of step 303 can also be as follows:
[0102] Obtaining, based on the location, a first road and a second road where the target is located, wherein a difference between a time when the target is on the first road and a time when the target is on the second road is within a preset time period;
[0103] A road line type between a first road and a second road is obtained according to the road information.
[0104] If the road line type is a prohibited-crossing road line type, it is determined that the target corresponds to an abnormal traffic type.
[0105] For example, assuming that the prohibited road line type is a solid line, and the difference between the time the target is on the first road and the time on the second road is within the preset time length, it indicates that the target has changed lanes within the preset time length and crossed the solid line, then it can be determined that the target is experiencing an abnormal traffic incident.
[0106] In another embodiment, it is also possible to determine whether the target is driving on a line, and the implementation process of step 303 can also be as follows:
[0107] According to the road information, the positions of the detected road lines and traffic sign lines are obtained.
[0108] Determine whether the target's position coincides with the road line position and the traffic sign line position.
[0109] If they coincide, the abnormal traffic type corresponding to the target is determined.
[0110] Through the above detection process, embodiments of the present invention can automatically obtain road information, such as lane type, lane markings, traffic markings, etc. Based on this information, combined with information about pedestrians, motor vehicles, and non-motor vehicles, relevant events can be detected, thereby improving the detection rate and accuracy of abnormal traffic events.
[0111] In order to implement the various steps in the above embodiments to achieve the corresponding technical effects, the traffic incident detection method provided by the embodiment of the present invention can be executed in a hardware device or in the form of a software module. When the traffic incident detection method is implemented in the form of a software module, the embodiment of the present invention also provides a traffic incident detection device, see Figure 8 , Figure 8 This is a functional module diagram of a traffic incident detection device provided by an embodiment of the present invention. The traffic incident detection device 400 may include:
[0112] An acquisition module 410 is configured to acquire multiple frame images, where the multiple frame images are from the same video acquisition device;
[0113] An identification module 420 is configured to identify, based on the plurality of frame images, whether the shooting state of the video acquisition device is a stationary state or a moving state;
[0114] a detection module 430 configured to perform target detection and tracking, as well as road detection, on the frame image if the shooting state is a stationary state, and determine a traffic event type corresponding to a target appearing in the frame image;
[0115] The recognition module 420 is also used to obtain a new frame image to determine the shooting state if the shooting state is a moving state, until the shooting state is determined to be the static state. The detection module 430 is also used to perform target detection and tracking, as well as road detection on the new frame image, to determine the type of traffic event corresponding to the target appearing in the new frame image.
[0116] It is understandable that the acquisition module 410, the identification module 420 and the detection module 430 can be executed in a coordinated manner. Figure 3 to achieve the corresponding technical effects.
[0117] In some possible implementations, the identification module 420 may be used to perform Figure 4 、 Figure 6 Each step in the process is performed to achieve the corresponding technical effects.
[0118] In some possible implementations, the detection module 430 may be used to perform Figure 7 The steps in Figure 7 Various implementation processes corresponding to step S303 are performed to achieve corresponding technical effects.
[0119] In some possible implementations, the traffic event detection device 400 may further include a pre-processing module configured to perform scaling processing on the plurality of frame images to obtain the plurality of frame images of a preset size.
[0120] In some possible implementations, the traffic event detection device 400 may further include an updating module configured to update the Gaussian model corresponding to the maximum difference value according to the maximum difference value among all the differences values.
[0121] It should be noted that the various functional modules in the traffic event detection device 400 of the embodiment of the present invention can be stored in the memory in the form of software or firmware or fixed in the operating system (OS) of the electronic device, and can be executed by the processor of the electronic device. At the same time, the data and program code required to execute the above modules can also be stored in the memory.
[0122] Therefore, an embodiment of the present invention further provides an electronic device, which can be Figure 1 The server 20 shown, or other electronic devices with data processing functions, is not limited in the present invention.
[0123] like Figure 9 , Figure 9 A block diagram of an electronic device provided in an embodiment of the present invention. The electronic device 50 includes a communication interface 501, a processor 502 and a memory 503. The processor 502, the memory 503 and the communication interface 501 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines. The memory 503 can be used to store software programs and modules, such as program instructions / modules corresponding to the traffic event detection method provided in an embodiment of the present invention. The processor 502 executes various functional applications and data processing by executing the software programs and modules stored in the memory 503. The communication interface 501 can be used to communicate signaling or data with other node devices. In the present invention, the electronic device 50 can have multiple communication interfaces 501.
[0124] Among them, the memory 503 can be, but is not limited to, random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0125] The processor 502 may be an integrated circuit chip with signal processing capabilities. The processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0126] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the traffic incident detection method described in any of the aforementioned embodiments. The computer-readable storage medium may be, but is not limited to, a USB flash drive, a mobile hard drive, ROM, RAM, PROM, EPROM, EEPROM, a magnetic disk, or an optical disk, among other media capable of storing program code.
[0127] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A traffic incident detection method, characterized in that: The method comprises: Acquire multiple frame images, where the multiple frame images come from the same video acquisition device; According to the multiple frame images, identifying whether the shooting state of the video acquisition device when shooting the multiple frame images is a static state or a moving state includes the following steps: according to the time sequence of the multiple frame images, selecting multiple continuous target frame images, and determining the frame images other than the target frame images as detection images; according to the pixel values of the same target pixel position in all the target frame images, constructing multiple Gaussian models for the target pixel position; the target pixel position is any position in the target frame image; traversing all the target frame images, obtaining multiple Gaussian models corresponding to each target pixel position; matching the pixel values at the target pixel position in the detection image with the multiple Gaussian models corresponding to the target pixel position, and obtaining a binary image corresponding to the detection image, wherein the binary image includes foreground pixel points and background pixel points, the foreground pixel points have a first pixel value, and the background pixel points have a second pixel value, specifically, the pixel values at the target pixel position in the detection image are matched with the multiple Gaussian models corresponding to the target pixel position, and obtaining a binary image corresponding to the detection image, wherein the binary image includes foreground pixel points and background pixel points, the foreground pixel points have a first pixel value, and the background pixel points have a second pixel value, The pixel values at the target pixel position are sequentially input into a plurality of Gaussian models corresponding to the target pixel position, and a matching result corresponding to each Gaussian model is output; if there is a matching result and the difference between the mean of the Gaussian model corresponding to the matching result is less than a second threshold, the pixel value at the target pixel position in the detection image is updated to the second pixel value; if the difference between each matching result and the mean of the Gaussian model corresponding to the matching result is greater than the second threshold, the pixel value at the target pixel position in the detection image is updated to the first pixel value; based on the updated detection image, the binary image is obtained; when the ratio between the number of foreground pixels and the number of background pixels is greater than or equal to a first threshold, it is determined that the video acquisition device is in motion; when the ratio between the number of foreground pixels and the number of background pixels is less than the first threshold, it is determined that the video acquisition device is in a stationary state; If the shooting state is a stationary state, performing target detection and tracking as well as road detection on the frame image to determine the type of traffic event corresponding to the target appearing in the frame image; If the shooting state is a moving state, a new frame image is obtained to determine the shooting state. After the shooting state is determined to be the stationary state, target detection and tracking as well as road detection are performed on the new frame image to determine the type of traffic event corresponding to the target appearing in the new frame image.
2. The traffic incident detection method according to claim 1, characterized in that: After updating the pixel value at the target pixel position in the detection image to the first pixel value, the method further includes: According to the maximum difference among all the differences, the Gaussian model corresponding to the maximum difference is updated.
3. The traffic incident detection method according to claim 1, wherein: After acquiring multiple frame images, it also includes: Scaling is performed on the plurality of frame images to obtain the plurality of frame images of a preset size.
4. The traffic incident detection method according to claim 1, wherein: If the shooting state is a stationary state, target detection and tracking, as well as road detection, are performed on the frame image to determine the type of traffic event corresponding to the target appearing in the frame image, including: Performing target detection and tracking on the frame image to obtain the position of the target; Performing road detection on the frame image to obtain road information appearing in the frame image; Determine the type of traffic event corresponding to the target according to the position and the road information.
5. The traffic incident detection method according to claim 4, characterized in that: Determining a traffic event type corresponding to the target based on the target's location and the road information includes: Determining the type of the road where the target is located according to the road information; Determine whether the type of the road is a prohibited road type and whether the location coincides with the location area of the road; If so, it is determined that the target corresponds to an abnormal traffic type.
6. The traffic incident detection method according to claim 4, characterized in that: Determining a traffic event type corresponding to the target based on the target's location and the road information includes: Obtaining a first road and a second road where the target is located based on the location, wherein a difference between a time the target is on the first road and a time the target is on the second road is within a preset time period; Obtaining, according to the road information, a road line type between the first road and the second road; If the road line type is a road line type that is prohibited from crossing, it is determined that the target corresponds to an abnormal traffic type.
7. The traffic incident detection method according to claim 4, characterized in that: The location of the target and the road information, and determining the type of traffic event corresponding to the target, include: Obtaining the detected road line position and traffic sign line position according to the road information; Determining whether the position of the target coincides with the position of the road line and the position of the traffic sign line; If they coincide, the abnormal traffic type corresponding to the target is determined.
8. A traffic incident detection device, characterized in that: include: An acquisition module is used to acquire multiple frame images, where the multiple frame images come from the same video acquisition device; The identification module is used to identify whether the shooting state of the video acquisition device is a static state or a moving state based on the multiple frame images, comprising the following steps: selecting multiple continuous target frame images according to the time sequence of the multiple frame images, and determining the frame images other than the target frame images as detection images; constructing multiple Gaussian models for the same target pixel position based on the pixel values of the target pixel position in all the target frame images; the target pixel position is any position in the target frame image; traversing all the target frame images to obtain multiple Gaussian models corresponding to each target pixel position; Matching the pixel value at the target pixel position in the detection image with multiple Gaussian models corresponding to the target pixel position to obtain a binary image corresponding to the detection image; the binary image includes foreground pixels and background pixels; the foreground pixels have a first pixel value; The background pixel point has a second pixel value specifically by inputting the pixel value at the target pixel position in the detection image into multiple Gaussian models corresponding to the target pixel position in sequence, and outputting the matching result corresponding to each Gaussian model; if there is a matching result, and the difference between the mean value of the Gaussian model corresponding to the matching result is less than a second threshold, then the pixel value at the target pixel position in the detection image is updated to the second pixel value; if the difference between each matching result and the mean value of the Gaussian model corresponding to the matching result is greater than the second threshold, then the pixel value at the target pixel position in the detection image is updated to the first pixel value; Obtaining the binary image based on the updated detection image; determining that the video acquisition device is in motion when the ratio between the number of foreground pixels and the number of background pixels is greater than or equal to a first threshold; and determining that the video acquisition device is stationary when the ratio between the number of foreground pixels and the number of background pixels is less than the first threshold; a detection module, configured to perform target detection and tracking, as well as road detection, on the frame image if the shooting state is a stationary state, and determine a traffic event type corresponding to a target appearing in the frame image; The recognition module is also used to obtain a new frame image to determine the shooting state if the shooting state is a moving state, until the shooting state is determined to be the stationary state. The detection module is also used to perform target detection and tracking, as well as road detection on the new frame image, to determine the type of traffic event corresponding to the target appearing in the new frame image.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program that can be executed by the processor, and the processor can execute the computer program to implement the traffic event detection method according to any one of claims 1 to 7.
10. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the traffic incident detection method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Camera motion detecting method based on video monitoring
CN103150736A
Method for conducting real-time image recognition on mobile terminal and mobile terminal
CN104144345A
Traffic violation analysis method and device based on deep learning
CN110717433A