Target detection data enhancement method and device, medium and product
By combining multiple data augmentation methods, more diverse training samples are generated, which solves the problem that traditional methods cannot generate sufficiently diverse samples, and significantly improves the training effect of the object detection model.
Patent Information
- Application Number
- CN202411533470.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-11
AI Technical Summary
Traditional object detection data augmentation methods cannot generate enough diverse training samples, which affects the training effect of the object detection model.
Generate a more diverse training sample by combining multiple data enhancement methods, including Mosaic operations with rotation, scaling, flip, color change and cut operations.
It significantly improves the training effect of the object detection model, improves the generalization ability and robustness of the model, and can better handle object detection tasks in complex contexts.
Smart Images

Figure CN119418152A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of target detection, and in particular to a target detection data enhancement method, device, medium and product. Background Art
[0002] With the development of deep learning technology, object detection algorithms have been widely used in fields such as smart grids and autonomous driving. Especially in the power industry, object detection technology can help detect defects in substation equipment and ensure the safe and stable operation of the power grid. The quality of data directly affects the effect of the detection algorithm, and in the object detection task, data enhancement is one of the key means to improve the generalization ability and robustness of the model. Traditional data enhancement methods such as rotation, scaling, flipping, color change, etc. are usually applied independently, so they cannot generate more diverse training samples, affecting the training effect of the object detection model. Summary of the invention
[0003] The purpose of this application is to provide a target detection data enhancement method, device, medium and product, which can generate more diverse training samples, thereby improving the training effect of the target detection model.
[0004] To achieve the above objectives, this application provides the following solutions:
[0005] In a first aspect, the present application provides a method for enhancing target detection data, comprising:
[0006] Get the target detection dataset;
[0007] Determine a data enhancement operation set based on multiple data enhancement methods; the data enhancement operation set includes: Mosaic operation;
[0008] Randomly selecting a number of data enhancement operations from the data enhancement operation set and combining them to obtain a data enhancement combination mode;
[0009] The original images in the target detection data set are processed according to the data enhancement combination method to obtain newly added images.
[0010] Optionally, the target detection data enhancement method further includes:
[0011] The newly added pictures are added to the target detection dataset to train the target detection model.
[0012] Optionally, adding the newly added image to the target detection dataset to train the target detection model includes:
[0013] Adding the newly added picture to the target detection dataset;
[0014] Determining whether the number of training samples in the target detection data set reaches a predetermined number of training samples;
[0015] If the number of training samples in the target detection data set does not reach the predetermined number of training samples, return to the step of "randomly selecting several data enhancement operations from the data enhancement operation set for combination to obtain a data enhancement combination method";
[0016] If the number of training samples in the target detection data set reaches a predetermined number of training samples, the target detection model is trained according to the target detection data set.
[0017] Optionally, adding the newly added image to the target detection dataset to train the target detection model includes:
[0018] Pre-training a target detection model based on the target detection dataset;
[0019] Adding the newly added pictures to the target detection data set, and training the pre-trained target detection model according to the newly added pictures;
[0020] Determine whether the number of training samples in the target detection data set reaches a predetermined number of training samples and whether the target detection model achieves an expected training effect; the expected training effect is: the accuracy of target detection is greater than a set value;
[0021] If the number of training samples in the target detection data set does not reach the predetermined number of training samples, and the target detection model does not achieve the expected training effect, return to the step of "randomly selecting several data enhancement operations from the data enhancement operation set for combination to obtain a data enhancement combination method" until the number of training samples in the target detection data set reaches the predetermined number of training samples, or the target detection model achieves the expected training effect.
[0022] Optionally, the data enhancement operation set also includes: a rotation operation, a scaling operation, a flipping operation, a color change operation and a shearing operation.
[0023] Optionally, the rotation angle range of the rotation operation is [-15°, 15°]; the scaling ratio range of the scaling operation is [0.8, 1.2]; and the number of stitched pictures of the Mosaic operation is 4.
[0024] Optionally, processing the original pictures in the target detection dataset according to the data enhancement combination mode to obtain the newly added pictures includes:
[0025] According to the data enhancement combination mode, the original images in the target detection data set are processed in sequence according to the order of several randomly selected data enhancement operations to obtain newly added images.
[0026] In a second aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the target detection data enhancement method.
[0027] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the target detection data enhancement method when executed by a processor.
[0028] In a fourth aspect, the present application provides a computer program product, including a computer program, which implements the target detection data enhancement method when executed by a processor.
[0029] According to the specific embodiments provided in this application, this application discloses the following technical effects:
[0030] The present application provides a method, device, medium and product for target detection data enhancement, which determines a data enhancement operation set based on multiple data enhancement methods, randomly selects several data enhancement operations from the data enhancement operation set for combination, obtains a data enhancement combination mode, and processes the original images in the target detection data set according to the data enhancement combination mode to obtain a newly added image. By combining and applying multiple data enhancement methods, the present application can generate more diverse training samples, which can significantly improve the training effect of the target detection model compared to a single data enhancement method. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0032] Figure 1 A flowchart of the target detection data enhancement method provided in this application;
[0033] Figure 2 Detailed flowchart of the target detection data enhancement method provided in this application. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0035] In recent years, Mosaic data enhancement technology has attracted attention because of its ability to generate more complex and diverse training samples. The Mosaic method creates new training samples by splicing four pictures into one picture. However, using the Mosaic method alone may limit the further improvement of data diversity. Therefore, the present application proposes a target detection data enhancement method, device, medium and product based on multiple combinations, especially combining the Mosaic method with other data enhancement methods, aiming to generate more diverse training samples, thereby improving the training effect of the target detection model.
[0036] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0037] In an exemplary embodiment, the present application provides a method for enhancing target detection data, such as Figure 1 and Figure 2 As shown, the method includes the following steps S1 to S5.
[0038] Step S1: Obtain target detection dataset.
[0039] Step S2: Determine a data enhancement operation set based on multiple data enhancement methods.
[0040] Preferably, the data enhancement operation set includes: a mosaic operation. Further, the data enhancement operation set also includes: a rotation operation, a scaling operation, a flipping operation, a color change operation and a shearing operation.
[0041] Specifically, a set of data enhancement operations are defined, including but not limited to the following methods:
[0042] Rotation: Randomly select an angle within a range to rotate the image. For example, you can set the rotation angle range to [-15°, 15°] to randomly rotate the image within a small range to simulate observations from different perspectives.
[0043] Scaling: Randomly select a scaling ratio and scale the image. For example, you can set the scaling ratio range to [0.8, 1.2] to simulate shooting effects at different distances.
[0044] Mosaic: Splice four images into a new image to create more training samples. The Mosaic method can enhance the correlation between images, allowing the model to recognize targets in more complex backgrounds.
[0045] Flipping: Flip the image horizontally or vertically. Horizontal flipping is suitable for left-right symmetrical objects, while vertical flipping is suitable for top-bottom symmetrical objects.
[0046] Color Change: Adjust the color space of an image, such as brightness, contrast, etc. For example, you can adjust the brightness and contrast of an image to simulate scenes under different lighting conditions.
[0047] Cutout: Randomly select a portion of the image and block it to simulate the effect of the occluder.
[0048] Step S3: randomly selecting several data enhancement operations from the data enhancement operation set and combining them to obtain a data enhancement combination mode.
[0049] In each data enhancement operation, several operations are randomly selected from the above set for combination. Preferably, the data enhancement combination mode is a combination of a Mosaic operation and other data enhancement operations in the data enhancement operation set. For example, a combination of rotation and Mosaic can be selected, or a combination of scaling, Mosaic and flipping can be selected, and so on. This combination mode makes the generated image have higher diversity.
[0050] Step S4: Processing the original images in the target detection data set according to the data enhancement combination method to obtain newly added images.
[0051] The original image is processed according to the selected combination to generate a new image. The processing order is based on the order of the randomly selected data augmentation operations. For example, if the combination of rotation and mosaic is selected, the image is first rotated at a random angle and then spliced with three other images that have been processed in the same way to form a new mosaic image.
[0052] When the data enhancement combination is a combination of rotation and Mosaic, the specific processing flow includes: randomly selecting four pictures from the data set; applying a rotation operation to each picture; splicing the processed four pictures together in a Mosaic manner; and generating a new training sample, that is, a newly added picture.
[0053] Furthermore, the method also includes the following step S6.
[0054] Step S6: adding the newly added pictures to the target detection data set to train the target detection model.
[0055] Use the newly added images to train the object detection model. The newly added images not only contain the information of the original images, but also introduce more variations through data augmentation, which helps improve the generalization ability of the model. During the training process, the model will learn how to accurately detect target objects under various conditions.
[0056] By looping the above steps, new training samples are continuously generated until the predetermined number of training samples is met or the desired training effect is achieved. This process helps ensure that the model is exposed to enough samples to learn and generalize.
[0057] In a specific embodiment, the newly added pictures are added to the target detection dataset for training the target detection model, including: adding the newly added pictures to the target detection dataset; determining whether the number of training samples in the target detection dataset reaches a predetermined number of training samples; if the number of training samples in the target detection dataset does not reach the predetermined number of training samples, returning to step S3; if the number of training samples in the target detection dataset reaches the predetermined number of training samples, training the target detection model according to the target detection dataset.
[0058] In another specific embodiment, the newly added pictures are added to the target detection data set to train the target detection model, including: pre-training the target detection model based on the target detection data set; adding the newly added pictures to the target detection data set, and training the pre-trained target detection model according to the newly added pictures; judging whether the number of training samples in the target detection data set reaches a predetermined number of training samples and whether the target detection model achieves an expected training effect; the expected training effect is: the accuracy of target detection is greater than a set value; if the number of training samples in the target detection data set does not reach the predetermined number of training samples, and the target detection model does not achieve the expected training effect, returning to step S3 until the number of training samples in the target detection data set reaches the predetermined number of training samples, or the target detection model achieves the expected training effect.
[0059] The target detection data enhancement method based on multiple combinations proposed in this application is different from the traditional method of randomly selecting only one data enhancement method (such as rotation, scaling, Mosaic, etc.) to process the image, but combines multiple enhancement methods (especially Mosaic) for use. Compared with the traditional single data enhancement method, this application can significantly improve the training effect of the target detection model. By combining the Mosaic method with other data enhancement methods, it not only increases the diversity of training samples, but also improves the robustness and generalization ability of the model, which helps to solve the challenges faced by target detection in practical applications. Specifically, this method can bring the following technical effects:
[0060] Improve the generalization ability of the model: Through a combination of diverse data augmentation methods, the model can learn the characteristics of target objects under different conditions, thereby showing stronger adaptability in practical applications.
[0061] Enhance the robustness of the model: Diverse training samples help the model maintain a high accuracy when facing unknown data.
[0062] Improve the detection effect of the model: By introducing advanced data enhancement technologies such as Mosaic, the model can better handle target detection tasks in complex backgrounds.
[0063] Accelerate model training: Since more training samples are generated, the model can learn from richer data, which helps it converge to the optimal state faster.
[0064] In short, the technical solution of this application can not only effectively improve the performance of the target detection model, but also be widely used in various target detection tasks, providing strong support for technological innovation in the fields of smart grids, autonomous driving, etc. In addition, this method can also provide effective solutions for other fields such as medical image analysis and security monitoring.
[0065] In an exemplary embodiment, the present application further provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0066] In an exemplary embodiment, the present application further provides a computer-readable storage medium storing a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.
[0067] In an exemplary embodiment, the present application further provides a computer program product, including a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.
[0068] In this application, all actions to obtain signals, information or data are carried out in compliance with the relevant data protection laws and policies of the country where the application is located, and with the authorization of the corresponding device owner. It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant legal provisions.
[0069] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0070] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.
[0071] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0072] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A target detection data enhancement method, characterized in that: include: Get the target detection dataset; Determine a set of data augmentation operations based on multiple data augmentation methods; The data enhancement operation set includes: Mosaic operation; Randomly selecting a number of data enhancement operations from the data enhancement operation set and combining them to obtain a data enhancement combination mode; The original images in the target detection data set are processed according to the data enhancement combination method to obtain newly added images.
2. The target detection data enhancement method according to claim 1, characterized in that: Also includes: The newly added pictures are added to the target detection dataset to train the target detection model.
3. The target detection data enhancement method according to claim 2, characterized in that: Adding the newly added image to the target detection data set to train the target detection model includes: Adding the newly added picture to the target detection dataset; Determining whether the number of training samples in the target detection data set reaches a predetermined number of training samples; If the number of training samples in the target detection data set does not reach the predetermined number of training samples, return to the step of "randomly selecting several data enhancement operations from the data enhancement operation set for combination to obtain a data enhancement combination method"; If the number of training samples in the target detection data set reaches a predetermined number of training samples, the target detection model is trained according to the target detection data set.
4. The target detection data enhancement method according to claim 2, characterized in that: Adding the newly added image to the target detection data set to train the target detection model includes: Pre-training a target detection model based on the target detection dataset; Adding the newly added pictures to the target detection data set, and training the pre-trained target detection model according to the newly added pictures; Determine whether the number of training samples in the target detection data set reaches a predetermined number of training samples and whether the target detection model achieves an expected training effect; the expected training effect is: the accuracy of target detection is greater than a set value; If the number of training samples in the target detection data set does not reach the predetermined number of training samples, and the target detection model does not achieve the expected training effect, return to the step of "randomly selecting several data enhancement operations from the data enhancement operation set for combination to obtain a data enhancement combination method" until the number of training samples in the target detection data set reaches the predetermined number of training samples, or the target detection model achieves the expected training effect.
5. The target detection data enhancement method according to claim 1, characterized in that: The data enhancement operation set also includes: a rotation operation, a scaling operation, a flipping operation, a color change operation and a shearing operation.
6. The target detection data enhancement method according to claim 5, characterized in that: The rotation angle range of the rotation operation is [-15°, 15°]; the scaling ratio range of the scaling operation is [0.8, 1.2]; and the number of stitched pictures of the Mosaic operation is 4.
7. The target detection data enhancement method according to claim 1, characterized in that: The original images in the target detection dataset are processed according to the data enhancement combination method to obtain newly added images, including: According to the data enhancement combination mode, the original images in the target detection data set are processed in sequence according to the order of several randomly selected data enhancement operations to obtain newly added images.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the target detection data enhancement method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the target detection data enhancement method described in any one of claims 1 to 7 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the target detection data enhancement method described in any one of claims 1 to 7 is implemented.