input_reader.proto 5.53 KB
Newer Older
1
2
3
4
syntax = "proto2";

package object_detection.protos;

5
6
import "object_detection/protos/image_resizer.proto";

7
8
9
10
11
12
13
14
15
16
17
18
19
// Configuration proto for defining input readers that generate Object Detection
// Examples from input sources. Input readers are expected to generate a
// dictionary of tensors, with the following fields populated:
//
// 'image': an [image_height, image_width, channels] image tensor that detection
//    will be run on.
// 'groundtruth_classes': a [num_boxes] int32 tensor storing the class
//    labels of detected boxes in the image.
// 'groundtruth_boxes': a [num_boxes, 4] float tensor storing the coordinates of
//    detected boxes in the image.
// 'groundtruth_instance_masks': (Optional), a [num_boxes, image_height,
//    image_width] float tensor storing binary mask of the objects in boxes.

20
21
22
23
24
25
26
// Instance mask format. Note that PNG masks are much more space efficient.
enum InstanceMaskType {
  DEFAULT = 0;          // Default implementation, currently NUMERICAL_MASKS
  NUMERICAL_MASKS = 1;  // [num_masks, H, W] float32 binary masks.
  PNG_MASKS = 2;        // Encoded PNG masks.
}

27
// Next id: 29
28
message InputReader {
29
30
  // Name of input reader. Typically used to describe the dataset that is read
  // by this input reader.
31
  optional string name = 23 [default = ""];
32

33
34
  // Path to StringIntLabelMap pbtxt file specifying the mapping from string
  // labels to integer ids.
35
  optional string label_map_path = 1 [default = ""];
36
37
38

  // Whether data should be processed in the order they are read in, or
  // shuffled randomly.
39
  optional bool shuffle = 2 [default = true];
40

41
  // Buffer size to be used when shuffling.
42
  optional uint32 shuffle_buffer_size = 11 [default = 2048];
43
44
45
46

  // Buffer size to be used when shuffling file names.
  optional uint32 filenames_shuffle_buffer_size = 12 [default = 100];

47
48
  // The number of times a data source is read. If set to zero, the data source
  // will be reused indefinitely.
49
  optional uint32 num_epochs = 5 [default = 0];
50

51
52
53
54
  // Integer representing how often an example should be sampled. To feed
  // only 1/3 of your data into your model, set `sample_1_of_n_examples` to 3.
  // This is particularly useful for evaluation, where you might not prefer to
  // evaluate all of your samples.
55
  optional uint32 sample_1_of_n_examples = 22 [default = 1];
56

57
  // Number of file shards to read in parallel.
58
  optional uint32 num_readers = 6 [default = 64];
59
60
61

  // Number of batches to produce in parallel. If this is run on a 2x2 TPU set
  // this to 8.
62
  optional uint32 num_parallel_batches = 19 [default = 8];
63
64
65
66
67
68

  // Number of batches to prefetch. Prefetch decouples input pipeline and
  // model so they can be pipelined resulting in higher throughput. Set this
  // to a small constant and increment linearly until the improvements become
  // marginal or you exceed your cpu memory budget. Setting this to -1,
  // automatically tunes this value for you.
69
  optional int32 num_prefetch_batches = 20 [default = 2];
70

71
  // Maximum number of records to keep in reader queue.
72
  optional uint32 queue_capacity = 3 [default = 2000, deprecated = true];
73
74
75

  // Minimum number of records to keep in reader queue. A large value is needed
  // to generate a good random shuffle.
76
  optional uint32 min_after_dequeue = 4 [default = 1000, deprecated = true];
77

78
  // Number of records to read from each reader at once.
79
  optional uint32 read_block_length = 15 [default = 32];
80

81
  // Number of decoded records to prefetch before batching.
82
  optional uint32 prefetch_size = 13 [default = 512, deprecated = true];
83
84

  // Number of parallel decode ops to apply.
85
  optional uint32 num_parallel_map_calls = 14 [default = 64, deprecated = true];
86
87
88
89

  // If positive, TfExampleDecoder will try to decode rasters of additional
  // channels from tf.Examples.
  optional int32 num_additional_channels = 18 [default = 0];
90

91
92
93
  // Number of groundtruth keypoints per object.
  optional uint32 num_keypoints = 16 [default = 0];

94
95
96
97
  // Keypoint weights. These weights can be used to apply per-keypoint loss
  // multipliers. The size of this field should agree with `num_keypoints`.
  repeated float keypoint_type_weight = 26;

98
99
100
  // Maximum number of boxes to pad to during training / evaluation.
  // Set this to at least the maximum amount of boxes in the input data,
  // otherwise some groundtruth boxes may be clipped.
101
  optional int32 max_number_of_boxes = 21 [default = 100];
102

103
104
105
  // Whether to load multiclass scores from the dataset.
  optional bool load_multiclass_scores = 24 [default = false];

106
107
108
  // Whether to load context features from the dataset.
  optional bool load_context_features = 25 [default = false];

109
110
111
  // Whether to load groundtruth instance masks.
  optional bool load_instance_masks = 7 [default = false];

112
113
114
  // Type of instance mask.
  optional InstanceMaskType mask_type = 10 [default = NUMERICAL_MASKS];

115
116
117
118
  // Whether to use the display name when decoding examples. This is only used
  // when mapping class text strings to integers.
  optional bool use_display_name = 17 [default = false];

119
120
121
  // Whether to include the source_id string in the input features.
  optional bool include_source_id = 27 [default = false];

122
123
124
125
  oneof input_reader {
    TFRecordInputReader tf_record_input_reader = 8;
    ExternalInputReader external_input_reader = 9;
  }
126
127


128
129
130
131
}

// An input reader that reads TF Example protos from local TFRecord files.
message TFRecordInputReader {
Vivek Rathod's avatar
Vivek Rathod committed
132
133
  // Path(s) to `TFRecordFile`s.
  repeated string input_path = 1;
134
135
136
137
138
139
140
}

// An externally defined input reader. Users may define an extension to this
// proto to interface their own input readers.
message ExternalInputReader {
  extensions 1 to 999;
}