"...text-generation-inference.git" did not exist on "7aad7450b7bc758d69b4ab9df7c329a51aad1fda"
Commit 3ab72765 authored by Derek Chow's avatar Derek Chow
Browse files

snake_case Decode function

parent 58417e76
...@@ -60,6 +60,6 @@ def build(input_reader_config): ...@@ -60,6 +60,6 @@ def build(input_reader_config):
capacity=input_reader_config.queue_capacity, capacity=input_reader_config.queue_capacity,
min_after_dequeue=input_reader_config.min_after_dequeue) min_after_dequeue=input_reader_config.min_after_dequeue)
return tf_example_decoder.TfExampleDecoder().Decode(string_tensor) return tf_example_decoder.TfExampleDecoder().decode(string_tensor)
raise ValueError('Unsupported input_reader_config.') raise ValueError('Unsupported input_reader_config.')
...@@ -26,9 +26,8 @@ class DataDecoder(object): ...@@ -26,9 +26,8 @@ class DataDecoder(object):
"""Interface for data decoders.""" """Interface for data decoders."""
__metaclass__ = ABCMeta __metaclass__ = ABCMeta
# TODO: snake_case this method.
@abstractmethod @abstractmethod
def Decode(self, data): def decode(self, data):
"""Return a single image and associated labels. """Return a single image and associated labels.
Args: Args:
......
...@@ -82,7 +82,7 @@ class TfExampleDecoder(data_decoder.DataDecoder): ...@@ -82,7 +82,7 @@ class TfExampleDecoder(data_decoder.DataDecoder):
slim_example_decoder.Tensor('image/segmentation/object/class')), slim_example_decoder.Tensor('image/segmentation/object/class')),
} }
def Decode(self, tf_example_string_tensor): def decode(self, tf_example_string_tensor):
"""Decodes serialized tensorflow example and returns a tensor dictionary. """Decodes serialized tensorflow example and returns a tensor dictionary.
Args: Args:
......
...@@ -64,7 +64,7 @@ class TfExampleDecoderTest(tf.test.TestCase): ...@@ -64,7 +64,7 @@ class TfExampleDecoderTest(tf.test.TestCase):
})).SerializeToString() })).SerializeToString()
example_decoder = tf_example_decoder.TfExampleDecoder() example_decoder = tf_example_decoder.TfExampleDecoder()
tensor_dict = example_decoder.Decode(tf.convert_to_tensor(example)) tensor_dict = example_decoder.decode(tf.convert_to_tensor(example))
self.assertAllEqual((tensor_dict[fields.InputDataFields.image]. self.assertAllEqual((tensor_dict[fields.InputDataFields.image].
get_shape().as_list()), [None, None, 3]) get_shape().as_list()), [None, None, 3])
...@@ -84,7 +84,7 @@ class TfExampleDecoderTest(tf.test.TestCase): ...@@ -84,7 +84,7 @@ class TfExampleDecoderTest(tf.test.TestCase):
})).SerializeToString() })).SerializeToString()
example_decoder = tf_example_decoder.TfExampleDecoder() example_decoder = tf_example_decoder.TfExampleDecoder()
tensor_dict = example_decoder.Decode(tf.convert_to_tensor(example)) tensor_dict = example_decoder.decode(tf.convert_to_tensor(example))
with self.test_session() as sess: with self.test_session() as sess:
tensor_dict = sess.run(tensor_dict) tensor_dict = sess.run(tensor_dict)
...@@ -103,7 +103,7 @@ class TfExampleDecoderTest(tf.test.TestCase): ...@@ -103,7 +103,7 @@ class TfExampleDecoderTest(tf.test.TestCase):
})).SerializeToString() })).SerializeToString()
example_decoder = tf_example_decoder.TfExampleDecoder() example_decoder = tf_example_decoder.TfExampleDecoder()
tensor_dict = example_decoder.Decode(tf.convert_to_tensor(example)) tensor_dict = example_decoder.decode(tf.convert_to_tensor(example))
self.assertAllEqual((tensor_dict[fields.InputDataFields.image]. self.assertAllEqual((tensor_dict[fields.InputDataFields.image].
get_shape().as_list()), [None, None, 3]) get_shape().as_list()), [None, None, 3])
...@@ -130,7 +130,7 @@ class TfExampleDecoderTest(tf.test.TestCase): ...@@ -130,7 +130,7 @@ class TfExampleDecoderTest(tf.test.TestCase):
})).SerializeToString() })).SerializeToString()
example_decoder = tf_example_decoder.TfExampleDecoder() example_decoder = tf_example_decoder.TfExampleDecoder()
tensor_dict = example_decoder.Decode(tf.convert_to_tensor(example)) tensor_dict = example_decoder.decode(tf.convert_to_tensor(example))
self.assertAllEqual((tensor_dict[fields.InputDataFields.groundtruth_boxes]. self.assertAllEqual((tensor_dict[fields.InputDataFields.groundtruth_boxes].
get_shape().as_list()), [None, 4]) get_shape().as_list()), [None, 4])
...@@ -153,7 +153,7 @@ class TfExampleDecoderTest(tf.test.TestCase): ...@@ -153,7 +153,7 @@ class TfExampleDecoderTest(tf.test.TestCase):
})).SerializeToString() })).SerializeToString()
example_decoder = tf_example_decoder.TfExampleDecoder() example_decoder = tf_example_decoder.TfExampleDecoder()
tensor_dict = example_decoder.Decode(tf.convert_to_tensor(example)) tensor_dict = example_decoder.decode(tf.convert_to_tensor(example))
self.assertAllEqual((tensor_dict[ self.assertAllEqual((tensor_dict[
fields.InputDataFields.groundtruth_classes].get_shape().as_list()), fields.InputDataFields.groundtruth_classes].get_shape().as_list()),
...@@ -176,7 +176,7 @@ class TfExampleDecoderTest(tf.test.TestCase): ...@@ -176,7 +176,7 @@ class TfExampleDecoderTest(tf.test.TestCase):
})).SerializeToString() })).SerializeToString()
example_decoder = tf_example_decoder.TfExampleDecoder() example_decoder = tf_example_decoder.TfExampleDecoder()
tensor_dict = example_decoder.Decode(tf.convert_to_tensor(example)) tensor_dict = example_decoder.decode(tf.convert_to_tensor(example))
self.assertAllEqual((tensor_dict[fields.InputDataFields.groundtruth_area]. self.assertAllEqual((tensor_dict[fields.InputDataFields.groundtruth_area].
get_shape().as_list()), [None]) get_shape().as_list()), [None])
...@@ -197,7 +197,7 @@ class TfExampleDecoderTest(tf.test.TestCase): ...@@ -197,7 +197,7 @@ class TfExampleDecoderTest(tf.test.TestCase):
})).SerializeToString() })).SerializeToString()
example_decoder = tf_example_decoder.TfExampleDecoder() example_decoder = tf_example_decoder.TfExampleDecoder()
tensor_dict = example_decoder.Decode(tf.convert_to_tensor(example)) tensor_dict = example_decoder.decode(tf.convert_to_tensor(example))
self.assertAllEqual((tensor_dict[ self.assertAllEqual((tensor_dict[
fields.InputDataFields.groundtruth_is_crowd].get_shape().as_list()), fields.InputDataFields.groundtruth_is_crowd].get_shape().as_list()),
...@@ -220,7 +220,7 @@ class TfExampleDecoderTest(tf.test.TestCase): ...@@ -220,7 +220,7 @@ class TfExampleDecoderTest(tf.test.TestCase):
})).SerializeToString() })).SerializeToString()
example_decoder = tf_example_decoder.TfExampleDecoder() example_decoder = tf_example_decoder.TfExampleDecoder()
tensor_dict = example_decoder.Decode(tf.convert_to_tensor(example)) tensor_dict = example_decoder.decode(tf.convert_to_tensor(example))
self.assertAllEqual((tensor_dict[ self.assertAllEqual((tensor_dict[
fields.InputDataFields.groundtruth_difficult].get_shape().as_list()), fields.InputDataFields.groundtruth_difficult].get_shape().as_list()),
...@@ -263,7 +263,7 @@ class TfExampleDecoderTest(tf.test.TestCase): ...@@ -263,7 +263,7 @@ class TfExampleDecoderTest(tf.test.TestCase):
'image/segmentation/object/class': self._Int64Feature( 'image/segmentation/object/class': self._Int64Feature(
instance_segmentation_classes)})).SerializeToString() instance_segmentation_classes)})).SerializeToString()
example_decoder = tf_example_decoder.TfExampleDecoder() example_decoder = tf_example_decoder.TfExampleDecoder()
tensor_dict = example_decoder.Decode(tf.convert_to_tensor(example)) tensor_dict = example_decoder.decode(tf.convert_to_tensor(example))
self.assertAllEqual(( self.assertAllEqual((
tensor_dict[fields.InputDataFields.groundtruth_instance_masks]. tensor_dict[fields.InputDataFields.groundtruth_instance_masks].
......
...@@ -101,7 +101,7 @@ def freeze_graph_with_def_protos( ...@@ -101,7 +101,7 @@ def freeze_graph_with_def_protos(
def _tf_example_input_placeholder(): def _tf_example_input_placeholder():
tf_example_placeholder = tf.placeholder( tf_example_placeholder = tf.placeholder(
tf.string, shape=[], name='tf_example') tf.string, shape=[], name='tf_example')
tensor_dict = tf_example_decoder.TfExampleDecoder().Decode( tensor_dict = tf_example_decoder.TfExampleDecoder().decode(
tf_example_placeholder) tf_example_placeholder)
image = tensor_dict[fields.InputDataFields.image] image = tensor_dict[fields.InputDataFields.image]
return tf.expand_dims(image, axis=0) return tf.expand_dims(image, axis=0)
......
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