#442·GFPGAN

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

Author: dvapanCreated Sep 13, 2023Updated Mar 2, 2026

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').