Я использую API обнаружения объектов Tensorflow для обучения модели обнаружения объектов Inception SSD в Cloud ML Engine, и я хочу использовать различные data_augmentation_options
, как указано в файле preprocessor.proto .
В данный момент меня интересует использование операции ssd_random_crop_pad
с изменением min_padded_size_ratio
и max_padded_size_ratio
.
В документации, упомянутой в preprocessor.proto , говорится следующее:
// 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;
А в документации, упомянутой в preprocessor.py , функция определяется какнапример:
def ssd_random_crop_pad(image,
boxes,
labels,
label_scores=None,
multiclass_scores=None,
min_object_covered=(0.1, 0.3, 0.5, 0.7, 0.9, 1.0),
aspect_ratio_range=((0.5, 2.0),) * 6,
area_range=((0.1, 1.0),) * 6,
overlap_thresh=(0.1, 0.3, 0.5, 0.7, 0.9, 1.0),
random_coef=(0.15,) * 6,
min_padded_size_ratio=((1.0, 1.0),) * 6,
max_padded_size_ratio=((2.0, 2.0),) * 6,
pad_color=(None,) * 6,
seed=None,
preprocess_vars_cache=None)
Где аргументы для min_padded_size_ratio
и max_padded_size_ratio
являются кортежем формы (h, w).
Однако, когда я предоставляю эти аргументы в config
файл в указанном ниже формате:
data_augmentation_options {
ssd_random_crop_pad {
operations {
min_padded_size_ratio: (16.0, 16.0)
max_padded_size_ratio: (16.0, 16.0)
random_coef: 0.5
}
}
}
Я сталкиваюсь со следующей ошибкой:
ps-replica-2
Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/root/.local/lib/python2.7/site-packages/object_detection/train.py", line 163, in <module> tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/root/.local/lib/python2.7/site-packages/object_detection/train.py", line 91, in main FLAGS.pipeline_config_path) File "/root/.local/lib/python2.7/site-packages/object_detection/utils/config_util.py", line 43, in get_configs_from_pipeline_file text_format.Merge(proto_str, pipeline_config) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 533, in Merge descriptor_pool=descriptor_pool) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 587, in MergeLines return parser.MergeLines(lines, message) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 620, in MergeLines self._ParseOrMerge(lines, message) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 635, in _ParseOrMerge self._MergeField(tokenizer, message) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 735, in _MergeField merger(tokenizer, message, field) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 823, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 735, in _MergeField merger(tokenizer, message, field) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 823, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 735, in _MergeField merger(tokenizer, message, field) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 823, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 735, in _MergeField merger(tokenizer, message, field) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 823, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 735, in _MergeField merger(tokenizer, message, field) File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 870, in _MergeScalarField value = tokenizer.ConsumeFloat() File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 1201, in ConsumeFloat raise self.ParseError(str(e)) ParseError: 166:31 : Couldn't parse float: (
Может кто-нибудь помочь мне с форматом передать аргументы min_padded_size_ratio
и max_padded_size_ratio
?
Редактировать 1: изменен файл config
со следующими аргументами:
ssd_random_crop_pad {
operations {
min_padded_size_ratio: 16.0
min_padded_size_ratio: 16.0
max_padded_size_ratio: 16.0
max_padded_size_ratio: 16.0
random_coef: 0.5
}
}
Теперь запускается следующая ошибка:
Executor failed to create kernel. Invalid argument: Aspect ratio range must be non-negative: [0, 0]
[[Node: cond/RandomCropImage/SampleDistortedBoundingBox = SampleDistortedBoundingBox[T=DT_INT32, area_range=[0, 0], aspect_ratio_range=[0, 0], max_attempts=100, min_object_covered=0, seed=0, seed2=0, use_image_if_no_bounding_boxes=true, _device="/job:master/replica:0/task:0/cpu:0"](cond/RandomCropImage/Shape, cond/RandomCropImage/ExpandDims)]]