Data Augmentation Tool for Tag Wrinkles
The path of the data augmentation tool is ./dataset_tools/tag_wrinkle_augmentation/tag_paste_data_augmentation.py. The script supports the input of the tag image folder path, parameter configurations, output of the augmented images, and generation of images with wrinkles and tilts based on the configured parameters.
To generate a simulation image, you need to manually configure parameters. You can modify the parameters to change the authenticity of the generated wrinkles and bubbles. You are advised to use the default parameters. For details, see the following table.
Parameter |
Recommended Wrinkle Feature Value |
Recommended Bubble Feature Value |
|---|---|---|
area_ratio |
[0.0001,0.01] |
[0.005,0.02] |
aspect_ratio |
[0.025,0.2] |
[0.33,3.0] |
rotation |
[-90,90] |
[-90,90] |
up_ratio |
[1.5,3.5] |
[1.1,1.3] |
down_ratio |
[0.5,0.8] |
[0.5,0.8] |
area_ratio_thres |
0.01 |
0.02 |
same_ratio_enable |
False |
True |
Example of default parameters for generating wrinkles:
python3 ./dataset_tools/tag_wrinkle_augmentation/tag_paste_data_augmentation.py --input_dataset_path=/data/small --output_dataset_path=/data/output
Example of manually modified parameters:
python3 ./dataset_tools/tag_wrinkle_augmentation/tag_paste_data_augmentation.py --input_dataset_path=/img/path --output_dataset_path=/data/output --area_ratio=[0.0001,0.01] --aspect_ratio=[0.025,0.2] --rotation=[-90,90] --up_ratio=[1.5,3.5] --down_ratio=[0.5,0.8] --area_ratio_thres=0.01 --same_ratio_enable=false --each_type_generate_nums=1
A directory is created in the generation folder to store the image data generated based on user-defined parameters. Table 2 describes the parameters.
If there are multiple types of tags and features, you need to manually configure script parameters to generate tags and features separately.
Parameter |
Type |
Value Range |
Default Value |
Description |
|---|---|---|---|---|
--input_dataset_path |
String |
- |
Mandatory |
Input path of the tag image folder. |
--output_dataset_path |
String |
- |
Mandatory |
Output path of the image folder, which cannot be the same as the input path. The script creates images and annotations folders in output_dataset_path, and saves the generated image data to images and the labeled data to the annotations folder in ImageNet format. |
--each_type_generate_nums |
Integer |
> 0 |
1 |
Setting of the quantity of images with wrinkles or bubbles. |
--area_ratio |
List |
[0.0001, 0.02] |
[0.0001,0.01] |
Area ratio range of a single defect. |
--aspect_ratio |
List |
[0.005, 3.0] |
[0.025, 0.2] |
Aspect ratio range of a single defect. |
--rotation |
List |
[-90, 90] |
[-90, 90] |
Rotation ratio range of a single defect. |
--up_ratio |
List |
[1.0, 3.5] |
[1.5, 3.5] |
Luminance transformation ratio range of the upper part of the image. |
--down_ratio |
List |
[0.5, 1.0] |
[0.5, 0.8] |
Luminance transformation ratio range of the lower part of the image. |
--area_ratio_thres |
Float |
Greater than 0 and less than 1 |
0.01 |
Threshold of the total defect area ratio. The recommended value range is [0.005,0.02]. |
--same_ratio_enable |
Bool |
true, false |
false |
The lower part of the image synchronizes with the upper part. |
--timeout |
Integer |
- |
300 |
The default timeout period is 5 minutes. |