          val_index_list = [i[0] for i in new_vals_list]
          for i in tqdm(range(len(sorted_list)),
                        desc="Splicing",
                        file=sys.stdout):
              current_image = sorted_list[i][0]
              new_val_index = val_index_list.index(current_image)
              new_list.append([current_image, new_vals_list[new_val_index][1]])
  
          return new_list
  
      @staticmethod
      def find_images(input_dir):
 
</s> remove 
        img_list = [[img, self.vgg_face.predict(cv2.imread(img)), 0]
                    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), desc="Sorting", file=sys.stdout):
            score_total = 0
            for j in range(0, img_list_len):
                if i == j:
                    continue
                score_total += self.vgg_face.find_cosine_similiarity(
                    img_list[i][1],
                    img_list[j][1])

            img_list[i][2] = score_total

        logger.info("Sorting...")
        img_list = sorted(img_list, key=operator.itemgetter(2), reverse=True)
 </s> add         images = np.array(self.find_images(input_dir))
        preds = np.array([self.vgg_face.predict(cv2.imread(img))
                          for img in tqdm(images, desc="loading", file=sys.stdout)])
        logger.info("Sorting. Depending on ths size of your dataset, this may take a while...")
        indices = self.vgg_face.sorted_similarity(preds, method="complete")
        img_list = images[indices] </s> remove         img_list = [[img, self.vgg_face.predict(cv2.imread(img))]
                    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")
            j_min_score = i + 1
            for j in range(i + 1, len(img_list)):
                f1encs = img_list[i][1]
                f2encs = img_list[j][1]
                score = self.vgg_face.find_cosine_similiarity(f1encs, f2encs)
                if score < min_score:
                    min_score = score
                    j_min_score = j
            (img_list[i + 1],
             img_list[j_min_score]) = (img_list[j_min_score],
                                       img_list[i + 1])
 </s> add         images = np.array(self.find_images(input_dir))
        preds = np.array([self.vgg_face.predict(cv2.imread(img))
                          for img in tqdm(images, desc="loading", file=sys.stdout)])
        logger.info("Sorting. Depending on ths size of your dataset, this may take a few "
                    "minutes...")
        indices = self.vgg_face.sorted_similarity(preds, method="ward")
        img_list = images[indices] </s> remove             src = img_list[i][0]
 </s> add             src = img_list[i] if isinstance(img_list[i], str) else img_list[i][0] </s> remove             src, dst = renaming(img_list[i][0], output_dir, i, self.changes)
 </s> add             fname = img_list[i] if isinstance(img_list[i], str) else img_list[i][0]
            src, dst = renaming(fname, output_dir, i, self.changes)
            current_img = sorted_list[i] if isinstance(sorted_list[i], str) else sorted_list[i][0]
            new_val_index = val_index_list.index(current_img)
            new_list.append([current_img, new_vals_list[new_val_index][1]])
          val_index_list = [i[0] for i in new_vals_list]
          for i in tqdm(range(len(sorted_list)),
                        desc="Splicing",
                        file=sys.stdout):
            current_img = sorted_list[i] if isinstance(sorted_list[i], str) else sorted_list[i][0]
            new_val_index = val_index_list.index(current_img)
            new_list.append([current_img, new_vals_list[new_val_index][1]])
            current_img = sorted_list[i] if isinstance(sorted_list[i], str) else sorted_list[i][0]
            new_val_index = val_index_list.index(current_img)
            new_list.append([current_img, new_vals_list[new_val_index][1]])
            current_img = sorted_list[i] if isinstance(sorted_list[i], str) else sorted_list[i][0]
            new_val_index = val_index_list.index(current_img)
            new_list.append([current_img, new_vals_list[new_val_index][1]])
  
          return new_list
  
      @staticmethod
      def find_images(input_dir):
keep keep keep keep replace replace replace keep keep keep keep keep
 Sort: Faster sort by face/face-dissim 
tools/sort.py