          input_dir = self.args.input_dir
  
          logger.info("Sorting by histogram similarity...")
  
          img_list = [
              [img, cv2.calcHist([read_image(img, raise_error=True)], [0], None, [256], [0, 256])]
              for img in
              tqdm(self.find_images(input_dir), desc="Loading", file=sys.stdout)
          ]
  
          img_list_len = len(img_list)
          for i in tqdm(range(0, img_list_len - 1), desc="Sorting",
                        file=sys.stdout):
              min_score = float("inf")
 
</s> remove         img_list = [
            [img,
             cv2.calcHist([read_image(img, raise_error=True)], [0], None, [256], [0, 256]), 0]
            for img in
            tqdm(self.find_images(input_dir), desc="Loading", file=sys.stdout)
        ]
 </s> add         logger.info("Calculating histograms...")
        histograms = [cv2.calcHist([img], [0], None, [256], [0, 256]) for img in image_list]
        img_list = list(list(items) for items in zip(filename_list, histograms, scores)) </s> remove         """ Sort by histogram of face similarity """
        input_dir = self.args.input_dir

 </s> add         """ Sort by image histogram similarity """ </s> remove         for i in tqdm(range(0, img_list_len - 1), desc="Sorting",
                      file=sys.stdout):
 </s> add         for i in tqdm(range(0, img_list_len - 1), desc="Comparing", file=sys.stdout): </s> remove             temp_list = [
                [img,
                 cv2.calcHist([read_image(img, raise_error=True)], [0], None, [256], [0, 256])]
                for img in
                tqdm(self.find_images(input_dir),
                     desc="Reloading",
                     file=sys.stdout)
            ]
 </s> add             filename_list, image_list = self._get_images()
            histograms = [cv2.calcHist([img], [0], None, [256], [0, 256]) for img in image_list]
            temp_list = list(zip(filename_list, histograms)) </s> remove         logger.info("Sorting by face-cnn similarity...")
        img_list = []
        for img in tqdm(self.find_images(input_dir),
                        desc="Loading",
                        file=sys.stdout):
            landmarks = self.get_landmarks(img)
            img_list.append([img, np.array(landmarks)
                             if landmarks
                             else np.zeros((68, 2))])

        queue_manager.terminate_queues()
 </s> add         logger.info("Comparing landmarks and sorting...")
        logger.info("Calculating histograms...")
        histograms = [cv2.calcHist([img], [0], None, [256], [0, 256]) for img in image_list]
        img_list = list(zip(filename_list, histograms))
          input_dir = self.args.input_dir
  
          logger.info("Sorting by histogram similarity...")
  
        logger.info("Calculating histograms...")
        histograms = [cv2.calcHist([img], [0], None, [256], [0, 256]) for img in image_list]
        img_list = list(zip(filename_list, histograms))
        logger.info("Calculating histograms...")
        histograms = [cv2.calcHist([img], [0], None, [256], [0, 256]) for img in image_list]
        img_list = list(zip(filename_list, histograms))
        logger.info("Calculating histograms...")
        histograms = [cv2.calcHist([img], [0], None, [256], [0, 256]) for img in image_list]
        img_list = list(zip(filename_list, histograms))
        logger.info("Calculating histograms...")
        histograms = [cv2.calcHist([img], [0], None, [256], [0, 256]) for img in image_list]
        img_list = list(zip(filename_list, histograms))
        logger.info("Calculating histograms...")
        histograms = [cv2.calcHist([img], [0], None, [256], [0, 256]) for img in image_list]
        img_list = list(zip(filename_list, histograms))
  
          img_list_len = len(img_list)
          for i in tqdm(range(0, img_list_len - 1), desc="Sorting",
                        file=sys.stdout):
              min_score = float("inf")
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
 ENHANCEMENT: Sort image multi-threading and code clarity (#912)

* Use multi-threaded loading

* fast reload

* remove landmark stub

* saves

* correct face sort

* pep8 
tools/sort.py