Traffic accident detection data enhancement method, marking method, detection method and equipment

By constructing a roadside background image library and a traffic accident image library, random selection and fusion technology are used to generate traffic accident pictures, the problem of picture distortion in the existing technology is solved, and an efficient and diverse traffic accident detection model training data set is achieved, and the accuracy and stability of the model are improved.

CN120472264APending Publication Date: 2025-08-12TIANYI TRANSPORTATION TECH CO LTD

Patent Information

Application Number
CN202510565385.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

The traffic accident pictures generated in the prior art have problems such as distortion of the traffic accident subject and unreal background, which leads to insufficient training data of the traffic accident detection model, affecting the accuracy and application effect of the model.

Method used

Build a roadside background picture library and a traffic accident picture library, and randomly select background pictures and traffic accident subjects to fusion, generate pictures for traffic accident detection model training, use binarization processing and semantic segmentation models to extract traffic accident subjects, and combine image generation models and labeling technology to improve the authenticity and diversity of pictures.

Benefits of technology

Rapidly generate a large number of traffic accident pictures with realistic shapes and diverse backgrounds, which improves the quality and efficiency of model training data, reduces manual labeling costs, and enhances the generalization ability of the model in a diverse environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120472264A_ABST
    Figure CN120472264A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of traffic accident detection, and provides a traffic accident detection data enhancement method, a marking method, a detection method and equipment. The invention discloses a traffic accident detection data enhancement method. The method comprises the following steps: constructing a roadside background picture library and a traffic accident picture library; the traffic accident picture library comprises traffic accident subjects and second traffic accident subjects which are in one-to-one correspondence; randomly selecting a background from a roadside background picture library, and randomly selecting a first traffic accident subject and a corresponding second traffic accident subject from a traffic accident picture library; based on the randomly selected background and the first traffic accident subject, determining a fused traffic accident picture; and generating a first traffic accident picture based on the fused traffic accident picture and the second traffic accident subject. Through the scheme of the invention, a large number of traffic accident pictures which are vivid in form, diverse in background and accord with the actual driving scene of the vehicle can be quickly generated, and the generation quality and efficiency of the traffic accident pictures are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of traffic accident detection, and in particular to a traffic accident detection data enhancement method, a labeling method, a detection method and a device. Background Art

[0002] Data collection is a critical and complex step in traffic accident detection, presenting numerous challenges. Traffic accidents are random and infrequent, making the availability of real-world data very limited. Images of traffic accidents in unusual conditions, such as rainy, snowy weather, and at night, are particularly scarce. The difficulty in collecting traffic accident images also makes it difficult to obtain sufficient samples to train traffic accident detection models.

[0003] To address the issue of insufficient traffic data sample size for training traffic accident detection models, related technologies use a method called inputting prompt words into image generation models to generate a large number of traffic accident images. However, these images often suffer from distorted shapes of the accident subjects and unrealistic backgrounds. Summary of the Invention

[0004] In view of this, the present invention proposes a traffic accident detection data enhancement method, labeling method, detection method and equipment, which solves the problems of traffic accident subject morphology distortion and background unreality when generating traffic accident pictures for training traffic accident detection models through related technologies.

[0005] In one aspect, an embodiment of the present invention provides a method for enhancing traffic accident detection data, the method comprising: Constructing a roadside background image library and a traffic accident image library, wherein the traffic accident image library includes a first traffic accident subject and a second traffic accident subject obtained by binarizing the first traffic accident subject; Randomly select a background image from a roadside background image library, and randomly select a first traffic accident subject and a corresponding second traffic accident subject from a traffic accident image library; Determining a fused traffic accident picture based on the randomly selected background picture and the first traffic accident subject; Based on the fused traffic accident picture and the second traffic accident subject, a first traffic accident picture for training a traffic accident detection model is generated.

[0006] In some embodiments, building a traffic accident image library includes: Traffic accident pictures are collected, and target area pictures are cropped from the collected traffic accident pictures; a first traffic accident subject is extracted from the target area picture, and the first traffic accident subject is binarized to obtain a second traffic accident subject; a traffic accident picture library is constructed based on the first traffic accident subject and the corresponding second traffic accident subject.

[0007] In some embodiments, determining a fused traffic accident image based on the randomly selected background image and the first traffic accident subject includes: The first traffic accident subject is randomly flipped, and the flipped first traffic accident subject is placed on the background image based on preset conditions to obtain a fused traffic accident image.

[0008] In some embodiments, the traffic accident detection data enhancement method further includes: Determine a proportional coefficient of the flipped first traffic accident subject in the fused traffic accident image; Based on the scale coefficient, the labeling information of the first traffic accident subject in the fused traffic accident image is determined.

[0009] In some embodiments, the traffic accident detection data enhancement method further includes: A labeled traffic accident picture is obtained based on the labeled information and the first traffic accident picture.

[0010] In some embodiments, generating a first traffic accident image for training a traffic accident detection model based on the fused traffic accident image and the second traffic accident subject includes: Generate a first prompt word based on the fused traffic accident picture, and extract a line drawing of the fused traffic accident picture; A redrawing condition is generated based on the first prompt word, the line drawing of the fused traffic accident picture, and the second traffic accident subject, and a first traffic accident picture is generated through a picture generation model based on the redrawing condition.

[0011] In some embodiments, the traffic accident detection data enhancement method further includes: Based on the first prompt word and the preset basic description information, a second prompt word is generated, and based on the second prompt word, the fused line drawing of the traffic accident picture and the second traffic accident subject, a first traffic accident picture is generated.

[0012] On the other hand, an embodiment of the present invention further provides a method for labeling a traffic accident detection dataset, which includes generating a traffic accident training dataset with labeled information based on the traffic accident detection data enhancement method described in any of the above embodiments.

[0013] On the other hand, an embodiment of the present invention further provides a traffic accident detection method, which includes: Generating a plurality of traffic accident pictures for training a traffic accident detection model based on the traffic accident detection data enhancement method according to any one of claims 1 to 7; Based on a number of traffic accident images, a traffic accident detection model is trained to obtain a trained traffic accident detection model; The data collected by the roadside equipment is input into the trained traffic accident detection model to detect whether a traffic accident has occurred.

[0014] On the other hand, an embodiment of the present invention further provides an electronic device comprising: at least one processor; and a memory, the memory storing a computer program that can be run on the processor, characterized in that when the processor executes the program, the steps of the method of any of the above embodiments are performed.

[0015] The present invention has at least the following beneficial effects: The present invention provides a traffic accident detection data enhancement method, detection method, device, and equipment. The traffic accident detection data enhancement method disclosed in the present invention includes: constructing a roadside background image library and a traffic accident image library, wherein the traffic accident image library includes a first traffic accident subject and a second traffic accident subject obtained by binarizing the first traffic accident subject; randomly selecting a background image from the roadside background image library, and randomly selecting the first traffic accident subject and the corresponding second traffic accident subject from the traffic accident image library; determining a fused traffic accident image based on the randomly selected background image and the first traffic accident subject; and generating a first traffic accident image for training a traffic accident detection model based on the fused traffic accident image and the corresponding second traffic accident subject.

[0016] The solution of the present invention, when generating a traffic accident picture, can constrain the shape of the traffic subject through the second traffic accident subject, thereby making the shape of the traffic accident subject in the generated first traffic accident picture more realistic. In the solution of the present invention, the background images in the roadside background image library are derived from the real road traffic environment, and can also fully cover a variety of actual vehicle driving scenes such as daytime, nighttime, rain and snow. When the background image and the first traffic accident subject are merged, by selecting the background image from the roadside background image library, the background of the finally generated traffic accident picture can be real and consistent with the actual scene of the traffic accident, thereby improving the authenticity and diversity of the background of the generated traffic accident picture.

[0017] Through the solution of the present invention, a large number of traffic accident pictures with realistic morphology, diverse backgrounds and consistent with actual vehicle driving scenes can be quickly generated, thereby improving the generation quality and efficiency of traffic accident pictures used for traffic accident detection model training. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 A flow chart of a method for enhancing traffic accident detection data provided by an embodiment of the present invention; Figure 2 A flow chart of a method for enhancing traffic accident detection data provided by an embodiment of the present invention; Figure 3 A schematic diagram of a process for constructing a traffic accident database using the traffic accident detection data enhancement method provided by an embodiment of the present invention; Figure 4 A flow chart of a traffic accident detection method provided by an embodiment of the present invention; Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0020] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.

[0021] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. Subsequent embodiments will not explain this one by one.

[0022] Data collection is a critical and complex step in the traffic accident detection process, presenting numerous challenges. Due to the randomness and low frequency of traffic accidents, the availability of real-world scene data is extremely limited. This is particularly true for images of traffic accidents in unusual conditions, such as rainy, snowy, and nighttime conditions. Due to the difficulty in collecting traffic accident images, the effective sample size is insufficient to meet the scale required for training traffic accident detection models. Therefore, obtaining sufficient and diverse training data, especially images of traffic accidents in rare scenes, has become a key bottleneck in improving the performance of traffic accident detection models. To address the issue of real-world traffic accident images being insufficient for training traffic accident detection models, generative image synthesis methods have been widely used in recent years. Image generation techniques can artificially synthesize diverse traffic accident scenes, thereby addressing the shortcomings of real-world datasets.

[0023] In related technologies, one image generation method involves inputting prompt words into an image generation model, thereby generating a large number of traffic accident images to meet the needs of training traffic accident detection models. However, traffic accident images generated using this method suffer from the following issues: 1) The traffic accident elements in the generated images often lack physical plausibility, such as vehicle deformation that does not conform to collision mechanics principles, resulting in distorted shapes of the main accident subjects. 2) Minor accidents (such as scrapes or minor rear-end collisions) are common in reality, but this image generation method often struggles to accurately control the scenes of such accidents, resulting in images that often depict serious accidents with distinct characteristics. 3) The background scene of traffic accidents cannot be precisely controlled, and the background of images generated by a single model may differ significantly from the actual background scene, making it difficult to ensure the authenticity of background features, thus affecting the effectiveness of model training and accuracy in practical applications. 4) Images generated using this method lack annotation information and still require manual annotation by professionals, which is costly and slow. Especially when processing large amounts of accident data, the time and cost of manual annotation become bottlenecks in dataset construction.

[0024] In summary, the data collection defects faced during the training of traffic accident detection models, the distortion of the morphology of traffic accident subjects when performing data augmentation through images directly generated in one step by a single generative model, the difficulty in accurately controlling the accident characteristics of traffic accident subjects, the large difference between the background and the actual vehicle driving scene, the lack of annotation information, and the need for manual annotation have seriously restricted the research and development and application of traffic accident detection technology.

[0025] In view of this, in order to solve at least one of the above technical problems, the embodiments of the present invention propose a traffic accident detection data enhancement method, labeling method, detection method and equipment, which can quickly generate a large number of diverse traffic accident images, especially effectively covering low-frequency scene data such as night and extreme weather, thereby improving the richness and authenticity of the generated traffic accident pictures, and improving the quality of the generated traffic accident pictures.

[0026] The present invention is described in detail below with reference to the embodiments and accompanying drawings.

[0027] The first aspect of the embodiment of the present invention provides a method for enhancing traffic accident detection data, such as Figure 1 As shown, the method specifically includes steps S10 to S40.

[0028] S10. Build a roadside background image library and a traffic accident image library.

[0029] The roadside background image library can be constructed using images collected by roadside equipment. An exemplary method for constructing a roadside background image library involves acquiring a number of traffic background images captured by roadside equipment and constructing the library based on these images. Roadside equipment, such as cameras deployed on the road, can capture images of the road environment around the clock, enabling the acquisition of a large amount of data in a short period of time. This data covers extreme conditions such as nighttime, rainy days, and snowy days.

[0030] The first traffic accident subject and the second traffic accident subject in the traffic accident picture library can be made from real traffic accident pictures, wherein the second traffic accident subject is a binary image obtained by binarizing the traffic accident subject.

[0031] There are many ways to obtain real traffic accident pictures, for example, they can be obtained from the Internet or public traffic accident picture collections.

[0032] S20: randomly selecting a background image from a roadside background image library, and randomly selecting a first traffic accident subject and a corresponding second traffic accident subject from a traffic accident image library.

[0033] S30: Determine a fused traffic accident picture based on the randomly selected background picture and the first traffic accident subject.

[0034] By fusing randomly selected background images with randomly selected traffic accident subjects, a large number of fused images can be generated from a small number of background images and traffic accident subjects. These background images are derived from real road traffic environments and cover a wide range of environmental scenarios, including daytime, nighttime, rain, and snow. By using real images selected from a roadside background image library as the background for the fused images, the background of the resulting traffic accident images is consistent with the actual scene of the accident, improving the authenticity and diversity of the background of the fused traffic accident images.

[0035] S40: Based on the fused traffic accident picture and the second traffic accident subject, generate a first traffic accident picture for training a traffic accident detection model.

[0036] Specifically, when generating the first traffic accident image for training a traffic accident detection model, using the fused traffic accident image can significantly improve the authenticity and diversity of the background of the resulting traffic accident image. This allows the background of the resulting traffic accident image to encompass a variety of environmental scenarios, including daytime, nighttime, rain, and snow. This effectively generates traffic accident images in rare scenarios, including nighttime and inclement weather. This addresses the data shortage problem of traditional datasets in rare scenarios, enriches the model's training dataset, and enhances its generalization capabilities in diverse environments. When generating traffic accident images for training a traffic accident detection model, the second traffic accident subject can constrain the morphology of the traffic accident subject in the first traffic accident image, making it more realistic. Furthermore, the appearance of the traffic accident subject, such as color, can be freely manipulated to generate a rich and diverse range of traffic accident subjects, thereby improving the overall quality of the resulting first traffic accident image.

[0037] Through the solution of the present invention, a large number of traffic accident pictures with realistic shapes of traffic accident subjects, diverse backgrounds and consistent with actual vehicle driving scenes can be quickly generated, thereby improving the generation quality and efficiency of traffic accident pictures used for traffic accident detection model training.

[0038] like Figure 2 As shown, building a traffic accident picture library in step S10 may include steps S201 to S203.

[0039] S201: Collect traffic accident pictures, and crop target area pictures from the collected traffic accident pictures.

[0040] Collect a certain amount of real traffic accident images. Traffic accident images include images of accidents between people and vehicles, non-motor vehicles and vehicles, and vehicles and vehicles. There is no specific limit on the number of real traffic accident images, and dozens or hundreds of them are acceptable.

[0041] The target region image refers to the area in the traffic accident image where the traffic accident occurred, excluding portions of the entire traffic accident image that are not related to the traffic accident. The target region image is cropped from the traffic accident image by cropping out portions that are not related to the traffic accident.

[0042] S202: extract a first traffic accident subject from the target area image, and perform binarization processing on the first traffic accident subject to obtain a second traffic accident subject.

[0043] Reference Figure 3 , the first traffic accident subject can be extracted from the target area image. There are many ways to extract the first traffic accident subject from the target area image. For example, the first traffic accident subject can be extracted from the target area image using a semantic segmentation model.

[0044] Taking the G-DinoSAM semantic segmentation model as an example, the specific process of extracting the first traffic accident subject from the target area image is explained. It should be understood that this example is only used to explain the present invention and is not used to limit the present invention.

[0045] The extraction threshold t of the G-DinoSAM semantic segmentation model is set between 0 and 1, and the target area image and prompt words (person, car) are input into the G-DinoSAM semantic segmentation model. The first traffic accident subject is output through the G-DinoSAM semantic segmentation model. In this way, a clear and complete first traffic accident subject can be accurately extracted from the target area image, and the traffic accident details in the first traffic accident subject can be retained.

[0046] By performing binarization processing on the first traffic accident subject, we can obtain Figure 3 The second traffic accident subject is shown.

[0047] The second traffic accident subject is a binary image. Binarization is the process of segmenting a specific target or region in an image to generate a binary image. Each pixel value is either 0 or 1, with 1 indicating that the pixel belongs to the target region (i.e., the segmented portion) and 0 indicating that the pixel belongs to the background region (i.e., the non-target portion). This is used to identify the location and shape of the target region.

[0048] S203: Construct a traffic accident picture library based on the first traffic accident subject and the second traffic accident subject corresponding thereto.

[0049] In an embodiment of the present invention, a semantic segmentation model is used to process a target region image, thereby extracting a first traffic accident subject from the target region image. This allows for accurate extraction of a clear and complete traffic accident subject from collected real-world traffic accident images, while preserving as much of the accident details as possible. Binarization of the first traffic accident subject yields a second traffic accident subject. This second traffic accident subject not only constrains the morphology of the traffic accident subject in the resulting traffic accident image, making it more realistic, but also allows for flexible manipulation of the subject's appearance, such as color, to generate a rich and diverse range of traffic accident images.

[0050] In some embodiments of the present invention, step S30 (fusing the randomly selected background image and the first traffic accident subject to obtain a fused traffic accident image) may include: randomly flipping the first traffic accident subject, and placing the flipped first traffic accident subject on the background image based on preset conditions to obtain a fused traffic accident image.

[0051] Specifically, such as Figure 2 As shown, the traffic accident detection data enhancement method provided by the embodiment of the present invention may further include step S204 in addition to steps S201 to S203 .

[0052] S204 , randomly flipping the first traffic accident subject, and placing the flipped first traffic accident subject on the background image according to preset conditions to obtain a fused traffic accident image.

[0053] Among them, the preset condition is that the size of the flipped first traffic accident subject when it is close to the center of the background picture is larger than the size when it is far away from the center of the background picture, that is, the size of the flipped first traffic accident subject in the fused traffic accident picture decreases as the distance between the flipped first traffic accident subject and the center of the background picture increases.

[0054] In some optional examples, the preset conditions can also be quantified based on formula (1). Specifically, during the fusion process, the flipped traffic accident subject can be placed on the background based on formula (1) to obtain a fused traffic accident image, and the position coordinates and scale coefficient of the traffic accident subject in the fused traffic accident image can be recorded.

[0055] Wherein, formula (1) is:

[0056] Where scale() is the scale coefficient of the traffic accident subject (i.e., the ratio of the placement size to the original size S_0), H represents the height of the background image, y represents the vertical coordinate of the accident subject in the background image, and α represents the coefficient that controls the scale change, indicating the magnitude of the size ratio change with the y coordinate. The value of α can be adjusted according to the specific situation.

[0057] Formula (1) shows that when the traffic accident subject is close to the center of the image (y ≈ H / 2), scale ≈ 1, and when the subject moves up or down, the scale will decrease or increase with the change of the y coordinate.

[0058] In some embodiments, as Figure 2 As shown, the traffic accident detection data enhancement method provided by the embodiment of the present invention may include steps S205 and S206 in addition to steps S201 to S204.

[0059] S205: Determine a proportional coefficient of the flipped first traffic accident subject in the fused traffic accident image.

[0060] For ease of understanding, we will continue to use the example described in step S204 to explain step S205. Specifically, the scale factor (scale) of the flipped first traffic accident subject in the fused traffic accident image can be determined based on formula (1). S206: Based on the scale factor, the labeling information for the first traffic accident subject in the fused traffic accident image is determined.

[0061] Specifically, the labeling information of the first traffic accident subject in the fused traffic accident image may be calculated based on the initial size and scale factor of the flipped first traffic accident subject.

[0062] Specifically, the annotation information can be bounding box coordinates. Taking the position coordinates of the traffic accident subject in the fused traffic accident image as (x, y), and the initial width and height of the traffic accident subject as W0 and H0, respectively, as an example, the calculation process of the bounding box coordinates is explained.

[0063] The center position of the traffic accident subject in the fused traffic accident image is located at (x, y), and the initial width and height of the traffic accident subject are W0 and H0 respectively. After resizing, the new width and height are:

[0064]

[0065] The corresponding Bounding Box coordinates are represented by the upper left corner and lower right corner coordinates. The corresponding calculation method is: the upper left corner coordinates , the lower right corner coordinates .

[0066] In some embodiments of the present invention, Figure 2 As shown, the traffic accident detection data enhancement method provided by the embodiment of the present invention may further include step S209 in addition to steps S201 to S206.

[0067] S209: Obtain a labeled traffic accident picture based on the labeled information and the first traffic accident picture.

[0068] Specifically, a marking frame may be generated on the first traffic accident picture through the marking information to obtain a marked traffic accident picture.

[0069] The annotation information may be the Bounding Box coordinates. For ease of understanding, the example described in step S206 is continued as an example to illustrate step S209.

[0070] The Bounding Box coordinates obtained in step S206 correspond one-to-one to the generated first traffic accident picture. When generating the first traffic accident picture, a Bounding Box is drawn on the first traffic accident picture based on the Bounding Box coordinates to obtain a marked traffic accident picture.

[0071] The solution of the present invention, when fusing the first traffic accident subject with the background image, can determine the scale factor of the first traffic accident subject in the fused traffic accident image based on preset conditions. Using this scale factor and the initial size of the first traffic accident subject, the bounding box coordinates of the first traffic accident subject in the fused traffic accident image can be calculated. Using these bounding box coordinates, the first traffic accident image can be automatically annotated, ensuring that the resulting traffic accident image includes its own bounding box, significantly improving image generation efficiency and reducing labor costs.

[0072] In some examples, to improve the accuracy of traffic accident image annotation, images with bounding boxes can be screened by human workers. During screening, the workers will assess the image's legitimacy and whether the bounding box accurately frames the subject of the accident. If so, the image is considered qualified. This process quickly yields a batch of accurately labeled traffic accident detection images for subsequent traffic detection model training, promoting the optimization and improvement of the traffic accident object detection model.

[0073] In some embodiments of the present invention, step S40 (generating a first traffic accident picture for training a traffic accident detection model based on the fused traffic accident picture and the second traffic accident subject) may include: generating a first prompt word based on the fused traffic accident picture, and extracting a line draft of the fused traffic accident picture; generating a redrawing condition based on the first prompt word, the line draft of the fused traffic accident picture, and the second traffic accident subject, and generating the first traffic accident picture through the picture generation model based on the redrawing condition.

[0074] Specifically, such as Figure 2 As shown, the traffic accident detection data enhancement method provided by the embodiment of the present invention may include steps S207 and S208 in addition to steps S201 to S206.

[0075] S207 : Generate prompt words based on the fused traffic accident picture, and extract the line drawing of the fused traffic accident picture.

[0076] Among them, based on the prompt word inference model (such as BLIP-2, LLaMA-3, etc.), the description information about the fused traffic accident picture obtained is detailed and clear image description information about the fused traffic accident picture.

[0077] For example, a cue word inference model can be constructed using BLIP-2 and LLaMA-3. BLIP-2 generates a simple text description for the input fused traffic accident image. LLaMA-3 then converts the BLIP-2 output into a richer, more controllable text description, providing a foundation for the subsequent generation of traffic accident images that meet user requirements. There are multiple methods for extracting line drawings from the fused traffic accident image. One method involves using the lineart-standard tool in a preprocessor such as Anyline to extract line drawings from the fused traffic accident image. The extracted line drawings from the traffic accident image can provide clear outline guidance when generating the first traffic accident image in step S208, helping the model better understand the image structure and shape. This guides the generation of accident features for the subject of the traffic accident, enabling accurate generation of accident features for various types (e.g., minor vehicle collisions or minor rear-end collisions, as well as serious accidents with distinct features), further improving the quality of the generated traffic accident image.

[0078] S208 , generating redrawing conditions based on the prompt words, the line drawing of the fused traffic accident picture, and the second traffic accident subject, and generating a first traffic accident picture based on the redrawing conditions through a picture generation model.

[0079] When generating the final traffic accident picture based on the prompt word, the line draft of the fused traffic accident picture, and the second traffic accident subject, the prompt word, the line draft of the fused traffic accident picture, and the corresponding second traffic accident subject can be first input into the ControlNet model, and a redrawing condition is generated based on the ControlNet model. Then, the redrawing condition is input into the picture generation model (such as FLUX, StableDiffusion3, and other large picture generation models), and the first traffic accident picture is generated through the picture generation model.

[0080] The ControlNet model can be used to encode the prompt word, the line drawing of the fused traffic accident image, and the corresponding second traffic accident subject, generating a computer-recognizable language, known as the redrawing condition. Generating redrawing conditions using the ControlNet model significantly improves the generation of redrawing conditions compared to other encoding models. Guided by the redrawing conditions, large image generation models (such as FLUX and StableDiffusion3) are used to generate images of traffic accidents in everyday roadside scenarios. The generated images are stable and meet practical needs.

[0081] In some embodiments of the present invention, a second prompt word can also be generated based on the first prompt word and preset basic description information, thereby generating a first traffic accident picture based on the second prompt word, the line draft of the fused traffic accident picture and the second traffic accident subject.

[0082] Specifically, the basic description information is used to indicate that a traffic accident has occurred in the fused traffic accident image. For example, the basic description information could be "A traffic accident has occurred in the image." This supplements the description information generated by the prompt word inference model (i.e., the first prompt word). This prevents minor accidents from being misunderstood or misinterpreted by the prompt word inference model, resulting in missing descriptions related to the main accident, further improving the accuracy of the description.

[0083] Through the embodiments of the present invention, a large number of traffic accident scene images can be quickly generated, providing sufficient training data support for the traffic accident target detection model, and promoting the optimization and improvement of the traffic accident target detection model.

[0084] Through the embodiments of the present invention, the generated traffic accident detection pictures are not restricted by specific scenes, and can effectively generate traffic accident images in rare scenes including nighttime and bad weather, thereby solving the problem of insufficient data in rare scenes in traditional data sets, thereby enriching the training data set of the model and enhancing its generalization ability in diverse environments.

[0085] The embodiments of the present invention can significantly reduce labeling costs. In related art, the labeling of generated traffic accident images requires manual work by annotators, who must manually draw a bounding box with the traffic accident target for each image, which is time-consuming and labor-intensive. However, the images generated by the embodiments of the present invention do not require manual labeling by annotators, greatly improving labeling efficiency and significantly reducing labor costs.

[0086] Based on the same inventive concept, an embodiment of the present invention also provides a traffic accident detection dataset labeling method, which can generate a traffic accident training dataset with labeled information based on the traffic accident detection data enhancement method described in any of the above embodiments.

[0087] Through the solution of the present invention, a large number of traffic accident pictures with realistic morphology, diverse backgrounds, and conformity to actual vehicle driving scenes, and with built-in detection frames, can be quickly generated, which greatly improves the generation quality and efficiency of traffic accident pictures used for traffic accident detection model training and reduces labor costs.

[0088] Based on the same inventive concept, the embodiment of the present invention also provides a traffic accident detection method, such as Figure 4 As shown, the traffic accident detection method includes steps S401 to S403.

[0089] S401. Generate several traffic accident pictures based on a traffic accident detection data enhancement method.

[0090] S402: Based on the generated traffic accident images, a traffic accident detection model is trained to obtain a trained traffic accident detection model.

[0091] S403: Input the data collected by the roadside equipment into the trained traffic accident detection model to detect whether a traffic accident has occurred.

[0092] The embodiments of the present invention can quickly generate a large number of traffic accident pictures with realistic morphology, diverse backgrounds and that conform to actual vehicle driving scenarios through a traffic accident detection data enhancement method, thereby improving the authenticity and diversity of the generated traffic accident pictures, thereby improving the accuracy and stability of traffic accident detection model training, as well as the accuracy and stability of the model in detecting traffic accidents.

[0093] Based on the same inventive concept, according to another aspect of the present invention, Figure 5 As shown, an embodiment of the present invention further provides an electronic device 50, which includes a processor 510 and a memory 520. The memory 520 stores a computer program 521 that can be run on the processor. When the processor 510 executes the program, the steps of the above method are performed.

[0094] The memory, as a non-volatile storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as the program instructions / modules corresponding to the compression method in the embodiments of the present application. The processor executes the non-volatile software programs, instructions, and modules stored in the memory to execute various functional applications and data processing of the device, thereby implementing the compression method in the above method embodiments.

[0095] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the device, etc. In addition, the memory may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely located relative to the processor, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0096] Finally, it should be noted that those skilled in the art will understand that all or part of the processes in the above-described method embodiments can be implemented using a computer program to instruct the relevant hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes in the above-described method embodiments. The program storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM). The above-described computer program embodiments can achieve the same or similar effects as any of the corresponding aforementioned method embodiments.

[0097] It will also be appreciated by those skilled in the art that the various exemplary logic blocks, modules, circuits and algorithmic steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, a general description has been given of the functions of various schematic components, blocks, modules, circuits and steps. Whether this function is implemented as software or hardware depends on specific applications and the design constraints imposed on the entire system. Those skilled in the art can implement the function in various ways for each specific application, but this implementation decision should not be interpreted as causing a departure from the disclosed scope of the embodiments of the present invention.

[0098] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications can be made without departing from the scope of the disclosure of the embodiments of the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. The serial numbers of the embodiments disclosed in the above embodiments of the present invention are for description only and do not represent the advantages and disadvantages of the embodiments. In addition, although the elements disclosed in the embodiments of the present invention can be described or required in individual form, they can also be understood as multiple unless expressly limited to the singular.

[0099] It should be understood that, as used herein, the singular forms "a" and "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" is intended to include any and all possible combinations of one or more of the associated listed items.

[0100] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to limit the scope of the disclosure of the present invention (including the claims) to these examples. Within the spirit of the present invention, the technical features of the above embodiments or different embodiments may be combined, and many other variations exist in different aspects of the above embodiments, which are not provided in detail for the sake of clarity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A traffic accident detection data enhancement method, characterized in that: include: Constructing a roadside background image library and a traffic accident image library, wherein the traffic accident image library includes a first traffic accident subject and a second traffic accident subject obtained by binarizing the first traffic accident subject; Randomly select a background image from a roadside background image library, and randomly select a first traffic accident subject and a corresponding second traffic accident subject from a traffic accident image library; Determining a fused traffic accident picture based on the randomly selected background picture and the first traffic accident subject; Based on the fused traffic accident picture and the second traffic accident subject, a first traffic accident picture for training a traffic accident detection model is generated.

2. The method according to claim 1, characterized in that Building a traffic accident image library includes: Traffic accident pictures are collected, and target area pictures are cropped from the collected traffic accident pictures; a first traffic accident subject is extracted from the target area picture, and the first traffic accident subject is binarized to obtain a second traffic accident subject; a traffic accident picture library is constructed based on the first traffic accident subject and the corresponding second traffic accident subject.

3. The method according to claim 1, characterized in that Determining a fused traffic accident picture based on the randomly selected background picture and the first traffic accident subject includes: The first traffic accident subject is randomly flipped, and the flipped first traffic accident subject is placed on the background image based on preset conditions to obtain a fused traffic accident image.

4. The method according to claim 3, characterized in that Also includes: determining a scale factor of the flipped first traffic accident subject and the fused traffic accident image; Based on the scale coefficient, labeling information of the first traffic accident subject in the fused traffic accident picture is determined.

5. The method according to claim 4, characterized in that Also includes: Based on the annotation information and the first traffic accident picture, a labeled traffic accident picture is obtained.

6. The method according to claim 1, characterized in that Generating a first traffic accident picture for training a traffic accident detection model based on the fused traffic accident picture and the second traffic accident subject includes: generating a first prompt word based on the fused traffic accident picture, and extracting a line drawing of the fused traffic accident picture; A redrawing condition is generated based on the first prompt word, the line drawing of the fused traffic accident picture, and the second traffic accident subject, and a first traffic accident picture is generated through a picture generation model based on the redrawing condition.

7. The method according to claim 6, characterized in that Also includes: Based on the first prompt word and the preset basic description information, a second prompt word is generated, so as to generate a first traffic accident picture based on the second prompt word, the line drawing of the fused traffic accident picture and the second traffic accident subject.

8. A traffic accident detection dataset annotation method, characterized in that: Based on the traffic accident detection data enhancement method according to any one of claims 1 to 7, a traffic accident training data set with labeled information is generated.

9. A traffic accident detection method, characterized in that: include: Generating a plurality of traffic accident images for training a traffic accident detection model based on the traffic accident detection data enhancement method according to any one of claims 1 to 7; Training a traffic accident detection model based on the plurality of traffic accident images to obtain a trained traffic accident detection model; The data collected by the roadside equipment is input into the trained traffic accident detection model to detect whether a traffic accident has occurred.

10. An electronic device comprising: at least one processor; as well as A memory storing a computer program that can be run on the processor, wherein the processor performs the steps of the method according to any one of claims 1 to 9 when executing the program.

Citation Information

Patent Citations

  • Data enhancement method for traffic sign target detection field

    CN113793279A

  • Object combination image generation method and device, electronic equipment and storage medium

    CN117808932A

  • Planning intention graph generation method and system based on image generation model

    CN118570567A

Cited By

  • Traffic environment data labeling method, target detection model training method and equipment

    CN121392475A