Skip to content

Commit d3c73c2

Browse files
Vighnesh BirodkarTF Object Detection Team
Vighnesh Birodkar
authored and
TF Object Detection Team
committed
Add image_and_boxes_tensor to helper doc string.
PiperOrigin-RevId: 364895608
1 parent f540d47 commit d3c73c2

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

research/object_detection/exporter_lib_v2.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,6 @@ def __call__(self, input_tensor):
208208
_decode_tf_example)
209209
return self._run_inference_on_images(images, true_shapes)
210210

211-
DETECTION_MODULE_MAP = {
212-
'image_tensor': DetectionFromImageModule,
213-
'encoded_image_string_tensor':
214-
DetectionFromEncodedImageModule,
215-
'tf_example': DetectionFromTFExampleModule,
216-
'float_image_tensor': DetectionFromFloatImageModule
217-
}
218-
219211

220212
def export_inference_graph(input_type,
221213
pipeline_config,
@@ -355,6 +347,11 @@ def __call__(self, input_tensor, boxes):
355347
return self._run_segmentation_on_images(input_tensor, boxes)
356348

357349

358-
DETECTION_MODULE_MAP.update({
350+
DETECTION_MODULE_MAP = {
351+
'image_tensor': DetectionFromImageModule,
352+
'encoded_image_string_tensor':
353+
DetectionFromEncodedImageModule,
354+
'tf_example': DetectionFromTFExampleModule,
355+
'float_image_tensor': DetectionFromFloatImageModule,
359356
'image_and_boxes_tensor': DetectionFromImageAndBoxModule,
360-
})
357+
}

research/object_detection/exporter_main_v2.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
* `tf_example`: Accepts a 1-D string tensor of shape [None] containing
3232
serialized TFExample protos. Image resolutions are expected to be the same
3333
if more than 1 image is provided.
34+
* `image_and_boxes_tensor`: Accepts a 4-D image tensor of size
35+
[1, None, None, 3] and a boxes tensor of size [1, None, 4] of normalized
36+
bounding boxes. To be able to support this option, the model needs
37+
to implement a predict_masks_from_boxes method. See the documentation
38+
for DetectionFromImageAndBoxModule for details.
3439
3540
and the following output nodes returned by the model.postprocess(..):
3641
* `num_detections`: Outputs float32 tensors of the form [batch]
@@ -107,7 +112,8 @@
107112

108113
flags.DEFINE_string('input_type', 'image_tensor', 'Type of input node. Can be '
109114
'one of [`image_tensor`, `encoded_image_string_tensor`, '
110-
'`tf_example`, `float_image_tensor`]')
115+
'`tf_example`, `float_image_tensor`, '
116+
'`image_and_boxes_tensor`]')
111117
flags.DEFINE_string('pipeline_config_path', None,
112118
'Path to a pipeline_pb2.TrainEvalPipelineConfig config '
113119
'file.')

0 commit comments

Comments
 (0)