def testBuildClassificationNetwork(self): batch_size = 5 num_frames = 64 height, width = 224, 224 num_classes = 1000 inputs = tf.random.uniform((batch_size, num_frames, height, width, 3)) logits, end_points = s3dg.s3dg(inputs, num_classes) self.assertTrue(logits.op.name.startswith('InceptionV1/Logits')) self.assertListEqual(logits.get_shape().as_list(), [batch_size, num_classes]) self.assertTrue('Predictions' in end_points) self.assertListEqual(end_points['Predictions'].get_shape().as_list(), [batch_size, num_classes])
def testBuildClassificationNetwork(self): batch_size = 5 num_frames = 64 height, width = 224, 224 num_classes = 1000 inputs = tf.random_uniform((batch_size, num_frames, height, width, 3)) logits, end_points = s3dg.s3dg(inputs, num_classes) self.assertTrue(logits.op.name.startswith('InceptionV1/Logits')) self.assertListEqual(logits.get_shape().as_list(), [batch_size, num_classes]) self.assertTrue('Predictions' in end_points) self.assertListEqual(end_points['Predictions'].get_shape().as_list(), [batch_size, num_classes])
def testEvaluation(self): batch_size = 2 num_frames = 64 height, width = 224, 224 num_classes = 1000 eval_inputs = tf.random.uniform( (batch_size, num_frames, height, width, 3)) logits, _ = s3dg.s3dg(eval_inputs, num_classes, is_training=False) predictions = tf.argmax(input=logits, axis=1) with self.test_session() as sess: sess.run(tf.global_variables_initializer()) output = sess.run(predictions) self.assertEquals(output.shape, (batch_size, ))
def testEvaluation(self): batch_size = 2 num_frames = 64 height, width = 224, 224 num_classes = 1000 eval_inputs = tf.random_uniform((batch_size, num_frames, height, width, 3)) logits, _ = s3dg.s3dg(eval_inputs, num_classes, is_training=False) predictions = tf.argmax(logits, 1) with self.test_session() as sess: sess.run(tf.global_variables_initializer()) output = sess.run(predictions) self.assertEquals(output.shape, (batch_size,))