File size: 4,047 Bytes
0b8359d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
syntax = "proto2";

package object_detection.protos;

// Configuration proto for image resizing operations.
// See builders/image_resizer_builder.py for details.
message ImageResizer {
  oneof image_resizer_oneof {
    KeepAspectRatioResizer keep_aspect_ratio_resizer = 1;
    FixedShapeResizer fixed_shape_resizer = 2;
    IdentityResizer identity_resizer = 3;
    ConditionalShapeResizer conditional_shape_resizer = 4;
    PadToMultipleResizer pad_to_multiple_resizer = 5;
  }
}

// Enumeration type for image resizing methods provided in TensorFlow.
enum ResizeType {
  BILINEAR = 0; // Corresponds to tf.image.ResizeMethod.BILINEAR
  NEAREST_NEIGHBOR = 1; // Corresponds to tf.image.ResizeMethod.NEAREST_NEIGHBOR
  BICUBIC = 2; // Corresponds to tf.image.ResizeMethod.BICUBIC
  AREA = 3; // Corresponds to tf.image.ResizeMethod.AREA
}

message IdentityResizer {
}

// Configuration proto for image resizer that keeps aspect ratio.
message KeepAspectRatioResizer {
  // Desired size of the smaller image dimension in pixels.
  optional int32 min_dimension = 1 [default = 600];

  // Desired size of the larger image dimension in pixels.
  optional int32 max_dimension = 2 [default = 1024];

  // Desired method when resizing image.
  optional ResizeType resize_method = 3 [default = BILINEAR];

  // Whether to pad the image with zeros so the output spatial size is
  // [max_dimension, max_dimension]. Note that the zeros are padded to the
  // bottom and the right of the resized image.
  optional bool pad_to_max_dimension = 4 [default = false];

  // Whether to also resize the image channels from 3 to 1 (RGB to grayscale).
  optional bool convert_to_grayscale = 5 [default = false];

  // Per-channel pad value. This is only used when pad_to_max_dimension is True.
  // If unspecified, a default pad value of 0 is applied to all channels.
  repeated float per_channel_pad_value = 6;
}

// Configuration proto for image resizer that resizes to a fixed shape.
message FixedShapeResizer {
  // Desired height of image in pixels.
  optional int32 height = 1 [default = 300];

  // Desired width of image in pixels.
  optional int32 width = 2 [default = 300];

  // Desired method when resizing image.
  optional ResizeType resize_method = 3 [default = BILINEAR];

  // Whether to also resize the image channels from 3 to 1 (RGB to grayscale).
  optional bool convert_to_grayscale = 4 [default = false];
}

// Configuration proto for image resizer that resizes only if input image height
// or width is greater or smaller than a certain size.
// Aspect ratio is maintained.
message ConditionalShapeResizer {

  // Enumeration for the condition on which to resize an image.
  enum ResizeCondition {
    INVALID = 0; // Default value.
    GREATER = 1; // Resizes image if a dimension is greater than specified size.
    SMALLER = 2; // Resizes image if a dimension is smaller than specified size.
  }

  // Condition which must be true to resize the image.
  optional ResizeCondition condition = 1 [default = GREATER];

  // Threshold for the image size. If any image dimension is above or below this
  // (as specified by condition) the image will be resized so that it meets the
  // threshold.
  optional int32 size_threshold = 2 [default = 300];

  // Desired method when resizing image.
  optional ResizeType resize_method = 3 [default = BILINEAR];

  // Whether to also resize the image channels from 3 to 1 (RGB to grayscale).
  optional bool convert_to_grayscale = 4 [default = false];

}


// An image resizer which resizes inputs by zero padding them such that their
// spatial dimensions are divisible by a specified multiple. This is useful
// when you want to concatenate or compare the input to an output of a
// fully convolutional network.
message PadToMultipleResizer {

  // The multiple to which the spatial dimensions will be padded to.
  optional int32 multiple = 1 [default = 1];

  // Whether to also resize the image channels from 3 to 1 (RGB to grayscale).
  optional bool convert_to_grayscale = 4 [default = false];

}