      new_face = autoencoder.predict( face / 255.0 )[0]
      new_face = numpy.clip( new_face * 255, 0, 255 ).astype( image.dtype )
      new_face = cv2.resize( new_face, (160,160) )
      new_image = image.copy()
      new_image[crop,crop] = new_face
      return new_image
 
</s>
    result = aligner.align(image.copy(), new_face)
    if result is None:
        return superpose(image, new_face, crop)
    else:
        return result

def superpose(image, new_face, crop):
      new_face = autoencoder.predict( face / 255.0 )[0]
      new_face = numpy.clip( new_face * 255, 0, 255 ).astype( image.dtype )
      new_face = cv2.resize( new_face, (160,160) )
    result = aligner.align(image.copy(), new_face)
    if result is None:
        return superpose(image, new_face, crop)
    else:
        return result

def superpose(image, new_face, crop):
      new_image = image.copy()
      new_image[crop,crop] = new_face
      return new_image
keep keep add keep keep keep
 Adding dlib landmarks warping for better overlap
Note: You will need to add the shape_predictor_68_face_landmarks.dat file in the root for this to work. Url is provided in aligner.py
lib/faces_process.py