tensorflow/models · error · ValueError
Unrecognized `input_type`
Error message
Unrecognized `input_type`
What it means
Error "Unrecognized `input_type`" thrown in tensorflow/models.
Source
Thrown at official/vision/serving/export_utils.py:53
input_name: A `str` to set the input image name in the signature, if None,
a default name `inputs` will be used.
Returns:
tf.TensorSpec of the input tensor.
"""
if input_type == 'image_tensor':
input_signature = tf.TensorSpec(
shape=[batch_size] + [None] * len(input_image_size) + [num_channels],
dtype=tf.uint8, name=input_name)
elif input_type in ['image_bytes', 'serve_examples', 'tf_example']:
input_signature = tf.TensorSpec(
shape=[batch_size], dtype=tf.string, name=input_name)
elif input_type == 'tflite':
input_signature = tf.TensorSpec(
shape=[1] + input_image_size + [num_channels],
dtype=tf.float32,
name=input_name)
else:
raise ValueError('Unrecognized `input_type`')
return input_signature
def decode_image(encoded_image_bytes: str,
input_image_size: List[int],
num_channels: int = 3,) -> tf.Tensor:
"""Decodes an image bytes to an image tensor.
Use `tf.image.decode_image` to decode an image if input is expected to be 2D
image; otherwise use `tf.io.decode_raw` to convert the raw bytes to tensor
and reshape it to desire shape.
Args:
encoded_image_bytes: An encoded image string to be decoded.
input_image_size: List[int] for the desired input size. This will be used to
infer whether the image is 2d or 3d.
num_channels: `int` for number of image channels.
View on GitHub (pinned to e006f5f0d5)
Solutions
- Set input_type to 'image_tensor', 'image_bytes', or 'tf_example'.
- Check the serving input_type config for typos.
When it happens
Trigger: Thrown at official/vision/serving/export_utils.py:53 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/5f5acfc86484da87.
Report an issue: GitHub.