  
  import logging
  
  from hashlib import sha1
  from random import shuffle
  
  import cv2
  import numpy as np
  from scipy.interpolate import griddata
  
 
</s> remove         dst_points = self.landmarks["a"] if side == "b" else self.landmarks["b"]
        dst_points = list(dst_points.values())
        closest = (np.mean(np.square(src_points - dst_points),
                           axis=(1, 2))).argsort()[:10]
        closest = np.random.choice(closest)
        dst_points = dst_points[closest]
 </s> add         landmarks = self.landmarks["a"] if side == "b" else self.landmarks["b"]
        closest_hashes = self._nearest_landmarks.get(filename)
        if not closest_hashes:
            dst_points_items = list(landmarks.items())
            dst_points = list(x[1] for x in dst_points_items)
            closest = (np.mean(np.square(src_points - dst_points),
                               axis=(1, 2))).argsort()[:10]
            closest_hashes = tuple(dst_points_items[i][0] for i in closest)
            self._nearest_landmarks[filename] = closest_hashes
        dst_points = landmarks[choice(closest_hashes)]
from random import shuffle, choice
  
  import logging
  
  from hashlib import sha1
from random import shuffle, choice
  
  import cv2
  import numpy as np
  from scipy.interpolate import griddata
  
keep keep keep keep replace keep keep keep keep keep
 Added cache for nearest landmarks (#690)

* Added cache for nearest landmarks

* linting 
lib/training_data.py