Spaces:
Runtime error
Runtime error
Commit
·
bdd706c
1
Parent(s):
eed27f8
face detect test
Browse files- vtoonify/style_transfer.py +0 -10
- vtoonify_model.py +5 -1
vtoonify/style_transfer.py
CHANGED
|
@@ -76,16 +76,6 @@ if __name__ == "__main__":
|
|
| 76 |
open(modelname, 'wb').write(data)
|
| 77 |
landmarkpredictor = dlib.shape_predictor(modelname)
|
| 78 |
|
| 79 |
-
cnn_model_path = './checkpoint/mmod_human_face_detector.dat'
|
| 80 |
-
if not os.path.exists(cnn_model_path):
|
| 81 |
-
import wget, bz2
|
| 82 |
-
|
| 83 |
-
wget.download('http://dlib.net/files/mmod_human_face_detector.dat.bz2', cnn_model_path + '.bz2')
|
| 84 |
-
zipfile = bz2.BZ2File(cnn_model_path + '.bz2')
|
| 85 |
-
data = zipfile.read()
|
| 86 |
-
open(cnn_model_path, 'wb').write(data)
|
| 87 |
-
cnn_face_detector = dlib.shape_predictor(cnn_model_path)
|
| 88 |
-
|
| 89 |
pspencoder = load_psp_standalone(args.style_encoder_path, device)
|
| 90 |
|
| 91 |
if args.backbone == 'dualstylegan':
|
|
|
|
| 76 |
open(modelname, 'wb').write(data)
|
| 77 |
landmarkpredictor = dlib.shape_predictor(modelname)
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
pspencoder = load_psp_standalone(args.style_encoder_path, device)
|
| 80 |
|
| 81 |
if args.backbone == 'dualstylegan':
|
vtoonify_model.py
CHANGED
|
@@ -19,7 +19,7 @@ import gc
|
|
| 19 |
import huggingface_hub
|
| 20 |
import os
|
| 21 |
|
| 22 |
-
MODEL_REPO = '
|
| 23 |
|
| 24 |
class Model():
|
| 25 |
def __init__(self, device):
|
|
@@ -69,6 +69,10 @@ class Model():
|
|
| 69 |
def _create_dlib_landmark_model():
|
| 70 |
return dlib.shape_predictor(huggingface_hub.hf_hub_download(MODEL_REPO,
|
| 71 |
'models/shape_predictor_68_face_landmarks.dat'))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
def _create_parsing_model(self):
|
| 74 |
parsingpredictor = BiSeNet(n_classes=19)
|
|
|
|
| 19 |
import huggingface_hub
|
| 20 |
import os
|
| 21 |
|
| 22 |
+
MODEL_REPO = 'saimemrekanat/vmodels'
|
| 23 |
|
| 24 |
class Model():
|
| 25 |
def __init__(self, device):
|
|
|
|
| 69 |
def _create_dlib_landmark_model():
|
| 70 |
return dlib.shape_predictor(huggingface_hub.hf_hub_download(MODEL_REPO,
|
| 71 |
'models/shape_predictor_68_face_landmarks.dat'))
|
| 72 |
+
|
| 73 |
+
def _create_dlib_landmark_cnn_model():
|
| 74 |
+
return dlib.shape_predictor(huggingface_hub.hf_hub_download(MODEL_REPO,
|
| 75 |
+
'models/mmod_human_face_detector.dat'))
|
| 76 |
|
| 77 |
def _create_parsing_model(self):
|
| 78 |
parsingpredictor = BiSeNet(n_classes=19)
|