text: from scipy import misc
  import tensorflow as tf
  import numpy as np
  import os
  import facenet
  print facenet
  from facenet import load_model, prewhiten
  import align.detect_face
  
  
  def load_and_align_data(image_paths,
                          image_size=160,
                          margin=44,
                          gpu_memory_fraction=1.0):
      minsize = 20
      threshold = [0.6, 0.7, 0.7]
      factor = 0.709
  
      print('Creating networks and loading parameters')
      with tf.Graph().as_default():
          gpu_options = tf.GPUOptions(
              per_process_gpu_memory_fraction=gpu_memory_fraction)
          sess = tf.Session(config=tf.ConfigProto(
              gpu_options=gpu_options, log_device_placement=False))
          with sess.as_default():
              pnet, rnet, onet = align.detect_face.create_mtcnn(sess, None)
  
      nrof_samples = len(image_paths)
      img_list = [None] * nrof_samples
      for i in range(nrof_samples):
          img = misc.imread(os.path.expanduser(image_paths[i]), mode='RGB')
          img_size = np.asarray(img.shape)[0:2]
          bounding_boxes, _ = align.detect_face.detect_face(
              img, minsize, pnet, rnet, onet, threshold, factor)
          det = np.squeeze(bounding_boxes[0, 0:4])
          bb = np.zeros(4, dtype=np.int32)
          bb[0] = np.maximum(det[0] - margin / 2, 0)
          bb[1] = np.maximum(det[1] - margin / 2, 0)
          bb[2] = np.minimum(det[2] + margin / 2, img_size[1])
          bb[3] = np.minimum(det[3] + margin / 2, img_size[0])
          cropped = img[bb[1]:bb[3], bb[0]:bb[2], :]
          aligned = misc.imresize(
              cropped, (image_size, image_size), interp='bilinear')
          prewhitened = prewhiten(aligned)
          img_list[i] = prewhitened
      images = np.stack(img_list)
      return images
  
  
  def get_face_embeddings(image_paths,
                          model=''):
      images = load_and_align_data(image_paths)
      with tf.Graph().as_default():
          with tf.Session() as sess:
              load_model(model)
              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")
              feed_dict = {images_placeholder: images,
                           phase_train_placeholder: False}
              emb = sess.run(embeddings, feed_dict=feed_dict)
  
      return emb
  
  
  def compute_distance(embedding_1, embedding_2):
      dist = np.sqrt(np.sum(np.square(np.subtract(embedding_1, embedding_2))))
      return dist
  