b3ae6130ed4714852211a6e8cb56de66450da83c,scripts/extract.py,ExtractTrainingData,process,#ExtractTrainingData#,17

Before Change



        try:
            for filename in self.read_directory():
                image = cv2.imread(filename)
                for idx, face in self.get_faces(image):
                    resized_image = extractor.extract(image, face, 256)
                    output_file = self.output_dir / Path(filename).stem
                    cv2.imwrite(str(output_file) + str(idx) + Path(filename).suffix, resized_image)
                
        except Exception as e:
            print("Failed to extract from image: {}. Reason: {}".format(filename, e))

After Change


        extractor_name = "Align" // TODO Pass as argument
        self.extractor = PluginLoader.get_extractor(extractor_name)()
        self.faces_detected = 0
        processes = self.arguments.processes
        if processes != 1:
            files = list(self.read_directory())
            for _ in tqdm(pool_process(self.processFiles, files, processes=processes), total = len(files)):
                self.faces_detected +=1
        else:
            try:
                for filename in tqdm(self.read_directory()):
                    self.handleImage(filename)

            except Exception as e:
                print("Failed to extract from image: {}. Reason: {}".format(filename, e))

    def processFiles(self, filename):
        try:
            return self.handleImage(filename)
        except Exception as e:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: deepfakes/faceswap
Commit Name: b3ae6130ed4714852211a6e8cb56de66450da83c
Time: 2018-02-07
Author: Github@clorr.fr
File Name: scripts/extract.py
Class Name: ExtractTrainingData
Method Name: process


Project Name: uber/ludwig
Commit Name: db6c90a30f8ee8f8e1ffb4881c5d52f6f3bde5c1
Time: 2019-03-19
Author: 33033675+ydudin3@users.noreply.github.com
File Name: ludwig/features/image_feature.py
Class Name: ImageBaseFeature
Method Name: add_feature_data


Project Name: deepfakes/faceswap
Commit Name: a3294523aa159472574cde4210be99de21e5e6af
Time: 2019-06-02
Author: 36920800+torzdf@users.noreply.github.com
File Name: scripts/fsmedia.py
Class Name: Images
Method Name: load_disk_frames