Exemplo n.º 1
0
 def forward_fixed_text(self, text_npy):
     #text = tf.constant(text_npy)  #smaller than 2G, then ok...
     #but for safe in more application
     text = melt.constant(self.sess, text_npy)
     with tf.variable_scope("image_text_sim"):
         text_feature = self.forward_text(text)
         return text_feature
Exemplo n.º 2
0
 def build_fixed_text_graph(self, text_feature_npy): 
   """
   text features directly load to graph,
   used in evaluate.py for both fixed text and fixed words
   """
   with tf.variable_scope("image_text_sim"):
     image_feature = self.forward_image_feature(self.image_feature_place)
     text_feature = melt.constant(self.sess, text_feature_npy)
     score = melt.cosine(image_feature, text_feature, nonorm=True)
     return score
Exemplo n.º 3
0
 def init_evaluate_constant_text(self, text_npy):
     #self.text = tf.constant(text_npy)
     self.text = melt.constant(self.sess, text_npy)