message TransformationParameter {
// For data pre-processing, we can do simple scaling and subtracting the
// data mean, if provided. Note that the mean subtraction is always carried
// out before scaling.
optional float scale = 1 [default = 1];
// Specify if we want to randomly mirror data.
optional bool mirror = 2 [default = false];
// Specify if we would like to randomly crop an image.
optional uint32 crop_size = 3 [default = 0];
// mean_file and mean_value cannot be specified at the same time
optional string mean_file = 4;
// if specified can be repeated once (would subtract it from all the channels)
// or can be repeated the same number of times as channels
// (would subtract them from the corresponding channel)
repeated float mean_value = 5;
// Force the decoded image to have 3 color channels.
optional bool force_color = 6 [default = false];
// Force the decoded image to have 1 color channels.
optional bool force_gray = 7 [default = false];
// Resize policy
optional ResizeParameter resize_param = 8;
// Noise policy
optional NoiseParameter noise_param = 9;
// Constraint for emitting the annotation after transformation.
optional EmitConstraint emit_constraint = 10;
optional uint32 crop_h = 11 [default = 0];
optional uint32 crop_w = 12 [default = 0];
// Distortion policy
optional DistortionParameter distort_param = 13;
// Expand policy
optional ExpansionParameter expand_param = 14;
// TensorFlow data pre-processing
optional float crop_fraction = 15 [default = 0];
// if the number of resize is 1 preserve the original aspect ratio
repeated uint32 resize = 16;
// less useful
optional bool standardization = 17 [default = false];
repeated TransformOp transform_op = 18;
}
ResizeParameter定义:
/ Message that stores parameters used by data transformer for resize policy
message ResizeParameter {
//Probability of using this resize policy
optional float prob = 1 [default = 1];
enum Resize_mode {
WARP = 1;
FIT_SMALL_SIZE = 2;
FIT_LARGE_SIZE_AND_PAD = 3;
}
optional Resize_mode resize_mode = 2 [default = WARP];
optional uint32 height = 3 [default = 0];
optional uint32 width = 4 [default = 0];
// A parameter used to update bbox in FIT_SMALL_SIZE mode.
optional uint32 height_scale = 8 [default = 0];
optional uint32 width_scale = 9 [default = 0];
enum Pad_mode {
CONSTANT = 1;
MIRRORED = 2;
REPEAT_NEAREST = 3;
}
// Padding mode for BE_SMALL_SIZE_AND_PAD mode and object centering
optional Pad_mode pad_mode = 5 [default = CONSTANT];
// if specified can be repeated once (would fill all the channels)
// or can be repeated the same number of times as channels
// (would use it them to the corresponding channel)
repeated float pad_value = 6;
enum Interp_mode { //Same as in OpenCV
LINEAR = 1;
AREA = 2;
NEAREST = 3;
CUBIC = 4;
LANCZOS4 = 5;
}
//interpolation for for resizing
repeated Interp_mode interp_mode = 7;
}