|
1 |
| -# PaddleSeg 数据增强 |
| 1 | +English|[简体中文](data_cn.md) |
| 2 | +# PaddleSeg Data Augmentation |
2 | 3 |
|
3 | 4 |
|
4 |
| -## 数据增强基本流程 |
| 5 | +## Data augmentation basic procedure |
5 | 6 |
|
6 | 7 | 
|
7 | 8 |
|
8 | 9 | ## Resize
|
9 | 10 |
|
10 |
| -Resize步骤是指将输入图像按照某种规则讲图片重新缩放到某一个尺寸,PaddleSeg支持以下3种resize方式: |
| 11 | +Resize means rescale the input image to a certain size according to a certain rule. PaddleSeg support the following three ways to resize: |
11 | 12 |
|
12 | 13 | 
|
13 | 14 |
|
14 | 15 | - Unpadding
|
15 |
| -将输入图像直接resize到某一个固定大小下,送入到网络中间训练。预测时同样操作。 |
| 16 | +Resize the input image to a certain fixed size and send it to the network for training. Do the same when predict. |
16 | 17 |
|
17 | 18 | - Step-Scaling
|
18 |
| -将输入图像按照某一个比例resize,这个比例以某一个步长在一定范围内随机变动。预测时不对输入图像做处理。 |
| 19 | +Resize the input image based on a certain ratio, which randomly changes within a certain range with a certain step. The input image remains the same during prediction. |
19 | 20 |
|
20 | 21 | - Range-Scaling
|
21 |
| -将输入图像按照长边变化进行resize,即图像长边对齐到某一长度,该长度在一定范围内随机变动,短边随同样的比例变化。 |
22 |
| -预测时需要将长边对齐到另外指定的固定长度。 |
| 22 | +Resize the input image based on the long edge, which means scale the long edge to a certain length, and the short edge changes based on the original image ratio. The image's long edge will be rescaled to another assigned length during prediction. |
23 | 23 |
|
24 |
| -Range-Scaling示意图如下: |
| 24 | +Range-Scaling's diagram is as follows: |
25 | 25 |
|
26 | 26 | 
|
27 | 27 |
|
28 |
| -|Resize方式|配置参数|含义|备注| |
| 28 | +|Resize method|config parameter|meaning|Note| |
29 | 29 | |-|-|-|-|
|
30 |
| -|Unpadding|AUG.FIX_RESIZE_SIZE|Resize的固定尺寸| |
31 |
| -|Step-Scaling|AUG.MIN_SCALE_FACTOR|Resize最小比例| |
32 |
| -||AUG.MAX_SCALE_FACTOR|Resize最大比例| |
33 |
| -||AUG.SCALE_STEP_SIZE|Resize比例选取的步长| |
34 |
| -|Range-Scaling|AUG.MIN_RESIZE_VALUE|图像长边变动范围的最小值| |
35 |
| -||AUG.MAX_RESIZE_VALUE|图像长边变动范围的最大值| |
36 |
| -| |AUG.INF_RESIZE_VALUE|预测时长边对齐时所指定的固定长度|取值必须在<br>[AUG.MIN_RESIZE_VALUE,<br> AUG.MAX_RESIZE_VALUE]<br>范围内。| |
| 30 | +|Unpadding|AUG.FIX_RESIZE_SIZE|the fixed size of Resize| |
| 31 | +|Step-Scaling|AUG.MIN_SCALE_FACTOR|the minimum ratio of Resize| |
| 32 | +||AUG.MAX_SCALE_FACTOR|the maximum ratio of Resize| |
| 33 | +||AUG.SCALE_STEP_SIZE|the step size of Resize| |
| 34 | +|Range-Scaling|AUG.MIN_RESIZE_VALUE|the minimum value of the long edge of image| |
| 35 | +||AUG.MAX_RESIZE_VALUE|the maximum value of the long edge of image| |
| 36 | +| |AUG.INF_RESIZE_VALUE|the assigned fixed length when rescale the long edge |must range between <br>[AUG.MIN_RESIZE_VALUE,<br> AUG.MAX_RESIZE_VALUE]<br>.| |
37 | 37 |
|
38 |
| -**注:本文所有配置参数可在configs目录下您的yaml文件中进行设置。** |
| 38 | +**PS:All configuration parameters in this article can be set in your yaml file in the configs directory** |
39 | 39 |
|
40 |
| -## 图像翻转 |
| 40 | +## Image flip |
41 | 41 |
|
42 |
| -PaddleSeg支持以下2种翻转方式: |
| 42 | +PaddleSeg support following two ways to flip: |
43 | 43 |
|
44 |
| -- 左右翻转(Mirror) |
45 |
| -以50%概率对图像进行左右翻转。 |
| 44 | +- Vertival flip(Mirror) |
| 45 | +Flip the image left and right with 50% probability. |
46 | 46 |
|
47 |
| -- 上下翻转(Flip) |
48 |
| -以一定概率对图像进行上下翻转。 |
| 47 | +- Horizontal Flip |
| 48 | +Flip the image upside down with a certain probability. |
| 49 | + |
| 50 | + |
| 51 | +The above two kinds of switches operate independently and can be used in combination. Therefore, there are 4 possible situations for image flipping as follows: |
49 | 52 |
|
50 |
| -以上2种开关独立运作,可组合使用。故图像翻转一共有如下4种可能的情况: |
51 | 53 |
|
52 | 54 | 
|
53 | 55 |
|
54 |
| -|图像翻转方式|配置参数|含义|备注| |
| 56 | +|Image flip method| Config parameter |Meaning|Note| |
55 | 57 | |-|-|-|-|
|
56 |
| -|Mirror|AUG.MIRROR|左右翻转开关|为True时开启,为False时关闭| |
57 |
| -|Flip|AUG.FLIP|上下翻转开关|为True时开启,为False时关闭| |
58 |
| -||AUG.FLIP_RATIO|控制是否上下翻转的概率|当AUG.FLIP为False时无效| |
| 58 | +|Mirror|AUG.MIRROR|vertival flip switch |open when set with True| |
| 59 | +|Flip|AUG.FLIP|horizontal flip switch|open when set with True| |
| 60 | +||AUG.FLIP_RATIO|Control the probability of flip upside down|invalid whtn AUG.FLIP is False| |
59 | 61 |
|
60 | 62 |
|
61 | 63 | ## Rich Crop
|
| 64 | +Rich Crop is a set of data enhancement strategies open by PaddleSeg based on actual business experience. It is a data enhancement strategy for segmentation scenarios with less labeled data and complex test data. The process is shown in the figure below: |
62 | 65 |
|
63 |
| -Rich Crop是PaddleSeg结合实际业务经验开放的一套数据增强策略,面向标注数据少,测试数据情况繁杂的分割业务场景使用的数据增强策略。流程如下图所示: |
64 |
| - |
65 |
| - |
| 66 | + |
66 | 67 |
|
67 |
| -Rich Crop是指对图像进行多种变换,保证在训练过程中数据的丰富多样性,包含以下4种变换: |
| 68 | +Rich Crop refers to a variety of transformations on the image to ensure the rich diversity of the data during the training process. It includes the following 4 transformations: |
68 | 69 |
|
69 |
| -- Blur |
70 |
| -使用高斯模糊对图像进行平滑。 |
| 70 | +-Blur |
| 71 | +Use Gaussian Blur to smooth the image. |
71 | 72 |
|
72 |
| -- Rotation |
73 |
| -图像旋转,旋转角度在一定范围内随机选取,旋转产生的多余的区域使用`DATASET.PADDING_VALUE`值进行填充。 |
| 73 | +-Rotation |
| 74 | +Image rotation, the rotation angle is randomly selected within a certain range. And the extra area generated by the rotation is filled with the value of `DATASET.PADDING_VALUE`. |
74 | 75 |
|
75 |
| -- Aspect |
76 |
| -图像长宽比调整,从图像中按一定大小和宽高比裁取一定区域出来之后进行resize。 |
| 76 | +-Aspect |
| 77 | +Image aspect ratio adjustment, resize after cropping a certain area from the image according to a certain size and aspect ratio. |
77 | 78 |
|
78 |
| -- Color jitter |
79 |
| -图像颜色抖动,共进行亮度、饱和度和对比度三种颜色属性的调节。 |
| 79 | +-Color jitter |
| 80 | +The image color is jittered, and the three color attributes of brightness, saturation and contrast are adjusted. |
80 | 81 |
|
81 |
| -|Rich crop方式|配置参数|含义|备注| |
| 82 | +|Rich crop method|Config parameter|Meaning|Note| |
82 | 83 | |-|-|-|-|
|
83 |
| -|Rich crop|AUG.RICH_CROP.ENABLE|Rich crop总开关|为True时开启,为False时关闭所有变换| |
84 |
| -|Blur|AUG.RICH_CROP.BLUR|图像模糊开关|为True时开启,为False时关闭| |
85 |
| -||AUG.RICH_CROP.BLUR_RATIO|控制进行模糊的概率|当AUG.RICH_CROP.BLUR为False时无效| |
86 |
| -|Rotation|AUG.RICH_CROP.MAX_ROTATION|图像正向旋转的最大角度|取值0~90°,实际旋转角度在\[-AUG.RICH_CROP.MAX_ROTATION, AUG.RICH_CROP.MAX_ROTATION]范围内随机选取| |
87 |
| -|Aspect|AUG.RICH_CROP.MIN_AREA_RATIO|裁取图像与原始图像面积比最小值|取值0~1,取值越小则变化范围越大,若为0则不进行调节| |
88 |
| -||AUG.RICH_CROP.ASPECT_RATIO|裁取图像宽高比范围|取值非负,越小则变化范围越大,若为0则不进行调节| |
89 |
| -|Color jitter|AUG.RICH_CROP.BRIGHTNESS_JITTER_RATIO|亮度调节因子|取值0~1,取值越大则变化范围越大,若为0则不进行调节| |
90 |
| -||AUG.RICH_CROP.SATURATION_JITTER_RATIO|饱和度调节因子|取值0~1,取值越大则变化范围越大,若为0则不进行调节| |
91 |
| -| |AUG.RICH_CROP.CONTRAST_JITTER_RATIO|对比度调节因子 |取值0~1,取值越大则变化范围越大,若为0则不进行调节| |
| 84 | +|Rich crop|AUG.RICH_CROP.ENABLE|Rich crop overall switch|open with True, close all transformation with False| |
| 85 | +|Blur|AUG.RICH_CROP.BLUR|Image blur switch|open with True, close with False| |
| 86 | +||AUG.RICH_CROP.BLUR_RATIO|the probability of blur |invalid when AUG.RICH_CROP.BLUR is False| |
| 87 | +|Rotation|AUG.RICH_CROP.MAX_ROTATION|maximum rotation angle of clockwise rotation|range between 0~90°,Actual rotation angle is randomly set within \[-AUG.RICH_CROP.MAX_ROTATION, AUG.RICH_CROP.MAX_ROTATION]| |
| 88 | +|Aspect|AUG.RICH_CROP.MIN_AREA_RATIO|The minimum area ratio of the cropped image to the original image|The value is 0~1, the smaller the value, the larger the range of change, if it is 0, no adjustment will be made| |
| 89 | +||AUG.RICH_CROP.ASPECT_RATIO|The range of cropped image aspect ratio|The value is non-negative, the smaller the value, the larger the range of change, if it is 0, no adjustment is made| |
| 90 | +|Color jitter|AUG.RICH_CROP.BRIGHTNESS_JITTER_RATIO|Brightness adjustment factor|The value is between 0~1, the larger the value, the larger the range of change, if it is 0, no adjustment is made| |
| 91 | +||AUG.RICH_CROP.SATURATION_JITTER_RATIO|Saturation adjustment factor|The value is 0~1, the larger the value, the larger the range of change, if it is 0, no adjustment is made| |
| 92 | +| |AUG.RICH_CROP.CONTRAST_JITTER_RATIO|Contrast adjustment factor |The value is 0~1, the larger the value, the larger the range of change, if it is 0, no adjustment is made| |
92 | 93 |
|
93 | 94 |
|
94 | 95 | ## Random Crop
|
95 | 96 |
|
96 |
| -随机裁剪图片和标签图,该步骤主要是通过裁剪的方式使得输入到网络中的图像在某一个固定大小。 |
| 97 | +Randomly crop pictures and label images. This step crop the input images of the network to a fixed size. |
97 | 98 |
|
98 |
| -Random crop过程分为3种情形: |
99 |
| -- 当输入图像尺寸等于CROP_SIZE时,返回原图。 |
100 |
| -- 当输入图像尺寸大于CROP_SIZE时,直接裁剪。 |
101 |
| -- 当输入图像尺寸小于CROP_SIZE时,分别使用`DATASET.PADDING_VALUE`值和`DATASET.IGNORE_INDEX`值对图像和标签图进行填充,再进行裁剪。 |
| 99 | +Random crop process is divided into 3 situations: |
| 100 | +- When the input image size is equal to CROP_SIZE, return to the original image. |
| 101 | +- When the input image size is larger than CROP_SIZE, crop directly. |
| 102 | +- When the input image size is smaller than CROP_SIZE, use the `DATASET.PADDING_VALUE` value and the `DATASET.IGNORE_INDEX` value to fill the image and label image, and then crop them. |
0 commit comments