提交 cdd0347a 编写于 作者: J Jonathan Huang 提交者: TF Object Detection Team

Adds a "drop_remainder" option for input readers to handle "exact" evals when batch_size>1.

PiperOrigin-RevId: 339071313
上级 282adff5
...@@ -242,7 +242,8 @@ def build(input_reader_config, batch_size=None, transform_input_data_fn=None, ...@@ -242,7 +242,8 @@ def build(input_reader_config, batch_size=None, transform_input_data_fn=None,
dataset = dataset_map_fn(dataset, transform_input_data_fn, dataset = dataset_map_fn(dataset, transform_input_data_fn,
batch_size, input_reader_config) batch_size, input_reader_config)
if batch_size: if batch_size:
dataset = dataset.batch(batch_size, drop_remainder=True) dataset = dataset.batch(batch_size,
drop_remainder=input_reader_config.drop_remainder)
dataset = dataset.prefetch(input_reader_config.num_prefetch_batches) dataset = dataset.prefetch(input_reader_config.num_prefetch_batches)
return dataset return dataset
......
...@@ -30,7 +30,7 @@ enum InputType { ...@@ -30,7 +30,7 @@ enum InputType {
TF_SEQUENCE_EXAMPLE = 2; // TfSequenceExample Input TF_SEQUENCE_EXAMPLE = 2; // TfSequenceExample Input
} }
// Next id: 35 // Next id: 36
message InputReader { message InputReader {
// Name of input reader. Typically used to describe the dataset that is read // Name of input reader. Typically used to describe the dataset that is read
// by this input reader. // by this input reader.
...@@ -93,6 +93,9 @@ message InputReader { ...@@ -93,6 +93,9 @@ message InputReader {
// Number of parallel decode ops to apply. // Number of parallel decode ops to apply.
optional uint32 num_parallel_map_calls = 14 [default = 64, deprecated = true]; optional uint32 num_parallel_map_calls = 14 [default = 64, deprecated = true];
// Drop remainder when batch size does not divide dataset size.
optional bool drop_remainder = 35 [default = true];
// If positive, TfExampleDecoder will try to decode rasters of additional // If positive, TfExampleDecoder will try to decode rasters of additional
// channels from tf.Examples. // channels from tf.Examples.
optional int32 num_additional_channels = 18 [default = 0]; optional int32 num_additional_channels = 18 [default = 0];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册