Exemplo n.º 1
0
 def get_embedding(self, images):
     prewhiten_face = facenet.prewhiten(images)
     feed_dict = {
         self.images_placeholder: [prewhiten_face],
         self.phase_train_placeholder: False
     }
     embedding = self.sess.run(self.tf_embeddings, feed_dict=feed_dict)
     return embedding
Exemplo n.º 2
0
    def generate_embedding(self, image):
        # Get input and output tensors
        images_placeholder = tf.get_default_graph().get_tensor_by_name("input:0")
        embeddings = tf.get_default_graph().get_tensor_by_name("embeddings:0")
        phase_train_placeholder = tf.get_default_graph().get_tensor_by_name("phase_train:0")

        face=self.dectection.find_faces(image)
        prewhiten_face = facenet.prewhiten(face.image)
        # Run forward pass to calculate embeddings
        feed_dict = {images_placeholder: [prewhiten_face], phase_train_placeholder: False}
        return self.sess.run(embeddings, feed_dict=feed_dict)[0]