def build_feature_tensor(self): """ Computes the inception tensor Inputs: self.images Outputs: self.inception_output """ self.inception_output = image_embedding.inception_v3( self.images, trainable=self.train_inception, is_training=self.is_training()) # Brandon Trabucco 2018.06.13: attention is a 4 tensor of shape [batch_size, height, width, 1] self.build_attention_tensor( tf.zeros([ tf.shape(self.inception_output)[0], self.config.num_lstm_units * 2 ], dtype=tf.float32)) # Compute a prelimiary context tensor for the image self.build_context_tensor() self.inception_variables = tf.get_collection( tf.GraphKeys.GLOBAL_VARIABLES, scope="InceptionV3")
def testTrainableTrueIsTrainingFalse(self): embeddings = image_embedding.inception_v3(self._images, trainable=True, is_training=False) self.assertEqual([self._batch_size, 2048], embeddings.get_shape().as_list()) self._verifyParameterCounts() self._assertCollectionSize(376, tf.GraphKeys.GLOBAL_VARIABLES) self._assertCollectionSize(188, tf.GraphKeys.TRAINABLE_VARIABLES) self._assertCollectionSize(0, tf.GraphKeys.UPDATE_OPS) self._assertCollectionSize(94, tf.GraphKeys.REGULARIZATION_LOSSES) self._assertCollectionSize(0, tf.GraphKeys.LOSSES) self._assertCollectionSize(23, tf.GraphKeys.SUMMARIES)