"gallery/assets/vscode:/vscode.git/clone" did not exist on "c786d7550a8ee840d1ea7a0fcb44feba5c39e3ef"
Commit 1f579e0e authored by Kaushik Shivakumar's avatar Kaushik Shivakumar
Browse files

fix suggestions in utils

parent 98d9f3b8
...@@ -200,6 +200,8 @@ def make_sequence_example(dataset_name, ...@@ -200,6 +200,8 @@ def make_sequence_example(dataset_name,
detection_scores: (Optional) A list (with num_frames_elements) of detection_scores: (Optional) A list (with num_frames_elements) of
[num_boxes_i] numpy float32 arrays holding predicted object scores for [num_boxes_i] numpy float32 arrays holding predicted object scores for
each frame. each frame.
use_strs_for_source_id: (Optional) Whether to write the source IDs as strings
rather than byte lists of characters.
Returns: Returns:
A tf.train.SequenceExample. A tf.train.SequenceExample.
......
...@@ -104,12 +104,12 @@ class SeqExampleUtilTest(tf.test.TestCase): ...@@ -104,12 +104,12 @@ class SeqExampleUtilTest(tf.test.TestCase):
source_ids) source_ids)
def test_make_labeled_example(self): def test_make_labeled_example(self):
num_frames = 2 num_frames = 3
image_height = 100 image_height = 100
image_width = 200 image_width = 200
dataset_name = b'unlabeled_dataset' dataset_name = b'unlabeled_dataset'
video_id = b'video_000' video_id = b'video_000'
labels = [b'dog', b'cat'] labels = [b'dog', b'cat', b'wolf']
images = tf.cast(tf.random.uniform( images = tf.cast(tf.random.uniform(
[num_frames, image_height, image_width, 3], [num_frames, image_height, image_width, 3],
maxval=256, maxval=256,
...@@ -117,8 +117,8 @@ class SeqExampleUtilTest(tf.test.TestCase): ...@@ -117,8 +117,8 @@ class SeqExampleUtilTest(tf.test.TestCase):
images_list = tf.unstack(images, axis=0) images_list = tf.unstack(images, axis=0)
encoded_images_list = [tf.io.encode_jpeg(image) for image in images_list] encoded_images_list = [tf.io.encode_jpeg(image) for image in images_list]
encoded_images = self.materialize_tensors(encoded_images_list) encoded_images = self.materialize_tensors(encoded_images_list)
timestamps = [100000, 110000] timestamps = [100000, 110000, 120000]
is_annotated = [1, 0] is_annotated = [1, 0, 1]
bboxes = [ bboxes = [
np.array([[0., 0., 0., 0.], np.array([[0., 0., 0., 0.],
[0., 0., 1., 1.]], dtype=np.float32), [0., 0., 1., 1.]], dtype=np.float32),
...@@ -127,6 +127,7 @@ class SeqExampleUtilTest(tf.test.TestCase): ...@@ -127,6 +127,7 @@ class SeqExampleUtilTest(tf.test.TestCase):
] ]
label_strings = [ label_strings = [
np.array(labels), np.array(labels),
np.array([]),
np.array([]) np.array([])
] ]
......
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