This commit is contained in:
Qing
2023-03-31 22:06:17 +08:00
parent a28cc4e34b
commit 6579977439
3 changed files with 8 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ class GFPGANPlugin(BasePlugin):
import facexlib
if hasattr(facexlib.detection.retinaface, "device"):
facexlib.detection.retinaface.device = device
facexlib.detection.retinaface.device = "cpu"
# Use GFPGAN for face enhancement
self.face_enhancer = MyGFPGANer(
@@ -30,6 +30,9 @@ class GFPGANPlugin(BasePlugin):
device=device,
bg_upsampler=upscaler.model if upscaler is not None else None,
)
self.face_enhancer.face_helper.face_det.mean_tensor.to("cpu")
self.face_enhancer.face_helper.face_det = self.face_enhancer.face_helper.face_det.to("cpu")
def __call__(self, rgb_np_img, files, form):
weight = 0.5