A method, medium and device for detecting a traffic accident based on a video

By segmenting and classifying video images through multi-level detection, the problems of misjudgment and missed judgment in traffic accident detection in existing technologies have been solved, achieving higher detection accuracy and reliability.

CN120580653BActive Publication Date: 2026-07-14ZHEJIANG MEIRI HUDONG NETWORK TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG MEIRI HUDONG NETWORK TECH CO LTD
Filing Date
2025-05-23
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

In existing technologies, video-based methods for detecting traffic accidents suffer from high rates of false positives and false negatives, resulting in poor detection reliability and making it difficult to support more intelligent traffic accident monitoring.

Method used

By segmenting the target video, multiple sub-images to be detected are obtained. Then, using a trained traffic accident detection model and classification model, the sub-images are detected and classified to generate traffic accident warning information.

Benefits of technology

It has improved the comprehensiveness and accuracy of traffic accident detection, effectively reduced the rate of misjudgment and missed judgment, and enhanced the reliability of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120580653B_ABST
    Figure CN120580653B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of intelligent transportation, in particular to a method, medium and equipment for detecting a traffic accident based on a video, wherein the to-be-detected image is divided into a plurality of to-be-detected sub-images, and then the to-be-detected sub-images are detected by a traffic accident detection model, so that the missed detection caused by the small area of the accident area in the to-be-detected image can be avoided, the comprehensiveness of the traffic accident detection is improved, and after the first detection result output by the traffic accident detection model is acquired, a plurality of to-be-confirmed images are acquired by cutting and cropping the to-be-detected sub-images, the to-be-confirmed images are detected in a classified manner, the first detection result can be further verified, and the accuracy and reliability of the traffic accident detection are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent transportation technology, and in particular to a method, medium, and device for detecting traffic accidents based on video. Background Technology

[0002] With the increasing complexity of urban traffic, the development of intelligent transportation systems (ITS) has become crucial for alleviating traffic congestion and improving traffic safety. ITS involves utilizing various technologies to improve traffic management and operation, and video-based accident detection is a vital component. Video data can be acquired by surveillance cameras installed at key road locations (such as intersections and highways), and then algorithms can be used to analyze this video data to quickly and accurately detect traffic accidents. For example, in urban traffic management centers, this technology can be used to monitor traffic conditions in real time, eliminating the need for extensive manual monitoring. Once an accident is detected, timely accident-related dispatching can be implemented, thereby reducing the impact of the accident on traffic.

[0003] In existing technologies, video-based traffic accident detection can usually be achieved through object detection models, which can effectively mark the bounding box information of the accident area in the image, making it convenient for managers to perform manual verification. However, due to the complexity and diversity of traffic accidents, the accuracy of detection models is often difficult to guarantee, and the false positive and false negative rates of the detection model output results are high, resulting in poor reliability of traffic accident detection and difficulty in effectively supporting more intelligent traffic accident monitoring.

[0004] Therefore, improving the reliability of traffic accident detection has become an urgent problem to be solved. Summary of the Invention

[0005] To address the aforementioned technical problems, the present invention provides a method for detecting traffic accidents based on video, which includes:

[0006] S101, acquire the target video, and determine the image to be detected from the target video.

[0007] S102, perform segmentation processing on the image to be detected to obtain M sub-images to be detected, where M is a positive integer.

[0008] S103, For any sub-image to be detected, input the sub-image to be detected into the trained traffic accident detection model to obtain the first detection result, wherein the first detection result includes N bounding box information.

[0009] S104, based on the N bounding box information, crop out N images to be confirmed from the sub-image to be detected.

[0010] S105: For any image to be confirmed, input the image to be confirmed into the trained traffic accident classification model to obtain the second detection result.

[0011] S106. When the second detection result meets the preset conditions, a traffic accident warning message is generated.

[0012] The present invention also provides a device for detecting traffic accidents based on video, the device comprising:

[0013] The present invention also provides a non-transitory computer-readable storage medium storing at least one instruction or at least one program, wherein the at least one instruction or at least one program is loaded and executed by a processor to implement the above-described method for detecting traffic accidents based on video.

[0014] The present invention also provides an electronic device, including a processor and the aforementioned non-transitory computer-readable storage medium.

[0015] Compared with the prior art, the present invention has significant advantages. Through the above technical solution, the method for detecting traffic accidents based on video provided by the present invention achieves considerable technological progress and practicality, and has broad industrial application value. It has at least the following advantages:

[0016] By acquiring a target video, identifying the image to be detected from the target video, segmenting the image to be detected to obtain M sub-images to be detected (M is a positive integer), and inputting any sub-image to be detected into a trained traffic accident detection model to obtain a first detection result, then cropping N images to be confirmed from the sub-image to be detected based on N bounding box information, and inputting any image to be confirmed into a trained traffic accident classification model to obtain a second detection result, and generating traffic accident warning information when the second detection result meets preset conditions, it can be seen that by segmenting the image to be detected into multiple sub-images and then detecting the sub-images to be detected through the traffic accident detection model, missed detections due to the small area occupied by the accident area in the image to be detected can be avoided, thus improving the comprehensiveness of traffic accident detection. Moreover, after obtaining the first detection result output by the traffic accident detection model, cropping multiple images to be confirmed from the sub-image to be detected and detecting the images to be confirmed through classification can further verify the first detection result, effectively improving the accuracy and reliability of traffic accident detection. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating a method for detecting traffic accidents based on video, as provided in Embodiment 1 of the present invention. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] Example 1

[0021] This embodiment provides a method for detecting traffic accidents based on video. See [link to previous document]. Figure 1 The above is a flowchart illustrating a method for detecting traffic accidents based on video, as provided in an embodiment of the present invention, including:

[0022] S101, acquire the target video, and determine the image to be detected from the target video.

[0023] S102, perform segmentation processing on the image to be detected to obtain M sub-images to be detected, where M is a positive integer.

[0024] S103, for any sub-image to be detected, input the current sub-image to be detected into the trained traffic accident detection model to obtain the first detection result, wherein the first detection result includes N bounding box information.

[0025] S104, based on the N bounding box information, crop out N images to be confirmed from the sub-image to be detected.

[0026] S105: For any image to be confirmed, input the current image to be confirmed into the trained traffic accident classification model to obtain the second detection result.

[0027] S106. When the second detection result meets the preset conditions, a traffic accident warning message is generated.

[0028] The target video can refer to traffic video captured by cameras deployed in traffic areas. The target video can contain multiple frames of images, and the image to be detected can refer to the image that needs to be detected for traffic accidents.

[0029] The sub-image to be detected can refer to the image input into the trained traffic accident detection model. Typically, the trained traffic accident detection model has a limitation on the size of the input image. Segmenting the image to be detected into M sub-images can ensure that the size of each sub-image meets the size requirement of the input image.

[0030] The traffic accident detection model can be a target detection model, which can adopt YOLO model, RCNN model, etc. In this embodiment, the traffic accident detection model adopts YOLO model.

[0031] The bounding box information may include the x-coordinate and y-coordinate of the center point of the bounding box, as well as the length and width of the bounding box.

[0032] The image to be confirmed can refer to the image that needs to be input into the trained traffic accident classification model for classification and detection, and the second detection result can refer to the classification result corresponding to the image to be confirmed.

[0033] Traffic accident warning information can be used to help managers confirm the information and then conduct accident-related dispatching.

[0034] Specifically, since the sizes of images captured by different cameras vary, this embodiment first standardizes the size of the captured images by scaling. For example, the shorter side of the captured image is standardized to a preset value, and then the longer side is scaled according to the ratio of the image length to width. It should be noted that the preset value set in this embodiment is greater than the side length of the sub-image to be detected, thereby improving the efficiency of image segmentation and avoiding excessive loss of image information caused by scaling. In this embodiment, the length and width of the sub-image to be detected are the same. As an example, the side length of the sub-image to be detected can be 512 pixels, and the preset value can be 800 pixels. The implementer can adjust the side length of the sub-image to be detected and the preset value according to the needs of the actual traffic accident detection model and the actual situation.

[0035] In this embodiment, the bounding box in the traffic accident detection model has only two categories: accident category and normal category. Therefore, the bounding box information does not need to include the bounding box category. By default, the bounding box category corresponding to the bounding box information in the first detection result is the accident category.

[0036] In one specific implementation, S101 includes the following steps:

[0037] The target video is acquired, and the image to be detected is obtained by sampling from the target video according to a preset sampling time interval.

[0038] Since multiple frames of images are typically captured per second during camera capture, processing all of these images would require significant computing resources. Considering that the occurrence and resolution of a traffic accident is not a short process, this embodiment samples the image to be detected from the target video according to a preset sampling time interval, which can be two seconds.

[0039] In one specific implementation, S102 includes the following steps:

[0040] S1021, Obtain the length information L and width information W of the image to be detected.

[0041] S1022, Based on L and the preset length P of the sub-image to be detected, determine the first segmentation number A and A first starting segmentation positions.

[0042] S1023, based on W and the preset width Q of the sub-image to be detected, determine the second segmentation number B and B second starting segmentation positions.

[0043] S1024. Based on A first starting segmentation positions and B second starting segmentation positions, determine A×B starting segmentation coordinates, where A×B=M.

[0044] S1025, based on A×B initial segmentation coordinates, segment A×B sub-images to be detected from the image to be detected.

[0045] In image segmentation, the horizontal and vertical axes can be processed separately. The number of sub-images to be detected on the horizontal axis and the first starting segmentation position of each sub-image to be detected, i.e., the horizontal coordinate of the upper left corner of each sub-image to be detected, can be determined based on the length information L of the image to be detected and the preset length P of the sub-image to be detected.

[0046] Similarly, the number of sub-images to be detected on the vertical axis and the second starting segmentation position of each sub-image to be detected, i.e., the vertical coordinate of the upper left corner of each sub-image to be detected, can be determined based on the width information W of the image to be detected and the preset width Q of the sub-image to be detected.

[0047] Specifically, based on A first starting segmentation positions and B second starting segmentation positions, A×B starting segmentation coordinates can obviously be obtained by combining them. Then, based on the A×B starting segmentation coordinates, the preset length P of the sub-image to be detected, and the width Q of the sub-image to be detected, A×B sub-images to be detected are determined.

[0048] In one specific implementation, the first segmentation number A and A first starting segmentation positions are determined based on L and a preset length P of the sub-image to be detected, including:

[0049] Determine the first number of segments A = f(L / P), where f() is the floor function.

[0050] Determine the first offset step size C = A - (A × PL) / (A - 1).

[0051] Based on the initial segmentation position D and the first offset step size, the first starting segmentation position D+a×C is obtained, where a is an integer in the range [0, A-1].

[0052] In this embodiment, the initial segmentation position D can be 0, and the A first starting segmentation positions can include 0, C, 2C, ..., (A-1)×C.

[0053] In one specific implementation, S1023 includes the following steps:

[0054] Determine the second segmentation quantity B = f(W / Q), where f() is the floor function.

[0055] Determine the second offset step size E = B - (B × QW) / (B - 1).

[0056] Based on the initial segmentation position F and the second offset step, the second starting segmentation position F+b×E is obtained, where b is an integer in the range [0, B-1].

[0057] In this embodiment, the initial segmentation position F can be 0, and the B second starting segmentation positions can include 0, E, 2E, ..., (B-1)×E.

[0058] In one specific implementation, S103 includes the following steps:

[0059] For any sub-image to be detected, input the sub-image to be detected into the trained traffic accident detection model to obtain the accident prediction probabilities corresponding to the R initial bounding boxes in the sub-image to be detected, where R is a positive integer.

[0060] The first detection result is formed from the bounding box information of the initial bounding boxes for all accidents whose predicted probability is greater than a preset first probability threshold.

[0061] In the target detection model, the output prediction results usually include the location information and confidence level of the bounding box. In this embodiment, the confidence level is also the accident prediction probability. By setting a first probability threshold, the initial bounding boxes with low accident prediction probabilities can be filtered out, thereby reducing the number of bounding boxes that need to be detected secondary by the traffic accident classification model, and thus improving the overall efficiency of traffic accident detection.

[0062] In one specific implementation, S103 further includes the following steps:

[0063] For any initial bounding box whose predicted probability of an accident is no greater than a first probability threshold and greater than a preset second probability threshold, determine the image coordinates of the center point of the current initial bounding box in the image to be detected.

[0064] According to the preset mapping function, the area of ​​the current initial bounding box is mapped to the search radius. The mapping function contains the mapping relationship between the area of ​​the initial bounding box and the search radius.

[0065] Based on the image coordinates and the search radius, determine the search domain of the current initial bounding box in the image to be detected.

[0066] If the search domain contains the image coordinates of an initial bounding box whose predicted probability of other accidents is greater than the second probability threshold, then the current initial bounding box is determined as the reference bounding box.

[0067] Accordingly, the first detection result is formed from the bounding box information of all initial bounding boxes whose predicted accident probability is greater than a preset first probability threshold, including:

[0068] The first detection result is formed by the bounding box information of the initial bounding boxes where the predicted probability of all accidents is greater than the preset first probability threshold and the bounding box information of all reference bounding boxes.

[0069] In this case, the segmentation of the sub-image to be detected may result in the traffic accident area being divided into different sub-images to be detected. Since the traffic accident area contained in a single sub-image to be detected is not complete, the accident prediction probability of the initial bounding box detected in the sub-image to be detected may not be as high as expected. In order to avoid such a situation, this embodiment re-judges the initial bounding box with an accident prediction probability not greater than the first probability threshold and greater than the preset second probability threshold by searching, so as to avoid the situation of missed detection.

[0070] Specifically, the mapping function can compare the area of ​​the initial bounding box with the area of ​​the preset base bounding box to obtain the area ratio, and then multiply the area ratio by the preset radius to obtain the search radius.

[0071] Based on the image coordinates and search radius, the search domain of the initial bounding box in the image to be detected is obtained. At this point, it is only necessary to detect whether there are other initial bounding boxes in the search domain with an accident prediction probability greater than the second probability threshold. If so, it can be considered that the traffic accident area has been divided into different sub-images to be detected, and the initial bounding box can still be detected a second time.

[0072] In one specific implementation, the second detection result includes an accident type and a normal type, and S106 includes the following steps:

[0073] When the second detection result is an accident type, a traffic accident warning message is generated.

[0074] The traffic accident classification model can be a binary classification model. Since the cost of sample labeling and training of the classification model is lower than that of the detection model, this embodiment can improve the accuracy of traffic accident detection simply by continuously iterating the classification model, thus improving the practicality of traffic accident detection based on the neural network model.

[0075] As can be seen, this embodiment, by segmenting the image to be detected into multiple sub-images and then using a traffic accident detection model to detect these sub-images, can avoid missed detections due to the small area occupied by the accident region in the image to be detected, thus improving the comprehensiveness of traffic accident detection. Moreover, after obtaining the first detection result output by the traffic accident detection model, multiple images to be confirmed are cropped from the sub-images to be detected, and these images to be confirmed are detected by classification, which can further verify the first detection result and effectively improve the accuracy and reliability of traffic accident detection.

[0076] Example 2

[0077] This second embodiment provides a device for detecting traffic accidents based on video. The device for detecting traffic accidents based on video includes:

[0078] The data acquisition module is used to acquire the target video and determine the image to be detected from the target video.

[0079] The image segmentation module is used to segment the image to be detected, obtaining M sub-images to be detected, where M is a positive integer.

[0080] The image detection module is used to input the current sub-image to be detected into the trained traffic accident detection model for any sub-image to be detected, and obtain the first detection result, wherein the first detection result includes N bounding box information.

[0081] The image cropping module is used to crop out N images to be confirmed from the sub-image to be detected based on N bounding box information.

[0082] The image classification module is used to input the current image to be confirmed into the trained traffic accident classification model to obtain a second detection result for any image to be confirmed.

[0083] The information generation module is used to generate traffic accident warning information when the second detection result meets the preset conditions.

[0084] In one specific implementation, the data acquisition module includes:

[0085] The image sampling submodule is used to acquire the target video and sample the image to be detected from the target video according to a preset sampling time interval.

[0086] In one specific embodiment, the image segmentation module includes:

[0087] The image information acquisition submodule is used to acquire the length information L and width information W of the image to be detected.

[0088] The first segmentation information acquisition submodule is used to determine the first segmentation number A and A first starting segmentation positions based on L and the preset length P of the sub-image to be detected.

[0089] The second segmentation information acquisition submodule is used to determine the second segmentation quantity B and the B second starting segmentation positions based on W and the preset width Q of the sub-image to be detected.

[0090] The segmentation coordinate acquisition submodule is used to determine A×B initial segmentation coordinates based on A first initial segmentation positions and B second initial segmentation positions, where A×B=M.

[0091] The image segmentation submodule is used to segment A×B sub-images from the image to be detected based on A×B initial segmentation coordinates.

[0092] In one specific implementation, the first segmentation information acquisition submodule includes:

[0093] The first segmentation quantity acquisition submodule is used to determine the first segmentation quantity A = f(L / P), where f() is the floor function.

[0094] The first offset step size acquisition submodule is used to determine the first offset step size C = A - (A × PL) / (A - 1).

[0095] The first starting segmentation position determination submodule is used to obtain the first starting segmentation position D+a×C based on the initial segmentation position D and the first offset step size, where a is an integer in the range [0, A-1].

[0096] In one specific implementation, the second segmentation information acquisition submodule includes:

[0097] The second segmentation quantity acquisition submodule is used to determine the second segmentation quantity B = f(W / Q), where f() is the floor function.

[0098] The second offset step size acquisition submodule is used to determine the second offset step size E = B - (B × QW) / (B - 1).

[0099] The second starting segmentation position determination submodule is used to obtain the second starting segmentation position F+b×E based on the initial segmentation position F and the second offset step size, where b is an integer in the range [0, B-1].

[0100] In one specific embodiment, the image detection module includes:

[0101] The probability prediction submodule is used to input any sub-image to be detected into the trained traffic accident detection model to obtain the accident prediction probability corresponding to R initial bounding boxes in the sub-image to be detected, where R is a positive integer.

[0102] The first detection result acquisition submodule is used to form the first detection result from the bounding box information of the initial bounding boxes of all accident prediction probabilities greater than a preset first probability threshold.

[0103] In one specific embodiment, the image detection module further includes:

[0104] The image coordinate acquisition submodule is used to determine the image coordinates of the center point of the current initial bounding box in the image to be detected for any initial bounding box whose predicted probability of an accident is not greater than a first probability threshold and is greater than a preset second probability threshold.

[0105] The search radius acquisition submodule is used to map the area of ​​the current initial bounding box to the search radius according to a preset mapping function. The mapping function contains the mapping relationship between the area of ​​the initial bounding box and the search radius.

[0106] The search domain acquisition submodule is used to determine the search domain of the current initial bounding box in the image to be detected based on the image coordinates and the search radius.

[0107] The reference bounding box acquisition submodule is used to determine the current initial bounding box as the reference bounding box if the search domain contains the image coordinates corresponding to the initial bounding box whose prediction probability of other accidents is greater than the second probability threshold.

[0108] Accordingly, the first detection result acquisition submodule includes:

[0109] The first detection result acquisition unit is used to form the first detection result from the bounding box information of all initial bounding boxes whose predicted accident probability is greater than a preset first probability threshold and all reference bounding boxes.

[0110] In one specific implementation, the second detection result includes an accident type and a normal type, and the information generation module includes:

[0111] The information generation submodule is used to generate traffic accident warning information when the second detection result is an accident type.

[0112] It should be noted that the information interaction and execution process between the above modules are based on the same concept as the method embodiments of the present invention. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.

[0113] Example 3

[0114] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium, which stores at least one instruction or at least one program segment, wherein the at least one instruction or at least one program segment is loaded and executed by a processor to implement the following steps:

[0115] S101, acquire the target video, and determine the image to be detected from the target video.

[0116] S102, perform segmentation processing on the image to be detected to obtain M sub-images to be detected, where M is a positive integer.

[0117] S103, for any sub-image to be detected, input the current sub-image to be detected into the trained traffic accident detection model to obtain the first detection result, wherein the first detection result includes N bounding box information.

[0118] S104, based on the N bounding box information, crop out N images to be confirmed from the sub-image to be detected.

[0119] S105: For any image to be confirmed, input the current image to be confirmed into the trained traffic accident classification model to obtain the second detection result.

[0120] S106. When the second detection result meets the preset conditions, a traffic accident warning message is generated.

[0121] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the methods described above. Furthermore, any references to memory, storage, databases, or other media used in the embodiments provided in this application can include both non-volatile and volatile memory.

[0122] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0123] Example 4

[0124] Embodiment 4 of the present invention provides an electronic device, which includes a processor and a non-transitory computer-readable storage medium as described in Embodiment 3 of the present invention.

[0125] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A method for detecting traffic accidents based on video, characterized in that, The video-based method for detecting traffic accidents includes: S101, acquire the target video, and determine the image to be detected from the target video; S102, the image to be detected is segmented to obtain M sub-images to be detected, where M is a positive integer; S103, for any sub-image to be detected, input the current sub-image to be detected into the trained traffic accident detection model to obtain a first detection result, wherein the first detection result includes N bounding box information. S103 includes the following steps: For any sub-image to be detected, input the sub-image to be detected into the trained traffic accident detection model to obtain the accident prediction probabilities corresponding to the R initial bounding boxes in the sub-image to be detected, where R is a positive integer; For an initial bounding box whose predicted probability of any accident is not greater than a preset first probability threshold and is greater than a preset second probability threshold, determine the image coordinates of the center point of the current initial bounding box in the image to be detected. According to a preset mapping function, the area of ​​the current initial bounding box is mapped to the search radius, wherein the mapping function contains the mapping relationship between the area of ​​the initial bounding box and the search radius; Based on the image coordinates and the search radius, determine the search domain of the current initial bounding box in the image to be detected; If the search domain contains the image coordinates of an initial bounding box whose prediction probability of other accidents is greater than the second probability threshold, then the current initial bounding box is determined as a reference bounding box. The first detection result is formed by the bounding box information of all reference bounding boxes, where the predicted probability of all accidents is greater than a preset first probability threshold. S104, based on the N bounding box information, crop out N images to be confirmed from the sub-image to be detected; S105, For any image to be confirmed, input the current image to be confirmed into the trained traffic accident classification model to obtain the second detection result; S106, When the second detection result meets the preset conditions, a traffic accident warning message is generated.

2. The method for detecting traffic accidents based on video according to claim 1, characterized in that, S101 includes the following steps: The target video is acquired, and the image to be detected is obtained by sampling from the target video according to a preset sampling time interval.

3. The method for detecting traffic accidents based on video according to claim 1, characterized in that, S102 includes the following steps: S1021, Obtain the length information L and width information W of the image to be detected; S1022, Based on L and the preset length P of the sub-image to be detected, determine the first segmentation number A and A first starting segmentation positions; S1023, Based on W and the preset width Q of the sub-image to be detected, determine the second segmentation number B and B second starting segmentation positions; S1024, Based on A first starting segmentation positions and B second starting segmentation positions, determine A×B starting segmentation coordinates, where A×B=M; S1025, based on A×B initial segmentation coordinates, A×B sub-images to be detected are obtained from the image to be detected.

4. The method for detecting traffic accidents based on video according to claim 3, characterized in that, S1022 includes the following steps: Determine the number of the first segmentation A = f(L / P), where f() is the floor function; Determine the first offset step size C = A - (A × PL) / (A - 1); Based on the initial segmentation position D and the first offset step size, the first starting segmentation position D+a×C is obtained, where a is an integer in the range [0, A-1].

5. The method for detecting traffic accidents based on video according to claim 3, characterized in that, S1023 includes the following steps: Determine the second segmentation quantity B = f(W / Q), where f() is the floor function; Determine the second offset step size E = B - (B × QW) / (B - 1); Based on the initial segmentation position F and the second offset step size, the second starting segmentation position F+b×E is obtained, where b is an integer in the range [0, B-1].

6. The method for detecting traffic accidents based on video according to claim 1, characterized in that, The second detection result includes accident type and normal type, and S106 includes the following steps: When the second detection result is an accident type, a traffic accident warning message is generated.

7. A non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores at least one instruction or at least one program segment, characterized in that, The at least one instruction or the at least one program segment is loaded and executed by the processor to implement the video-based traffic accident detection method as described in any one of claims 1-6.

8. An electronic device, characterized in that, Includes a processor and the non-transitory computer-readable storage medium as described in claim 7.