f90efe38fb0b1019e5bdc06b8a325aefe44893ea,face_alignment/detection/sfd/sfd_detector.py,SFDDetector,__init__,#SFDDetector#Any#Any#Any#,18

Before Change


    def __init__(self, device, path_to_detector=None, verbose=False):
        super(SFDDetector, self).__init__(device, verbose)

        base_path = os.path.join(appdata_dir("face_alignment"), "data")

        // Initialise the face detector
        if path_to_detector is None:
            path_to_detector = os.path.join(
                base_path, "s3fd_convert.pth")

            if not os.path.isfile(path_to_detector):
                print("Downloading the face detection CNN. Please wait...")

                path_to_temp_detector = os.path.join(
                    base_path, "s3fd_convert.pth.download")

                if os.path.isfile(path_to_temp_detector):
                    os.remove(os.path.join(path_to_temp_detector))

                request_file.urlretrieve(
                    "https://www.adrianbulat.com/downloads/python-fan/s3fd_convert.pth",
                    os.path.join(path_to_temp_detector))

                os.rename(os.path.join(path_to_temp_detector), os.path.join(path_to_detector))

        self.face_detector = s3fd()
        self.face_detector.load_state_dict(torch.load(path_to_detector))
        self.face_detector.to(device)
        self.face_detector.eval()

After Change


        super(SFDDetector, self).__init__(device, verbose)

        // Initialise the face detector
        if path_to_detector is None:
            model_weights = load_url(models_urls["s3fd"])
        else:
            model_weights = torch.load(path_to_detector)

        self.face_detector = s3fd()
        self.face_detector.load_state_dict(model_weights)
        self.face_detector.to(device)
        self.face_detector.eval()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: 1adrianb/face-alignment
Commit Name: f90efe38fb0b1019e5bdc06b8a325aefe44893ea
Time: 2018-12-19
Author: bulat.adrian@gmail.com
File Name: face_alignment/detection/sfd/sfd_detector.py
Class Name: SFDDetector
Method Name: __init__


Project Name: PetrochukM/PyTorch-NLP
Commit Name: def0dfbfbc6f840484a10cc4e963cfa8686ded69
Time: 2018-04-01
Author: petrochukm@gmail.com
File Name: torchnlp/utils.py
Class Name:
Method Name: download_urls


Project Name: 1adrianb/face-alignment
Commit Name: f90efe38fb0b1019e5bdc06b8a325aefe44893ea
Time: 2018-12-19
Author: bulat.adrian@gmail.com
File Name: face_alignment/detection/sfd/sfd_detector.py
Class Name: SFDDetector
Method Name: __init__


Project Name: mozilla/TTS
Commit Name: b24110477817e3b84f1ae230e369283da93669b2
Time: 2019-01-16
Author: egolge@mozilla.com
File Name: datasets/TTSDataset.py
Class Name: MyDataset
Method Name: load_data