update
This commit is contained in:
parent
6579977439
commit
c3cbf8d4a2
@ -17,9 +17,11 @@ class GFPGANPlugin(BasePlugin):
|
||||
model_path = download_model(url, model_md5)
|
||||
logger.info(f"GFPGAN model path: {model_path}")
|
||||
|
||||
face_det_device = "cpu" if "cuda" in str(device) else device
|
||||
import facexlib
|
||||
|
||||
if hasattr(facexlib.detection.retinaface, "device"):
|
||||
facexlib.detection.retinaface.device = "cpu"
|
||||
facexlib.detection.retinaface.device = device
|
||||
|
||||
# Use GFPGAN for face enhancement
|
||||
self.face_enhancer = MyGFPGANer(
|
||||
@ -30,9 +32,10 @@ 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")
|
||||
|
||||
self.face_enhancer.face_helper.face_det.mean_tensor.to(device)
|
||||
self.face_enhancer.face_helper.face_det = (
|
||||
self.face_enhancer.face_helper.face_det.to(device)
|
||||
)
|
||||
|
||||
def __call__(self, rgb_np_img, files, form):
|
||||
weight = 0.5
|
||||
|
Loading…
Reference in New Issue
Block a user