Fix Required: Weight Loading Path in gfpgan/utils.py for facexlib #399

Open
opened 2026-01-29 21:47:30 +00:00 by claunia · 0 comments
Owner

Originally created by @dvapan on GitHub (Sep 13, 2023).

facexlib loads weights into a relative directory instead of the directory containing the .py file. To fix this easily, in the gfpgan/utils.py file during the constructor call:

79  self.face_helper = FaceRestoreHelper(
80      upscale,
81      face_size=512,
82      crop_ratio=(1, 1),
83      det_model='retinaface_resnet50',
84      save_ext='png',
85      use_parse=True,
86      device=self.device,
87      model_rootpath='gfpgan/weights')

Replace model_rootpath='gfpgan/weights' with os.path.join(ROOT_DIR, 'gfpgan/weights').

Originally created by @dvapan on GitHub (Sep 13, 2023). **facexlib** loads weights into a relative directory instead of the directory containing the .py file. To fix this easily, in the `gfpgan/utils.py` file during the constructor call: ```python 79 self.face_helper = FaceRestoreHelper( 80 upscale, 81 face_size=512, 82 crop_ratio=(1, 1), 83 det_model='retinaface_resnet50', 84 save_ext='png', 85 use_parse=True, 86 device=self.device, 87 model_rootpath='gfpgan/weights') ``` Replace model_rootpath='gfpgan/weights' with os.path.join(ROOT_DIR, 'gfpgan/weights').
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TencentARC/GFPGAN#399