          print ("Sorting by face-cnn dissimilarity...")
  
          img_list = []
          for x in tqdm( self.find_images(input_dir), desc="Loading", file=sys.stdout):
              d = FaceLandmarksExtractor.extract(cv2.imread(x), 'cnn', True)
              img_list.append( [x, np.array(d[0][1]) if len(d) > 0 else np.zeros ( (68,2) ), 0 ] )
  
          img_list_len = len(img_list)
          for i in tqdm( range(0, img_list_len-1), desc="Sorting", file=sys.stdout):
              score_total = 0
 
</s> remove             d = FaceLandmarksExtractor.extract(cv2.imread(x), 'cnn', True)
 </s> add             d = FaceLandmarksExtractor.extract(cv2.imread(x), 'cnn', True, input_is_predetected_face=True) </s> remove                 d = FaceLandmarksExtractor.extract(cv2.imread(x), 'cnn', True)
 </s> add                 d = FaceLandmarksExtractor.extract(cv2.imread(x), 'cnn', True, input_is_predetected_face=True) </s> remove     for current_detector, input_image in ((current_detector, input_image) for current_detector in dlib_detectors for input_image in input_images):
        detected_faces = current_detector(input_image, 0)
        if len(detected_faces) != 0:
            break
 </s> add     
    if input_is_predetected_face:
        input_scale = 1.0
        detected_faces = [ dlib.rectangle(0, 0, w, h) ]
    else:
        input_scale = scale_to / (w if w > h else h)
        input_image = cv2.resize (input_image, ( int(w*input_scale), int(h*input_scale) ), interpolation=cv2.INTER_LINEAR)
        input_image_bgr = input_image[:,:,::-1].copy() #cv2 and numpy inputs differs in rgb-bgr order, this affects chance of dlib face detection
        input_images = [input_image, input_image_bgr]
        for current_detector, input_image in ((current_detector, input_image) for current_detector in dlib_detectors for input_image in input_images):
            detected_faces = current_detector(input_image, 0)
            if len(detected_faces) != 0:
                break            </s> remove     input_scale = scale_to / (w if w > h else h)
    input_image = cv2.resize (input_image, ( int(w*input_scale), int(h*input_scale) ), interpolation=cv2.INTER_LINEAR)
    input_image_bgr = input_image[:,:,::-1].copy() #cv2 and numpy inputs differs in rgb-bgr order, this affects chance of dlib face detection
    input_images = [input_image, input_image_bgr]
 
 </s> add 
            d = FaceLandmarksExtractor.extract(cv2.imread(x), 'cnn', True, input_is_predetected_face=True)
          print ("Sorting by face-cnn dissimilarity...")
  
          img_list = []
          for x in tqdm( self.find_images(input_dir), desc="Loading", file=sys.stdout):
            d = FaceLandmarksExtractor.extract(cv2.imread(x), 'cnn', True, input_is_predetected_face=True)
              img_list.append( [x, np.array(d[0][1]) if len(d) > 0 else np.zeros ( (68,2) ), 0 ] )
  
          img_list_len = len(img_list)
          for i in tqdm( range(0, img_list_len-1), desc="Sorting", file=sys.stdout):
              score_total = 0
keep keep keep keep replace keep keep keep keep keep
 sorttool - fixes, and added --sort-by face-yaw (#312) 
tools/sort.py