def sort_hist_dissim(self):
Sort by histigram of face dissimilarity
input_dir = self.args.input_dir
logger.info("Sorting by histogram dissimilarity...")
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)
]
img_list_len = len(img_list)
for i in tqdm(range(0, img_list_len), desc="Sorting", file=sys.stdout):
After Change
scores = np.zeros(len(filename_list), dtype="float32")
distance = cv2.HISTCMP_BHATTACHARYYA
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))
logger.info("Comparing histograms...")
img_list_len = len(img_list)
for i in tqdm(range(0, img_list_len), desc="Comparing", file=sys.stdout):
score_total = 0
for j in range(0, img_list_len):