def test_add_context_fn(self): sequence_key = 'image/seq_id' add_context_features = True image_ids_to_keep = 'All' context_fn = add_context_to_examples.GenerateContextFn( sequence_key, add_context_features, image_ids_to_keep) output = context_fn.process(('dummy_key', [ tf.train.Example.FromString(self._create_first_tf_example()), tf.train.Example.FromString(self._create_second_tf_example()) ])) self.assertEqual(len(output), 2) self.assert_context(output)
def test_add_context_fn_output_sequence_example_cliplen(self): sequence_key = 'image/seq_id' add_context_features = True image_ids_to_keep = 'All' context_fn = add_context_to_examples.GenerateContextFn( sequence_key, add_context_features, image_ids_to_keep, output_type='tf_sequence_example', max_clip_length=1) output = context_fn.process(('01', [ tf.train.Example.FromString(self._create_first_tf_example()), tf.train.Example.FromString(self._create_second_tf_example()) ])) self.assertEqual(len(output), 2)