aboutsummaryrefslogtreecommitdiff
path: root/modules/gfpgan_model.py
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2023-12-25 14:43:51 +0200
committerAarni Koskela <akx@iki.fi>2023-12-30 16:24:01 +0200
commitb0f59342346b1c8b405f97c0e0bb01c6ae05c601 (patch)
tree8f77ec512bf8c3352d03898cf9bf1c26df02c1a0 /modules/gfpgan_model.py
parente472383acbb9e07dca311abe5fb16ee2675e410a (diff)
Use Spandrel for upscaling and face restoration architectures (aside from GFPGAN and LDSR)
Diffstat (limited to 'modules/gfpgan_model.py')
-rw-r--r--modules/gfpgan_model.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/gfpgan_model.py b/modules/gfpgan_model.py
index 01d668ec..6b6f17c4 100644
--- a/modules/gfpgan_model.py
+++ b/modules/gfpgan_model.py
@@ -1,8 +1,5 @@
import os
-import facexlib
-import gfpgan
-
import modules.face_restoration
from modules import paths, shared, devices, modelloader, errors
@@ -41,6 +38,8 @@ def gfpgann():
print("Unable to load gfpgan model!")
return None
+ import facexlib.detection.retinaface
+
if hasattr(facexlib.detection.retinaface, 'device'):
facexlib.detection.retinaface.device = devices.device_gfpgan
model_file_path = model_file
@@ -81,8 +80,10 @@ gfpgan_constructor = None
def setup_model(dirname):
try:
os.makedirs(model_path, exist_ok=True)
- from gfpgan import GFPGANer
- from facexlib import detection, parsing # noqa: F401
+ import gfpgan
+ import facexlib.detection
+ import facexlib.parsing
+
global user_path
global have_gfpgan
global gfpgan_constructor
@@ -111,7 +112,7 @@ def setup_model(dirname):
facexlib.parsing.load_file_from_url = facex_load_file_from_url2
user_path = dirname
have_gfpgan = True
- gfpgan_constructor = GFPGANer
+ gfpgan_constructor = gfpgan.GFPGANer
class FaceRestorerGFPGAN(modules.face_restoration.FaceRestoration):
def name(self):