d2dbd440d89d22b4b75f30ddeb4c4ebd3882ecfa,tools/sort.py,Sort,sort_face_dissim,#Sort#,208

Before Change



        logger.info("Sorting by face dissimilarity...")

        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)
        return img_list

After Change


        logger.info("Sorting by face dissimilarity...")
        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]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: deepfakes/faceswap
Commit Name: d2dbd440d89d22b4b75f30ddeb4c4ebd3882ecfa
Time: 2019-05-14
Author: 36920800+torzdf@users.noreply.github.com
File Name: tools/sort.py
Class Name: Sort
Method Name: sort_face_dissim


Project Name: IndicoDataSolutions/finetune
Commit Name: 3ce15cf0b1b83503d0a35a0077cb93322c2cc710
Time: 2018-11-13
Author: madison@indico.io
File Name: finetune/base.py
Class Name: BaseModel
Method Name: _inference


Project Name: IndicoDataSolutions/finetune
Commit Name: a99539305cc4d00f51f38e133c1e27dc9aeb4fb9
Time: 2018-10-15
Author: benlt@hotmail.co.uk
File Name: finetune/base.py
Class Name: BaseModel
Method Name: _inference