          """ Load the warped images and target images to queue """
          logger.debug("Loading batch: (image_count: %s, side: '%s', is_timelapse: %s, "
                       "do_shuffle: %s)", len(images), side, is_timelapse, do_shuffle)
          self.validate_samples(images)
  
          def _img_iter(imgs):
              while True:
                  if do_shuffle:
                      shuffle(imgs)
                  for img in imgs:
 
</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)] </s> remove from random import shuffle
 </s> add from random import shuffle, choice
        # Intialize this for each subprocess
        self._nearest_landmarks = dict()
          """ Load the warped images and target images to queue """
          logger.debug("Loading batch: (image_count: %s, side: '%s', is_timelapse: %s, "
                       "do_shuffle: %s)", len(images), side, is_timelapse, do_shuffle)
          self.validate_samples(images)
        # Intialize this for each subprocess
        self._nearest_landmarks = dict()
  
          def _img_iter(imgs):
              while True:
                  if do_shuffle:
                      shuffle(imgs)
                  for img in imgs:
keep keep keep add keep keep keep keep keep keep
 Added cache for nearest landmarks (#690)

* Added cache for nearest landmarks

* linting 
lib/training_data.py