preprocessor.proto 23.4 KB
Newer Older
1
2
3
4
5
syntax = "proto2";

package object_detection.protos;

// Message for defining a preprocessing operation on input data.
6
// See: //third_party/tensorflow_models/object_detection/core/preprocessor.py
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
7
// Next ID: 41
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
message PreprocessingStep {
  oneof preprocessing_step {
    NormalizeImage normalize_image = 1;
    RandomHorizontalFlip random_horizontal_flip = 2;
    RandomPixelValueScale random_pixel_value_scale = 3;
    RandomImageScale random_image_scale = 4;
    RandomRGBtoGray random_rgb_to_gray = 5;
    RandomAdjustBrightness random_adjust_brightness = 6;
    RandomAdjustContrast random_adjust_contrast = 7;
    RandomAdjustHue random_adjust_hue = 8;
    RandomAdjustSaturation random_adjust_saturation = 9;
    RandomDistortColor random_distort_color = 10;
    RandomJitterBoxes random_jitter_boxes = 11;
    RandomCropImage random_crop_image = 12;
    RandomPadImage random_pad_image = 13;
    RandomCropPadImage random_crop_pad_image = 14;
    RandomCropToAspectRatio random_crop_to_aspect_ratio = 15;
    RandomBlackPatches random_black_patches = 16;
    RandomResizeMethod random_resize_method = 17;
    ScaleBoxesToPixelCoordinates scale_boxes_to_pixel_coordinates = 18;
    ResizeImage resize_image = 19;
    SubtractChannelMean subtract_channel_mean = 20;
    SSDRandomCrop ssd_random_crop = 21;
    SSDRandomCropPad ssd_random_crop_pad = 22;
    SSDRandomCropFixedAspectRatio ssd_random_crop_fixed_aspect_ratio = 23;
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
33
34
    SSDRandomCropPadFixedAspectRatio ssd_random_crop_pad_fixed_aspect_ratio =
        24;
Vivek Rathod's avatar
Vivek Rathod committed
35
36
    RandomVerticalFlip random_vertical_flip = 25;
    RandomRotation90 random_rotation90 = 26;
37
    RGBtoGray rgb_to_gray = 27;
38
    ConvertClassLogitsToSoftmax convert_class_logits_to_softmax = 28;
39
40
    RandomAbsolutePadImage random_absolute_pad_image = 29;
    RandomSelfConcatImage random_self_concat_image = 30;
pkulzc's avatar
pkulzc committed
41
42
43
    AutoAugmentImage autoaugment_image = 31;
    DropLabelProbabilistically drop_label_probabilistically = 32;
    RemapLabels remap_labels = 33;
44
45
46
    RandomJpegQuality random_jpeg_quality = 34;
    RandomDownscaleToTargetPixels random_downscale_to_target_pixels = 35;
    RandomPatchGaussian random_patch_gaussian = 36;
47
    RandomSquareCropByScale random_square_crop_by_scale = 37;
48
    RandomScaleCropAndPadToSquare random_scale_crop_and_pad_to_square = 38;
49
    AdjustGamma adjust_gamma = 39;
50
51
52
53
54
55
56
57
58
  }
}

// Normalizes pixel values in an image.
// For every channel in the image, moves the pixel values from the range
// [original_minval, original_maxval] to [target_minval, target_maxval].
message NormalizeImage {
  optional float original_minval = 1;
  optional float original_maxval = 2;
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
59
60
  optional float target_minval = 3 [default = 0];
  optional float target_maxval = 4 [default = 1];
61
62
}

63
64
// Randomly horizontally flips the image and detections with the specified
// probability, default to 50% of the time.
65
message RandomHorizontalFlip {
Vivek Rathod's avatar
Vivek Rathod committed
66
67
68
69
70
71
72
73
74
75
76
77
  // Specifies a mapping from the original keypoint indices to horizontally
  // flipped indices. This is used in the event that keypoints are specified,
  // in which case when the image is horizontally flipped the keypoints will
  // need to be permuted. E.g. for keypoints representing left_eye, right_eye,
  // nose_tip, mouth, left_ear, right_ear (in that order), one might specify
  // the keypoint_flip_permutation below:
  // keypoint_flip_permutation: 1
  // keypoint_flip_permutation: 0
  // keypoint_flip_permutation: 2
  // keypoint_flip_permutation: 3
  // keypoint_flip_permutation: 5
  // keypoint_flip_permutation: 4
78
  // If nothing is specified the order of keypoint will be mantained.
Vivek Rathod's avatar
Vivek Rathod committed
79
  repeated int32 keypoint_flip_permutation = 1;
80
81

  // The probability of running this augmentation for each image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
82
  optional float probability = 2 [default = 0.5];
83
84
}

85
86
// Randomly vertically flips the image and detections with the specified
// probability, default to 50% of the time.
Vivek Rathod's avatar
Vivek Rathod committed
87
88
89
90
91
92
93
94
95
96
97
98
99
100
message RandomVerticalFlip {
  // Specifies a mapping from the original keypoint indices to vertically
  // flipped indices. This is used in the event that keypoints are specified,
  // in which case when the image is vertically flipped the keypoints will
  // need to be permuted. E.g. for keypoints representing left_eye, right_eye,
  // nose_tip, mouth, left_ear, right_ear (in that order), one might specify
  // the keypoint_flip_permutation below:
  // keypoint_flip_permutation: 1
  // keypoint_flip_permutation: 0
  // keypoint_flip_permutation: 2
  // keypoint_flip_permutation: 3
  // keypoint_flip_permutation: 5
  // keypoint_flip_permutation: 4
  repeated int32 keypoint_flip_permutation = 1;
101
102

  // The probability of running this augmentation for each image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
103
  optional float probability = 2 [default = 0.5];
Vivek Rathod's avatar
Vivek Rathod committed
104
105
106
}

// Randomly rotates the image and detections by 90 degrees counter-clockwise
107
108
109
110
111
112
113
114
115
// with the specified probability, default to 50% of the time.
message RandomRotation90 {
  // Specifies a mapping from the original keypoint indices to 90 degree counter
  // clockwise indices. This is used in the event that keypoints are specified,
  // in which case when the image is rotated the keypoints might need to be
  // permuted.
  repeated int32 keypoint_rot_permutation = 1;

  // The probability of running this augmentation for each image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
116
  optional float probability = 2 [default = 0.5];
117
}
Vivek Rathod's avatar
Vivek Rathod committed
118

119
120
121
// Randomly scales the values of all pixels in the image by some constant value
// between [minval, maxval], then clip the value to a range between [0, 1.0].
message RandomPixelValueScale {
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
122
123
  optional float minval = 1 [default = 0.9];
  optional float maxval = 2 [default = 1.1];
124
125
126
127
}

// Randomly enlarges or shrinks image (keeping aspect ratio).
message RandomImageScale {
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
128
129
  optional float min_scale_ratio = 1 [default = 0.5];
  optional float max_scale_ratio = 2 [default = 2.0];
130
131
132
133
}

// Randomly convert entire image to grey scale.
message RandomRGBtoGray {
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
134
  optional float probability = 1 [default = 0.1];
135
136
137
138
139
}

// Randomly changes image brightness by up to max_delta. Image outputs will be
// saturated between 0 and 1.
message RandomAdjustBrightness {
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
140
  optional float max_delta = 1 [default = 0.2];
141
142
143
144
}

// Randomly scales contract by a value between [min_delta, max_delta].
message RandomAdjustContrast {
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
145
146
  optional float min_delta = 1 [default = 0.8];
  optional float max_delta = 2 [default = 1.25];
147
148
149
150
}

// Randomly alters hue by a value of up to max_delta.
message RandomAdjustHue {
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
151
  optional float max_delta = 1 [default = 0.02];
152
153
154
155
}

// Randomly changes saturation by a value between [min_delta, max_delta].
message RandomAdjustSaturation {
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
156
157
  optional float min_delta = 1 [default = 0.8];
  optional float max_delta = 2 [default = 1.25];
158
159
160
161
162
163
164
165
166
167
}

// Performs a random color distortion. color_orderings should either be 0 or 1.
message RandomDistortColor {
  optional int32 color_ordering = 1;
}

// Randomly jitters corners of boxes in the image determined by ratio.
// ie. If a box is [100, 200] and ratio is 0.02, the corners can move by [1, 4].
message RandomJitterBoxes {
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
168
  optional float ratio = 1 [default = 0.05];
169
170
171
172
173

  enum JitterMode {
    DEFAULT = 0;
    EXPAND = 1;
    SHRINK = 2;
174
175
176
177
    EXPAND_SYMMETRIC = 4;
    SHRINK_SYMMETRIC = 5;
    EXPAND_SYMMETRIC_XY = 6;
    SHRINK_SYMMETRIC_XY = 7;
178
179
180
181
  }
  // The mode of jittering
  // EXPAND - Only expands boxes
  // SHRINK - Only shrinks boxes
182
183
184
185
186
187
188
189
190
191
192
  // EXPAND_SYMMETRIC - Expands the boxes symmetrically along height and width
  //   dimensions without changing the box center. The ratios of expansion along
  //   X, Y dimensions are independent.
  // SHRINK_SYMMETRIC - Shrinks the boxes symmetrically along height and width
  //   dimensions without changing the box center. The ratios of shrinking along
  //   X, Y dimensions are independent.
  // EXPAND_SYMMETRIC_XY - Expands the boxes symetrically along height and
  //   width dimensions and the ratio of expansion is same for both.
  // SHRINK_SYMMETRIC_XY - Shrinks the boxes symetrically along height and
  //   width dimensions and the ratio of shrinking is same for both.
  // DEFAULT - Jitters each box boundary independently.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
193
  optional JitterMode jitter_mode = 2 [default = DEFAULT];
194
195
196
197
198
}

// Randomly crops the image and bounding boxes.
message RandomCropImage {
  // Cropped image must cover at least one box by this fraction.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
199
  optional float min_object_covered = 1 [default = 1.0];
200
201

  // Aspect ratio bounds of cropped image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
202
203
  optional float min_aspect_ratio = 2 [default = 0.75];
  optional float max_aspect_ratio = 3 [default = 1.33];
204
205

  // Allowed area ratio of cropped image to original image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
206
207
  optional float min_area = 4 [default = 0.1];
  optional float max_area = 5 [default = 1.0];
208
209
210
211

  // Minimum overlap threshold of cropped boxes to keep in new image. If the
  // ratio between a cropped bounding box and the original is less than this
  // value, it is removed from the new image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
212
  optional float overlap_thresh = 6 [default = 0.3];
213

214
  // Whether to clip the boxes to the cropped image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
215
  optional bool clip_boxes = 8 [default = true];
216

217
  // Probability of keeping the original image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
218
  optional float random_coef = 7 [default = 0.0];
219
220
221
222
223
224
}

// Randomly adds padding to the image.
message RandomPadImage {
  // Minimum dimensions for padded image. If unset, will use original image
  // dimension as a lower bound.
225
226
  optional int32 min_image_height = 1;
  optional int32 min_image_width = 2;
227
228
229

  // Maximum dimensions for padded image. If unset, will use double the original
  // image dimension as a lower bound.
230
231
  optional int32 max_image_height = 3;
  optional int32 max_image_width = 4;
232
233
234
235
236
237

  // Color of the padding. If unset, will pad using average color of the input
  // image.
  repeated float pad_color = 5;
}

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
238
239
// Randomly adds a padding of size [0, max_height_padding), [0,
// max_width_padding).
240
241
242
243
244
245
246
247
248
249
250
message RandomAbsolutePadImage {
  // Height will be padded uniformly at random from [0, max_height_padding).
  optional int32 max_height_padding = 1;
  // Width will be padded uniformly at random from [0, max_width_padding).
  optional int32 max_width_padding = 2;

  // Color of the padding. If unset, will pad using average color of the input
  // image.
  repeated float pad_color = 3;
}

251
252
253
// Randomly crops an image followed by a random pad.
message RandomCropPadImage {
  // Cropping operation must cover at least one box by this fraction.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
254
  optional float min_object_covered = 1 [default = 1.0];
255
256

  // Aspect ratio bounds of image after cropping operation.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
257
258
  optional float min_aspect_ratio = 2 [default = 0.75];
  optional float max_aspect_ratio = 3 [default = 1.33];
259
260

  // Allowed area ratio of image after cropping operation.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
261
262
  optional float min_area = 4 [default = 0.1];
  optional float max_area = 5 [default = 1.0];
263
264
265
266

  // Minimum overlap threshold of cropped boxes to keep in new image. If the
  // ratio between a cropped bounding box and the original is less than this
  // value, it is removed from the new image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
267
  optional float overlap_thresh = 6 [default = 0.3];
268

269
  // Whether to clip the boxes to the cropped image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
270
  optional bool clip_boxes = 11 [default = true];
271

272
  // Probability of keeping the original image during the crop operation.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
273
  optional float random_coef = 7 [default = 0.0];
274
275
276
277
278
279
280
281

  // Maximum dimensions for padded image. If unset, will use double the original
  // image dimension as a lower bound. Both of the following fields should be
  // length 2.
  repeated float min_padded_size_ratio = 8;
  repeated float max_padded_size_ratio = 9;

  // Color of the padding. If unset, will pad using average color of the input
282
  // image. This field should be of length 3.
283
284
285
286
287
288
  repeated float pad_color = 10;
}

// Randomly crops an iamge to a given aspect ratio.
message RandomCropToAspectRatio {
  // Aspect ratio.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
289
  optional float aspect_ratio = 1 [default = 1.0];
290
291
292
293

  // Minimum overlap threshold of cropped boxes to keep in new image. If the
  // ratio between a cropped bounding box and the original is less than this
  // value, it is removed from the new image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
294
  optional float overlap_thresh = 2 [default = 0.3];
295
296

  // Whether to clip the boxes to the cropped image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
297
  optional bool clip_boxes = 3 [default = true];
298
299
300
301
302
}

// Randomly adds black square patches to an image.
message RandomBlackPatches {
  // The maximum number of black patches to add.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
303
  optional int32 max_black_patches = 1 [default = 10];
304
305

  // The probability of a black patch being added to an image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
306
  optional float probability = 2 [default = 0.5];
307
308
309

  // Ratio between the dimension of the black patch to the minimum dimension of
  // the image (patch_width = patch_height = min(image_height, image_width)).
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
310
  optional float size_to_image_ratio = 3 [default = 0.1];
311
312
313
314
}

// Randomly resizes the image up to [target_height, target_width].
message RandomResizeMethod {
315
316
  optional int32 target_height = 1;
  optional int32 target_width = 2;
317
318
}

319
320
321
322
323
// Converts the RGB image to a grayscale image. This also converts the image
// depth from 3 to 1, unlike RandomRGBtoGray which does not change the image
// depth.
message RGBtoGray {}

324
// Scales boxes from normalized coordinates to pixel coordinates.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
325
message ScaleBoxesToPixelCoordinates {}
326
327
328
329
330
331

// Resizes images to [new_height, new_width].
message ResizeImage {
  optional int32 new_height = 1;
  optional int32 new_width = 2;
  enum Method {
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
332
333
334
335
    AREA = 1;
    BICUBIC = 2;
    BILINEAR = 3;
    NEAREST_NEIGHBOR = 4;
336
  }
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
337
  optional Method method = 3 [default = BILINEAR];
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
}

// Normalizes an image by subtracting a mean from each channel.
message SubtractChannelMean {
  // The mean to subtract from each channel. Should be of same dimension of
  // channels in the input image.
  repeated float means = 1;
}

message SSDRandomCropOperation {
  // Cropped image must cover at least this fraction of one original bounding
  // box.
  optional float min_object_covered = 1;

  // The aspect ratio of the cropped image must be within the range of
  // [min_aspect_ratio, max_aspect_ratio].
  optional float min_aspect_ratio = 2;
  optional float max_aspect_ratio = 3;

  // The area of the cropped image must be within the range of
  // [min_area, max_area].
  optional float min_area = 4;
  optional float max_area = 5;

  // Cropped box area ratio must be above this threhold to be kept.
  optional float overlap_thresh = 6;

365
  // Whether to clip the boxes to the cropped image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
366
  optional bool clip_boxes = 8 [default = true];
367

368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
  // Probability a crop operation is skipped.
  optional float random_coef = 7;
}

// Randomly crops a image according to:
//     Liu et al., SSD: Single shot multibox detector.
// This preprocessing step defines multiple SSDRandomCropOperations. Only one
// operation (chosen at random) is actually performed on an image.
message SSDRandomCrop {
  repeated SSDRandomCropOperation operations = 1;
}

message SSDRandomCropPadOperation {
  // Cropped image must cover at least this fraction of one original bounding
  // box.
  optional float min_object_covered = 1;

  // The aspect ratio of the cropped image must be within the range of
  // [min_aspect_ratio, max_aspect_ratio].
  optional float min_aspect_ratio = 2;
  optional float max_aspect_ratio = 3;

  // The area of the cropped image must be within the range of
  // [min_area, max_area].
  optional float min_area = 4;
  optional float max_area = 5;

  // Cropped box area ratio must be above this threhold to be kept.
  optional float overlap_thresh = 6;

398
  // Whether to clip the boxes to the cropped image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
399
  optional bool clip_boxes = 13 [default = true];
400

401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
  // Probability a crop operation is skipped.
  optional float random_coef = 7;

  // Min ratio of padded image height and width to the input image's height and
  // width. Two entries per operation.
  repeated float min_padded_size_ratio = 8;

  // Max ratio of padded image height and width to the input image's height and
  // width. Two entries per operation.
  repeated float max_padded_size_ratio = 9;

  // Padding color.
  optional float pad_color_r = 10;
  optional float pad_color_g = 11;
  optional float pad_color_b = 12;
}

// Randomly crops and pads an image according to:
//     Liu et al., SSD: Single shot multibox detector.
// This preprocessing step defines multiple SSDRandomCropPadOperations. Only one
// operation (chosen at random) is actually performed on an image.
message SSDRandomCropPad {
  repeated SSDRandomCropPadOperation operations = 1;
}

message SSDRandomCropFixedAspectRatioOperation {
  // Cropped image must cover at least this fraction of one original bounding
  // box.
  optional float min_object_covered = 1;

  // The area of the cropped image must be within the range of
  // [min_area, max_area].
  optional float min_area = 4;
  optional float max_area = 5;

  // Cropped box area ratio must be above this threhold to be kept.
  optional float overlap_thresh = 6;

439
  // Whether to clip the boxes to the cropped image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
440
  optional bool clip_boxes = 8 [default = true];
441

442
443
444
445
446
447
448
449
450
451
452
453
454
  // Probability a crop operation is skipped.
  optional float random_coef = 7;
}

// Randomly crops a image to a fixed aspect ratio according to:
//     Liu et al., SSD: Single shot multibox detector.
// Multiple SSDRandomCropFixedAspectRatioOperations are defined by this
// preprocessing step. Only one operation (chosen at random) is actually
// performed on an image.
message SSDRandomCropFixedAspectRatio {
  repeated SSDRandomCropFixedAspectRatioOperation operations = 1;

  // Aspect ratio to crop to. This value is used for all crop operations.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
455
  optional float aspect_ratio = 2 [default = 1.0];
456
}
Vivek Rathod's avatar
Vivek Rathod committed
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475

message SSDRandomCropPadFixedAspectRatioOperation {
  // Cropped image must cover at least this fraction of one original bounding
  // box.
  optional float min_object_covered = 1;

  // The aspect ratio of the cropped image must be within the range of
  // [min_aspect_ratio, max_aspect_ratio].
  optional float min_aspect_ratio = 2;
  optional float max_aspect_ratio = 3;

  // The area of the cropped image must be within the range of
  // [min_area, max_area].
  optional float min_area = 4;
  optional float max_area = 5;

  // Cropped box area ratio must be above this threhold to be kept.
  optional float overlap_thresh = 6;

476
  // Whether to clip the boxes to the cropped image.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
477
  optional bool clip_boxes = 8 [default = true];
478

Vivek Rathod's avatar
Vivek Rathod committed
479
480
481
482
483
484
485
486
487
488
489
490
491
  // Probability a crop operation is skipped.
  optional float random_coef = 7;
}

// Randomly crops and pads an image to a fixed aspect ratio according to:
//     Liu et al., SSD: Single shot multibox detector.
// Multiple SSDRandomCropPadFixedAspectRatioOperations are defined by this
// preprocessing step. Only one operation (chosen at random) is actually
// performed on an image.
message SSDRandomCropPadFixedAspectRatio {
  repeated SSDRandomCropPadFixedAspectRatioOperation operations = 1;

  // Aspect ratio to pad to. This value is used for all crop and pad operations.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
492
  optional float aspect_ratio = 2 [default = 1.0];
493
494
495
496
497
498
499
500

  // Min ratio of padded image height and width to the input image's height and
  // width. Two entries per operation.
  repeated float min_padded_size_ratio = 3;

  // Max ratio of padded image height and width to the input image's height and
  // width. Two entries per operation.
  repeated float max_padded_size_ratio = 4;
Vivek Rathod's avatar
Vivek Rathod committed
501
}
502
503
504
505
506

// Converts class logits to softmax optionally scaling the values by temperature
// first.
message ConvertClassLogitsToSoftmax {
  // Scale to use on logits before applying softmax.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
507
  optional float temperature = 1 [default = 1.0];
508
}
509
510
511
512
513
514
515
516

// Randomly concatenates the image with itself horizontally and/or vertically.
message RandomSelfConcatImage {
  // Probability of concatenating the image vertically.
  optional float concat_vertical_probability = 1 [default = 0.1];
  // Probability of concatenating the image horizontally.
  optional float concat_horizontal_probability = 2 [default = 0.1];
}
pkulzc's avatar
pkulzc committed
517
518
519
520

// Apply an Autoaugment policy to the image and bounding boxes.
message AutoAugmentImage {
  // What AutoAugment policy to apply to the Image
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
521
  optional string policy_name = 1 [default = "v0"];
pkulzc's avatar
pkulzc committed
522
523
524
525
526
527
528
529
530
531
532
}

// Randomly drops ground truth boxes for a label with some probability.
message DropLabelProbabilistically {
  // The label that should be dropped. This corresponds to one of the entries
  // in the label map.
  optional int32 label = 1;
  // Probability of dropping the label.
  optional float drop_probability = 2 [default = 1.0];
}

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
533
// Remap a set of labels to a new label.
pkulzc's avatar
pkulzc committed
534
message RemapLabels {
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
535
  // Labels to be remapped.
pkulzc's avatar
pkulzc committed
536
537
538
539
  repeated int32 original_labels = 1;
  // Label to map to.
  optional int32 new_label = 2;
}
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579

// Applies a jpeg encoding with a random quality factor.
message RandomJpegQuality {
  // Probability of keeping the original image.
  optional float random_coef = 1 [default = 0.0];

  // Minimum jpeg quality to use.
  optional int32 min_jpeg_quality = 2 [default = 0];

  // Maximum jpeg quality to use.
  optional int32 max_jpeg_quality = 3 [default = 100];
}

// Randomly shrinks image (keeping aspect ratio) to a target number of pixels.
// If the image contains less than the chosen target number of pixels, it will
// not be changed.
message RandomDownscaleToTargetPixels {
  // Probability of keeping the original image.
  optional float random_coef = 1 [default = 0.0];

  // The target number of pixels will be chosen to be in the range
  // [min_target_pixels, max_target_pixels]
  optional int32 min_target_pixels = 2 [default = 300000];
  optional int32 max_target_pixels = 3 [default = 500000];
}

message RandomPatchGaussian {
  // Probability of keeping the original image.
  optional float random_coef = 1 [default = 0.0];

  // The patch size will be chosen to be in the range
  // [min_patch_size, max_patch_size).
  optional int32 min_patch_size = 2 [default = 1];
  optional int32 max_patch_size = 3 [default = 250];

  // The standard deviation of the gaussian noise applied within the patch will
  // be chosen to be in the range [min_gaussian_stddev, max_gaussian_stddev).
  optional float min_gaussian_stddev = 4 [default = 0.0];
  optional float max_gaussian_stddev = 5 [default = 1.0];
}
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594

// Extract a square sized crop from an image whose side length is sampled by
// randomly scaling the maximum spatial dimension of the image. If part of the
// crop falls outside the image, it is filled with zeros.
// The augmentation is borrowed from [1]
// [1]: https://arxiv.org/abs/1904.07850
message RandomSquareCropByScale {
  // The maximum size of the border. The border defines distance in pixels to
  // the image boundaries that will not be considered as a center of a crop.
  // To make sure that the border does not go over the center of the image,
  // we chose the border value by computing the minimum k, such that
  // (max_border / (2**k)) < image_dimension/2
  optional int32 max_border = 1 [default = 128];

  // The minimum and maximum values of scale.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
595
596
  optional float scale_min = 2 [default = 0.6];
  optional float scale_max = 3 [default = 1.3];
597
598
599

  // The number of discrete scale values to randomly sample between
  // [min_scale, max_scale]
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
600
  optional int32 num_scales = 4 [default = 8];
601
}
602
603
604
605
606
607
608
609
610
611
612
613
614
615

// Randomly scale, crop, and then pad an image to the desired square output
// dimensions. Specifically, this method first samples a random_scale factor
// from a uniform distribution between scale_min and scale_max, and then resizes
// the image such that it's maximum dimension is (output_size * random_scale).
// Secondly, a square output_size crop is extracted from the resized image, and
// finally the cropped region is padded to the desired square output_size.
// The augmentation is borrowed from [1]
// [1]: https://arxiv.org/abs/1911.09070
message RandomScaleCropAndPadToSquare {
  // The (square) output image size
  optional int32 output_size = 1 [default = 512];

  // The minimum and maximum values from which to sample the random scale.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
616
617
  optional float scale_min = 2 [default = 0.1];
  optional float scale_max = 3 [default = 2.0];
618
}
619
620
621

// Adjusts the gamma of the image using the specified gamma and gain values.
message AdjustGamma {
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
622
623
  optional float gamma = 1 [default = 1.0];
  optional float gain = 2 [default = 1.0];
624
}
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
625