Commit c636ea33 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower
Browse files

Don't require image/source_id feature if regenerate_source_id is set.

PiperOrigin-RevId: 395539392
parent dc6c341d
......@@ -38,7 +38,6 @@ class TfExampleDecoder(decoder.Decoder):
self._regenerate_source_id = regenerate_source_id
self._keys_to_features = {
'image/encoded': tf.io.FixedLenFeature((), tf.string),
'image/source_id': tf.io.FixedLenFeature((), tf.string),
'image/height': tf.io.FixedLenFeature((), tf.int64),
'image/width': tf.io.FixedLenFeature((), tf.int64),
'image/object/bbox/xmin': tf.io.VarLenFeature(tf.float32),
......@@ -54,6 +53,10 @@ class TfExampleDecoder(decoder.Decoder):
self._keys_to_features.update({
'image/object/mask': tf.io.VarLenFeature(tf.string),
})
if not regenerate_source_id:
self._keys_to_features.update({
'image/source_id': tf.io.FixedLenFeature((), tf.string),
})
def _decode_image(self, parsed_tensors):
"""Decodes the image and set its static shape."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment