Spaces:
Running
Running
gavinyuan
commited on
Commit
·
4f18a93
1
Parent(s):
0ce38bd
update: mouth helper
Browse files
inference/tricks.py
CHANGED
|
@@ -97,14 +97,22 @@ class Trick(object):
|
|
| 97 |
return helper_face * i_r_mouth_mask + i_r * (1 - i_r_mouth_mask)
|
| 98 |
|
| 99 |
def load_mouth_helper(self):
|
| 100 |
-
from
|
| 101 |
-
mouth_helper_pl = EvaluatorFaceShifter(
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
)
|
| 107 |
-
self.mouth_helper =
|
|
|
|
| 108 |
print("[Mouth helper] loaded.")
|
| 109 |
|
| 110 |
|
|
|
|
| 97 |
return helper_face * i_r_mouth_mask + i_r * (1 - i_r_mouth_mask)
|
| 98 |
|
| 99 |
def load_mouth_helper(self):
|
| 100 |
+
from modules.networks.faceshifter import FSGenerator
|
| 101 |
+
# mouth_helper_pl = EvaluatorFaceShifter(
|
| 102 |
+
# load_path="/apdcephfs/share_1290939/gavinyuan/out/triplet10w_34/epoch=13-step=737999.ckpt",
|
| 103 |
+
# pt_path=make_abs_path("../ffplus/extracted_ckpt/G_t34_helper_post.pth"),
|
| 104 |
+
# benchmark=None,
|
| 105 |
+
# demo_folder=None,
|
| 106 |
+
# )
|
| 107 |
+
pt_path = make_abs_path("./weights/extracted/G_t34_helper_post.pth")
|
| 108 |
+
self.mouth_helper = FSGenerator(
|
| 109 |
+
make_abs_path("./weights/arcface/ms1mv3_arcface_r100_fp16/backbone.pth"),
|
| 110 |
+
mouth_net_param={"use": False},
|
| 111 |
+
in_size=256,
|
| 112 |
+
downup=False,
|
| 113 |
)
|
| 114 |
+
self.mouth_helper.load_state_dict(torch.load(pt_path, "cpu"), strict=True)
|
| 115 |
+
self.mouth_helper.eval()
|
| 116 |
print("[Mouth helper] loaded.")
|
| 117 |
|
| 118 |
|
weights/extracted/G_t34_helper_post.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0192f044350b8020c45251d7f2e80ecbc39ec32b4b8129f142cee76f1b917458
|
| 3 |
+
size 998751980
|