Data enhancement method, training method and system for target detection model
By generating mask images and performing color transformation through the semantic segmentation model, the problem of low recognition accuracy of target detection models for unseen color samples is solved, efficient and low-cost data enhancement is achieved, and the generalization ability and robustness of the model are improved, making it suitable for industrial detection scenarios.
Patent Information
- Application Number
- CN202510918792.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-10-17
AI Technical Summary
The recognition accuracy of existing object detection models drops significantly when faced with unseen color samples, and existing data augmentation methods easily destroy the semantic boundary between background and foreground when dealing with color variations, resulting in insufficient model generalization ability, high training costs, and the need to repeatedly collect new data.
By introducing a semantic segmentation model to generate a mask image, extracting the foreground area and performing color transformation, an enhanced image with multiple color attributes is generated. Combined with mask optimization processing, the image structure is ensured to remain unchanged and the color diversity of the training data is expanded.
It significantly improves the model's ability to recognize unseen color samples, reduces training costs and time, and improves the model's generalization performance and robustness, making it suitable for industrial scenarios with frequent color changes.
Smart Images

Figure CN120807925A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data enhancement, and particularly relates to a data enhancement method, a training method and a system for a target detection model. BACKGROUND
[0002] In the field of target detection, the existing model training method usually relies on a large number of labeled training samples, and identifies and locates target objects through a deep learning algorithm. This kind of method can obtain a high recognition accuracy under the condition that the training samples are fully covered. However, in actual application, the target objects may have differences in color, material or appearance, and especially when new color samples that are not covered in the training set appear, the recognition accuracy of the model will often decrease significantly. For example, existing research shows that the accuracy of the model may decrease by as much as 6% when encountering a new color sample. This shows that the existing technology still has obvious deficiencies in the model generalization ability, especially in the industrial scene with high sample diversity demand.
[0003] Therefore, there is an urgent need for a data enhancement method for a target detection model to enhance the recognition ability of the target detection model for unseen color samples. SUMMARY
[0004] In view of this, the present application discloses a data enhancement method, a training method and a system for a target detection model to enhance the recognition ability of the target detection model for unseen color samples.
[0005] In a first aspect, the present application discloses a data enhancement method for a target detection model, comprising: generating a mask image corresponding to a target image by using a semantic segmentation model, so as to separate the foreground region and the background region in the target image, the target image being labeled with a target object bounding box; extracting a first image for representing the foreground region from the target image based on the mask image; performing color transformation processing on the first image to obtain a plurality of second images, each of the second images being used for representing the foreground region and having a color attribute different from that of the first image; generating a corresponding enhanced image based on each of the second images; and adding the target image and the plurality of enhanced images into a training data set for training the target detection model, wherein each of the plurality of enhanced images corresponds to a target object bounding box consistent with the target image.
[0006] Optionally, the semantic segmentation model is a SAM model; and the generating of the mask image corresponding to the target image by using the semantic segmentation model comprises: inputting the target object bounding box as a prompt word into the SAM model to obtain the mask image, the mask image being a binary image, the foreground region being represented by a first value and the background region being represented by a second value.
[0007] Optionally, the data augmentation method further comprises: post-processing the mask image to improve completeness and boundary accuracy of the foreground region; wherein the post-processing comprises: performing image inpainting or contour smoothing processing on isolated pixels, boundary jaggies, hollow regions or pseudo-connection regions in the mask image through morphological closing operation, connected region screening, edge optimization or region filling.
[0008] Optionally, the color transformation processing performed on the first image comprises: converting the first image from an RGB color space to a target color space having a hue attribute, and transforming the color attribute in the target color space, while keeping the image structure information unchanged; or directly perturbing the numerical values of each color channel of the first image in the RGB color space, while keeping the image structure information unchanged.
[0009] Optionally, the target color space comprises an HSV color space and an HSL color space; and the transformation of the color attribute in the target color space comprises: dividing a hue channel into a plurality of intervals, and performing a rotation transformation on the hue channel of the first image according to the boundary values of the intervals to generate a plurality of second images, wherein the ranges of the intervals are the same.
[0010] Optionally, in the transformation of the color attribute, the numerical values of channels other than the hue are kept unchanged.
[0011] Optionally, after the transformation of the color attribute in the target color space, the method further comprises: converting the first image from the target color space to the RGB color space.
[0012] In a second aspect, the present application discloses a data augmentation system for a target detection model, which is configured to perform the data augmentation method disclosed in the first aspect.
[0013] In a third aspect, the present application discloses a training method for a target detection model, comprising: collecting and preparing original image data; labeling the original image data to obtain labeled image data; augmenting the labeled image data by using the data augmentation method disclosed in the first aspect to generate augmented image data; grouping the original image data and the augmented image data into a data set, and dividing the data set into a training data set, a validation data set and a test data set; training a plurality of candidate target detection models based on the training data set; evaluating the plurality of candidate target detection models based on the validation data set, and selecting an optimal model according to the validation performance; and testing and evaluating the optimal model based on the test data set.
[0014] In a fourth aspect, the present application discloses a training system for a target detection model, which is configured to perform the training method disclosed in the third aspect.
[0015] In summary, the data enhancement method, training method and system for the target detection model disclosed in the application have at least the following beneficial effects:
[0016] (1) By introducing a semantic segmentation model to generate a mask image of the target object, and on this basis, performing color transformation on the foreground region, a plurality of color versions of training samples are generated, effectively improving the recognition ability of the model for unseen color samples, and enhancing the generalization performance and robustness.
[0017] (2) In the color transformation process, different color images are generated by rotating the hue channel and other methods, and the image structure information is kept unchanged, so that the accuracy of the model in identifying new color samples can be controlled within about 0.2%, which is significantly improved compared with the prior art (decreased by 6%);
[0018] (3) Since a large number of diversified training samples are generated by color transformation, compared with the prior art, a large number of physical samples do not need to be additionally collected to cover different color situations, thereby shortening the time required for model training, effectively reducing the data preparation and training cost;
[0019] (4) With the help of high-quality color enhanced samples and mask optimization processing, the model training efficiency is significantly improved, so that the number of repeated training can be reduced from more than 10 times in the prior art to only 1-2 times, saving computing resources;
[0020] (5) The above method does not need to rely on specific colors or specific backgrounds, has strong universality and scalability, and is suitable for industrial production detection scenarios with frequent color changes or diversified processes. BRIEF DESCRIPTION OF DRAWINGS
[0021] The drawings used in the description of the embodiments of the application are briefly introduced as follows.
[0022] Figure 1 A flowchart of a training method for a target detection model in the prior art is shown.
[0023] Figure 2 A flowchart of a data enhancement method for a target detection model provided by an embodiment of the application is shown.
[0024] Figure 3 A flowchart of a training method for a target detection model provided by an embodiment of the application is shown. DETAILED DESCRIPTION
[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the specific embodiments of the present application will be described below with reference to the drawings. The drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained from these drawings without creative labor, and other embodiments can be obtained, and the adjustments and improvements made without departing from the concept of the present application are within the protection scope of the present application.
[0026] In order to make the drawing simple, only the parts related to the corresponding embodiments are shown in the drawings, which do not represent the actual structure of the product. In addition, in order to make the drawing simple and easy to understand, in some drawings, only some of the parts with the same structure or function are shown, and there may be more or less parts with the same structure or function.
[0027] In the present application, unless otherwise explicitly specified and limited, ordinal words such as "first", "second", etc. are only used to distinguish the description of the associated objects, and cannot be understood as indicating or implying the relative importance or order between the associated objects; in addition, it also does not represent the number of associated objects. "Multiple" includes two or more, and other quantifiers are similar. " / " is used to describe the relationship between the associated objects, which represents the "or" relationship between the associated objects. "And / or" is used to describe the relationship between the associated objects, which includes any combination relationship between the associated objects, for example, "a and / or b" includes: "a alone", "b alone", or "a and b". "One or more" or "at least one" of a plurality of objects means any object or any combination of a plurality of objects, for example, "one or more of a1, a2, a3" or "at least one of a1, a2, a3" includes: "a1 alone", "a2 alone", "a3 alone", "a1 and a2", "a1 and a3", "a2 and a3", or "a1, a2 and a3".
[0028] In traditional target detection technology, image processing algorithms based on OpenCV are usually used for recognition. Such methods essentially belong to template matching, which mainly compares the contour shape of the target object with the preset sample to determine whether the target exists. However, this detection method has limited adaptability to target deformation, angle change and color change, and is prone to recognition errors in complex scenes. With the rapid development of artificial intelligence technology, target detection has gradually evolved into a detection method based on deep learning. By constructing and training AI models such as convolutional neural networks, deep learning models such as Faster R-CNN, YOLO, SSD, etc. can be used to significantly improve detection accuracy. Such AI-based target detection methods not only use shape features of the target, but also combine color information, especially color differences, to more effectively distinguish target and non-target areas in a changing background, and are widely used in industrial detection, security monitoring, autonomous driving and other fields.
[0029] Please refer to Figure 1 , which shows a flowchart of a training method for a target detection model in the prior art. As Figure 1 shown, the training method in the prior art includes:
[0030] S100, collecting and preparing original image data;
[0031] S200, labeling the original image data to obtain labeled image data;
[0032] S300, using the labeled image data to form a data set and dividing it into a training data set, a validation data set and a test data set;
[0033] S400, training multiple candidate target detection models based on the training data set;
[0034] S500, evaluating the multiple candidate target detection models based on the validation data set, and selecting the optimal model according to the validation performance;
[0035] S600, testing and evaluating the optimal model based on the test data set;
[0036] S700, collecting new image data and continuously optimizing the model.
[0037] After step S700 is completed, it jumps to step S100 and is repeated multiple times.
[0038] Although the existing technology uses AI-based training models to significantly improve the accuracy of target detection, it still has significant shortcomings when facing the problem of color variation in practical applications. Especially in industrial environments, target objects such as strip heads may change color due to material differences, changes in lighting conditions or different production batches, and these color variations do not appear in the original training data, which can easily cause model recognition failure. For example, a model trained only on original samples may drop its recognition accuracy by more than 6% when encountering unseen color changes. Although the existing technology attempts to use data enhancement methods such as rotation, flipping, random color perturbation, and brightness contrast adjustment to improve model robustness, since the transformation processes the entire image, it is easy to destroy the semantic boundary between the background and the foreground, and even mislead the model to learn irrelevant features, thereby affecting the overall detection performance. In addition, in order to cope with color diversity, existing methods often require repeated collection of new data and retraining of models (for example, Figure 1 After step S700 is completed, new data must be collected again and trained again, repeating this cycle to improve accuracy. This not only consumes a large amount of computing resources but also increases the complexity of model deployment and maintenance. The process of re-collecting new data requires a large number of samples of various styles from different suppliers for training. The entire process can take several months, making the cost of model training high. Therefore, existing solutions still face severe challenges in terms of model scalability and color generalization capabilities, and the training cost is high. There is an urgent need for a more targeted, low-cost, and efficient solution.
[0039] The core concept of this application is to utilize a data augmentation method that combines semantic segmentation and color enhancement based on a small number of existing annotated samples after collecting and annotating the original image data. This method generates multiple enhanced samples with different color attributes while maintaining the image structure, thereby effectively expanding the color diversity of the training data. This solution significantly improves the model's ability to recognize unseen color-changing targets without requiring additional data collection, reduces detection errors caused by insufficient color generalization, and addresses the pain points of existing technologies requiring repeated collection, training, and fine-tuning. It offers advantages such as strong generalization, low training costs, and ease of deployment and maintenance.
[0040] Please refer to Figure 2 , which shows a flow chart of a data enhancement method for a target detection model provided by an embodiment of the present application. Figure 2 As shown, the present application discloses a data enhancement method for a target detection model, comprising:
[0041] S101, for a target image that has been marked with a target object bounding box, using a semantic segmentation model to generate a mask image corresponding to the target image, so as to separate the foreground area and the background area in the target image;
[0042] S201, extracting a first image for representing the foreground region from the target image based on the mask image, performing color transformation processing on the first image to obtain a plurality of second images, each of which is for representing the foreground region and has different color properties from the first image;
[0043] S301, generating a corresponding enhanced image based on each of the plurality of second images, and adding the target image and the plurality of enhanced images into a training data set for training the target detection model; wherein each of the plurality of enhanced images corresponds to a target object bounding box consistent with the target image.
[0044] In this embodiment, as shown in Figure 2 , a data augmentation method for training a target detection model is provided, and the core steps of the method include mask generation, color transformation, and data augmentation. Specifically, first, for a target image that has been labeled with a target object bounding box, a semantic segmentation model is used to generate a mask image corresponding to the target image. The mask image is usually a binary image, in which the foreground region (i.e., the target object, such as a tape head) and the background region are clearly distinguished, thereby effectively separating the foreground region and the background region in the target image.
[0045] Subsequently, based on the above-mentioned mask image, a first image containing only the foreground region is extracted from the original target image, and color transformation processing is performed on the first image. Color transformation can be achieved in various ways, for example: converting the image from the RGB color space to a target color space containing a hue channel (such as HSV or HSL), and performing rotation transformation on the hue in this space, thereby generating multiple images with different color properties; or, without converting the color space, directly performing numerical perturbation on the RGB channels to simulate changes in different colors. The above processing ensures that the plurality of second images generated are consistent in structure with the first image, but differ in color properties.
[0046] After generating a plurality of second images, a corresponding enhanced image is further constructed based on each second image. The enhanced image is usually an image obtained by embedding the foreground region that has undergone color transformation on the background of the original target image. To maintain consistency in positioning in the target detection task, each enhanced image retains the corresponding target object bounding box in the original image. Finally, the original image and the plurality of enhanced images are added together into a training data set for training the target detection model.
[0047] Through the above steps, the color diversity of the training samples can be effectively expanded, and the adaptability of the model to the target color change is enhanced. Especially in industrial application scenarios, due to factors such as material batch and lighting conditions, the color of the target object may change significantly. The model trained by relying on the original data often lacks the generalization ability for such color variation. However, the embodiment introduces the target region color transformation based on the mask, expands the training samples of the color space without changing the background information, and helps the model to learn the robust features irrelevant to the color change. Therefore, the scheme can effectively improve the recognition accuracy of the target detection model for unseen color samples, reduce the dependence of the model on new data, thereby reducing the data collection and labeling cost, shortening the model iteration period, and significantly improving the robustness and adaptability of the detection system in complex actual scenarios.
[0048] In some embodiments of the present application, the semantic segmentation model is a SAM model; generating a mask image corresponding to the target image by using the semantic segmentation model comprises: inputting the target object bounding box as a prompt word into the SAM model to obtain the mask image, the mask image being a binary image, the foreground region being represented by a first value, and the background region being represented by a second value.
[0049] In the present embodiment, the semantic segmentation model used is a SAM (Segment Anything Model) model. The SAM model is an advanced zero-shot semantic segmentation model, and its core capability is that it can automatically generate a corresponding pixel-level mask in an input image through a simple prompt word without pre-labeling and training for each target class. Compared with traditional semantic segmentation methods that require fine pixel-level labeling for each target class, the SAM model greatly reduces the training and labeling cost and has stronger universality and migration ability.
[0050] In the present embodiment, the labeled target object bounding box in the image is input into the SAM model as a prompt word. For each target image with completed bounding box labeling, the bounding box is input into the SAM model as a "spatial prompt", and the SAM model returns a foreground region mask most relevant to the prompt box. The mask is a binary image that can accurately indicate the region most relevant to the target within the bounding box, wherein the foreground region is represented by a first value (such as 1 or 255) in the mask image, and the background region is represented by a second value (such as 0), and the present application does not limit the specific value mode.
[0051] In this way, this application can efficiently generate a semantic mask corresponding to the target area based on the existing bounding box annotations without additional pixel-level annotation. This mask serves as the data basis for subsequent foreground extraction and color transformation, not only improving processing efficiency but also ensuring the accuracy of target area extraction, further enhancing the quality of data augmentation and model training.
[0052] In some embodiments of the present application, the data enhancement method further includes: post-processing the mask image to improve the integrity and boundary accuracy of the foreground area; wherein the post-processing includes: image restoration or contour smoothing of isolated pixels, boundary jagged edges, hole areas or pseudo-connected areas in the mask image through morphological closing operations, connected area screening, edge optimization or area filling.
[0053] Post-processing the mask image can improve the integrity of the foreground region and the accuracy of its boundaries. The semantic segmentation model's actual mask generation can be affected by image quality, blurred object boundaries, occlusion, or noise, leading to jagged edges, holes, pseudo-connected areas, or isolated patches in the generated mask. Using these unprocessed masks directly for image enhancement can introduce errors, affecting the accuracy of subsequent foreground extraction and color conversion, and ultimately impacting the quality of the enhanced samples and training effectiveness.
[0054] To this end, the present application performs post-processing on the mask image through image processing technology. Post-processing includes, for example: performing morphological closing operations on the mask image to fill small holes; using connected region analysis to screen and retain the main target area and remove interference patches in the background; using edge optimization methods to smooth the mask edges; or eliminating discontinuous areas inside the mask by region filling. The above processing steps can be applied individually or in combination to repair incomplete areas or discontinuous boundaries in the mask image, thereby obtaining a target foreground area with a more complete structure and smoother boundaries. Image enhancement based on the optimized mask image can further improve the quality of training samples, thereby helping to train a target detection model with higher generalization ability and detection accuracy.
[0055] In some embodiments of the present application, color transformation processing is performed on the first image, including: while keeping the image structure information unchanged, converting the first image from the RGB color space to a target color space with hue attributes, and transforming the color attributes in the target color space; or, while keeping the image structure information unchanged, directly perturbing the values of each color channel of the first image in the RGB color space.
[0056] That is, two ways of performing color transformation processing on the first image are disclosed in this embodiment, both of which are performed under the premise of keeping the image structure information unchanged, in order to ensure that the shape, boundary and other structural features of the target object are not destroyed, thereby avoiding the model from learning irrelevant interference features. In the first way, the first image is converted from the RGB color space to a target color space with hue attribute, for example, the target color space includes the HSV color space and the HSL color space. Then, the hue channel is divided into several intervals, and a rotation transformation, i.e., hue shift, is performed on the hue channel of the first image according to the boundary values of each interval to generate several second images, wherein the range of each interval is the same. The reason for setting the range of each interval to be the same is to achieve the balance of data distribution, so that the distribution of enhanced data in color is more extensive and uniform, thereby reducing the detection deviation caused by unbalanced color samples. For example, the hue channel can be divided into 9 equally spaced color versions (such as red→ yellow→ green→ cyan→ blue→ purple, etc.), to generate enhanced images with obvious color differences. It should be noted that the "9" is only an exemplary setting, and in actual application, the hue channel can also be divided into 12, 24 or even more equally spaced intervals according to specific task requirements, to achieve more fine color transformation and greater color coverage. When the number of divided intervals is large, the number of generated enhanced samples increases, and the model can obtain stronger color generalization ability, but it may also introduce redundant samples and increase the training burden; while the number of intervals is small, the transformation amplitude is limited, and the enhancement effect is weak but the calculation cost is small. Therefore, the present application does not limit the specific number of divisions, and the user can flexibly adjust the division granularity of the hue channel according to the actual scene.
[0057] In the second way, the color space of the original image is not changed, i.e., it is still kept in the RGB color space, and the numerical values of each color channel of the first image in the RGB space are directly disturbed, i.e., the R channel, the G channel and the B channel are moderately adjusted, to simulate the color change under the light change or the difference of the shooting device, and to expand the image sample set. However, compared with the first way, the second way is weak in controlling the directionality and perceptual consistency of color change, and is easy to introduce uncontrollable color offset, affecting the naturalness of the image and the representativeness of the sample.
[0058] In some embodiments of the present application, during the transformation of the color attribute, the numerical values of the channels other than the hue are kept unchanged.
[0059] For example, when the color space used is HSV, the S channel (saturation) and the V channel (brightness) are kept unchanged; when the HSL color space is used, the S channel (saturation) and the L channel (lightness) are kept unchanged. In this way, the brightness and color saturation of the overall image are stabilized, image distortion (i.e., deviation from the actual situation) caused by multi-channel disturbance is avoided, the model focuses on learning the influence of color changes on target recognition, and the robustness to color diversity is improved.
[0060] In some embodiments of the present application, after the color attribute is transformed in the target color space, the first image is further converted from the target color space to the RGB color space.
[0061] Since mainstream target detection models usually take images in the RGB color space as input formats, after the first image is converted to the target color space such as HSV or HSL and the color attribute transformation is completed, the first image is reconverted to the RGB color space, which helps to ensure the consistency of the enhanced image and the original image in format, avoid the adverse effects of input color space differences on model training or inference, and improve the stability of the overall training and the adaptability of the model.
[0062] Based on similar technical concepts, the present application discloses a data enhancement system for a target detection model, which is used to execute the data enhancement method disclosed in the above embodiments.
[0063] The technical features of the system are substantially the same as those of the above-mentioned data enhancement method, which will not be described here. The system generates diversified training samples by performing color attribute transformation on the foreground region in the target image while keeping the image structure and bounding box information unchanged, which can effectively improve the recognition ability of the model to color change samples, reduce the dependence on a large number of real image collections, shorten the model training period, and reduce the training resource consumption. From the application scenario, the system can be widely used in various mechanical vision detection devices, and is especially suitable for industrial scenes that are sensitive to object color but have limited sample sources, such as pipeline defect detection, part assembly verification, material sorting and identification, etc., which helps to improve the adaptability and stability of the detection system.
[0064] Based on similar technical concepts, the present application discloses a training method for a target detection model. Please refer to Figure 3 which shows a flowchart of a training method for a target detection model provided by an embodiment of the present application. As shown in Figure 3 the training method of the present application comprises:
[0065] S100, collecting and preparing original image data;
[0066] S200, labeling the original image data to obtain labeled image data;
[0067] S800, enhancing the labeled image data using a data enhancement method to generate enhanced image data;
[0068] S310, grouping the labeled image data and the enhanced image data into a data set, and dividing the data set into a training data set, a validation data set and a test data set;
[0069] S400, training a plurality of candidate target detection models based on the training data set;
[0070] S500, evaluating the plurality of candidate target detection models based on the validation data set, and selecting an optimal model according to the validation performance;
[0071] S600, testing and evaluating the optimal model based on the test data set.
[0072] In step S800, the steps S101, S201 and S301 disclosed in the above embodiments are further included. The specific embodiments of steps S101, S201 and S301 can be referred to the above embodiments, and will not be repeated here. In step S310, compared with step S300 in the prior art, the enhanced image data is additionally generated in the present application, so that the enhanced image data and the initial labeled image data are grouped into a data set. Other steps, such as steps S100, S200, S400, S500 and S600, are consistent with the prior art, or only simple adaptive adjustment is made, which will not be repeated here. It can also be seen that the training method of the present application does not change the overall process structure of the existing training method in a large range, but introduces the color attribute enhancement step on the basis of the original process, so that the model obtains stronger generalization ability without increasing the number of original samples. The method has good compatibility and universality, can be seamlessly integrated into the existing training process, and significantly improves the robustness of the model to target color changes, thereby effectively improving the detection performance while ensuring the stability of the overall training architecture.
[0073] Compared with Figure 1A flowchart of a training method for a target detection model is shown. The training method of the present application additionally increases the data enhancement method disclosed in the above embodiments after data labeling and before data set division. In this way, the sample diversity for training can be significantly improved without the need to additionally increase the number of original samples, thereby enhancing the model's ability to adapt to unseen color samples and improving its detection accuracy under color variation conditions. In addition, after step S600, no new sample data can be collected for training. This is because, in the prior art, the model has low recognition accuracy when facing color-variant target samples after only one round of training, validation, and testing. Only by continuously collecting new data, expanding samples, and repeating the training process can the recognition ability be gradually improved. The present application introduces an enhancement mechanism for color attributes after data labeling, enabling the model to have strong color generalization ability in the initial training stage and laying a good foundation for training. Therefore, without multiple rounds of training, a high accuracy can be achieved. Of course, in actual applications, if the training cost is not considered and higher recognition accuracy is pursued, multiple rounds of training can be performed. However, under the same number of rounds, the technical solution proposed in the present application still achieves better recognition performance than the prior art, thereby embodying the comprehensive advantages of the present application in accuracy and efficiency.
[0074] Based on similar technical concepts, the present application discloses a training system for a target detection model, which is used to execute the training method disclosed in the above embodiments.
[0075] The technical features of the system are substantially the same as those of the above-mentioned training method, and will not be described again here. The system generates diversified training samples by performing color attribute transformation on the foreground region of the target image, while keeping the image structure and bounding box information unchanged. This can effectively improve the model's recognition ability for color-variant samples, reduce the dependence on a large number of physical image collections, and thus shorten the model training period and reduce the training resource consumption. In terms of application scenarios, the system can be widely used in various mechanical vision detection devices, especially in industrial scenarios where object color is sensitive but sample sources are limited, such as pipeline defect detection, part assembly verification, material sorting and identification, etc., which helps to improve the adaptability and stability of the detection system. In terms of structure, the training system can include the data enhancement system disclosed in the above embodiments.
[0076] In the above embodiments, the description of each embodiment focuses on different aspects, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments. In addition, the above embodiments can be freely combined as needed.
Claims
1. A data enhancement method for a target detection model, characterized in that: include: For a target image that has been annotated with a target object bounding box, a semantic segmentation model is used to generate a mask image corresponding to the target image, so as to separate the foreground area and the background area in the target image; extracting a first image representing the foreground area from the target image based on the mask image, and performing color transformation on the first image to obtain a plurality of second images, each of the second images representing the foreground area and having a color attribute different from that of the first image; Generating corresponding enhanced images based on the plurality of second images, respectively, and adding the target image and the plurality of enhanced images to a training data set for training the target detection model; Each of the plurality of enhanced images corresponds to a target object boundary box that is consistent with the target image.
2. The data enhancement method for target detection model according to claim 1, characterized in that The semantic segmentation model is a SAM model; The method of generating a mask image corresponding to the target image by using a semantic segmentation model includes: The target object bounding box is input into the SAM model as a prompt word to obtain the mask image, which is a binary image. The foreground area is represented by a first value, and the background area is represented by a second value.
3. The data enhancement method for target detection model according to claim 1, characterized in that Also includes: Post-processing the mask image to improve the integrity and boundary accuracy of the foreground area; The post-processing includes: performing image restoration or contour smoothing on isolated pixels, boundary jagged edges, hollow areas or pseudo-connected areas in the mask image through morphological closing operations, connected area screening, edge optimization or area filling.
4. The data enhancement method for target detection model according to claim 1, characterized in that The performing color conversion processing on the first image includes: On the premise of keeping the image structure information unchanged, by converting the first image from the RGB color space to a target color space with hue attributes, and transforming the color attributes in the target color space; or Under the premise of keeping the image structure information unchanged, the values of each color channel of the first image in the RGB color space are directly disturbed.
5. The data enhancement method for target detection model according to claim 4, characterized in that The target color space includes HSV color space and HSL color space; The transforming of color attributes in the target color space includes: The hue channel is divided into a plurality of intervals, and a rotation transformation is performed on the hue channel of the first image according to a boundary value of each interval to generate the plurality of second images, wherein the range of each interval is the same.
6. The data enhancement method for target detection model according to claim 5, characterized in that When transforming color attributes, keep the values of other channels except hue unchanged.
7. The data enhancement method for a target detection model according to claim 5 or 6, characterized in that: After the color attributes are transformed in the target color space, the method further includes: The first image is converted from the target color space to an RGB color space.
8. A data augmentation system for a target detection model, characterized in that: The data enhancement system is used to perform the data enhancement method according to any one of claims 1 to 7.
9. A training method for a target detection model, characterized in that: include: Collect and prepare raw image data; Annotating the original image data to obtain annotated image data; enhancing the annotated image data using the data enhancement method according to any one of claims 1 to 7 to generate enhanced image data; The original image data and the enhanced image data are combined into a data set, and the data set is divided into a training data set, a verification data set, and a test data set; Training multiple candidate target detection models based on the training dataset; Evaluate the multiple candidate object detection models based on the validation dataset, and select the best model based on the validation performance; The optimal model is tested and evaluated based on the test data set.
10. A training system for a target detection model, characterized in that: The training system is used to execute the training method according to claim 9.
Citation Information
Cited By
Thyroid-related eye disease intraorbital soft tissue volume measurement method and system
CN121639767A