Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for fixed size input with no-preprocessing for float models #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions research/object_detection/exporter_lib_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,20 @@ def get_true_shapes(input_tensor):

class DetectionFromFloatImageModule(DetectionInferenceModule):
"""Detection Inference Module for float image inputs."""

sig = [tf.TensorSpec(shape=[None, ExportOptions.height, ExportOptions.width, 3],
dtype=tf.float32,
name='input_tensor')]
@tf.function(
input_signature=[
tf.TensorSpec(shape=[None, None, None, 3], dtype=tf.float32)])
input_signature=sig)

def __call__(self, input_tensor):
images, true_shapes = self._preprocess_input(input_tensor, lambda x: x)
if ExportOptions.skip_preprocess:
images = input_tensor
input_shape = tf.shape(input_tensor)
input_shape_slice = tf.slice(input_shape, [1], [3])
true_shapes = tf.expand_dims(input_shape_slice, axis=0)
else:
images, true_shapes = self._preprocess_input(input_tensor, lambda x: x)
return self._run_inference_on_images(images,
true_shapes)

Expand Down