Spaces:
Running
on
Zero
Running
on
Zero
update url
Browse files- facelib/detection/__init__.py +4 -4
- facelib/parsing/__init__.py +2 -2
- hugging_face/app.py +21 -4
facelib/detection/__init__.py
CHANGED
@@ -25,10 +25,10 @@ def init_detection_model(model_name, half=False, device='cuda'):
|
|
25 |
def init_retinaface_model(model_name, half=False, device='cuda'):
|
26 |
if model_name == 'retinaface_resnet50':
|
27 |
model = RetinaFace(network_name='resnet50', half=half)
|
28 |
-
model_url = 'https://github.com/jnjaby/KEEP/releases/download/
|
29 |
elif model_name == 'retinaface_mobile0.25':
|
30 |
model = RetinaFace(network_name='mobile0.25', half=half)
|
31 |
-
model_url = 'https://github.com/jnjaby/KEEP/releases/download/
|
32 |
else:
|
33 |
raise NotImplementedError(f'{model_name} is not implemented.')
|
34 |
|
@@ -49,10 +49,10 @@ def init_retinaface_model(model_name, half=False, device='cuda'):
|
|
49 |
def init_yolov5face_model(model_name, device='cuda'):
|
50 |
if model_name == 'YOLOv5l':
|
51 |
model = YoloDetector(config_name='facelib/detection/yolov5face/models/yolov5l.yaml', device=device)
|
52 |
-
model_url = 'https://github.com/jnjaby/KEEP/releases/download/
|
53 |
elif model_name == 'YOLOv5n':
|
54 |
model = YoloDetector(config_name='facelib/detection/yolov5face/models/yolov5n.yaml', device=device)
|
55 |
-
model_url = 'https://github.com/jnjaby/KEEP/releases/download/
|
56 |
else:
|
57 |
raise NotImplementedError(f'{model_name} is not implemented.')
|
58 |
|
|
|
25 |
def init_retinaface_model(model_name, half=False, device='cuda'):
|
26 |
if model_name == 'retinaface_resnet50':
|
27 |
model = RetinaFace(network_name='resnet50', half=half)
|
28 |
+
model_url = 'https://github.com/jnjaby/KEEP/releases/download/v1.0.0/detection_Resnet50_Final.pth'
|
29 |
elif model_name == 'retinaface_mobile0.25':
|
30 |
model = RetinaFace(network_name='mobile0.25', half=half)
|
31 |
+
model_url = 'https://github.com/jnjaby/KEEP/releases/download/v1.0.0/detection_mobilenet0.25_Final.pth'
|
32 |
else:
|
33 |
raise NotImplementedError(f'{model_name} is not implemented.')
|
34 |
|
|
|
49 |
def init_yolov5face_model(model_name, device='cuda'):
|
50 |
if model_name == 'YOLOv5l':
|
51 |
model = YoloDetector(config_name='facelib/detection/yolov5face/models/yolov5l.yaml', device=device)
|
52 |
+
model_url = 'https://github.com/jnjaby/KEEP/releases/download/v1.0.0/yolov5l-face.pth'
|
53 |
elif model_name == 'YOLOv5n':
|
54 |
model = YoloDetector(config_name='facelib/detection/yolov5face/models/yolov5n.yaml', device=device)
|
55 |
+
model_url = 'https://github.com/jnjaby/KEEP/releases/download/v1.0.0/yolov5n-face.pth'
|
56 |
else:
|
57 |
raise NotImplementedError(f'{model_name} is not implemented.')
|
58 |
|
facelib/parsing/__init__.py
CHANGED
@@ -8,10 +8,10 @@ from .parsenet import ParseNet
|
|
8 |
def init_parsing_model(model_name='bisenet', half=False, device='cuda'):
|
9 |
if model_name == 'bisenet':
|
10 |
model = BiSeNet(num_class=19)
|
11 |
-
model_url = 'https://github.com/
|
12 |
elif model_name == 'parsenet':
|
13 |
model = ParseNet(in_size=512, out_size=512, parsing_ch=19)
|
14 |
-
model_url = 'https://github.com/
|
15 |
else:
|
16 |
raise NotImplementedError(f'{model_name} is not implemented.')
|
17 |
|
|
|
8 |
def init_parsing_model(model_name='bisenet', half=False, device='cuda'):
|
9 |
if model_name == 'bisenet':
|
10 |
model = BiSeNet(num_class=19)
|
11 |
+
model_url = 'https://github.com/jnjaby/KEEP/releases/download/v1.0.0/parsing_bisenet.pth'
|
12 |
elif model_name == 'parsenet':
|
13 |
model = ParseNet(in_size=512, out_size=512, parsing_ch=19)
|
14 |
+
model_url = 'https://github.com/jnjaby/KEEP/releases/download/v1.0.0/parsing_parsenet.pth'
|
15 |
else:
|
16 |
raise NotImplementedError(f'{model_name} is not implemented.')
|
17 |
|
hugging_face/app.py
CHANGED
@@ -239,11 +239,28 @@ download_url_to_file("https://github.com/jnjaby/KEEP/releases/download/media/rea
|
|
239 |
download_url_to_file("https://github.com/jnjaby/KEEP/releases/download/media/real_3.mp4", os.path.join(sample_videos_dir, "real_3.mp4"))
|
240 |
download_url_to_file("https://github.com/jnjaby/KEEP/releases/download/media/real_4.mp4", os.path.join(sample_videos_dir, "real_4.mp4"))
|
241 |
|
242 |
-
model_dir = os.path.join("/home/user/app/", "weights/KEEP")
|
243 |
-
_ = load_file_from_url(url='https://github.com/jnjaby/KEEP/releases/download/v1.0.0/KEEP-b76feb75.pth', model_dir=model_dir, progress=True, file_name=None)
|
244 |
|
245 |
-
|
246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
|
248 |
# Launching the Gradio interface.
|
249 |
demo = gr.Interface(
|
|
|
239 |
download_url_to_file("https://github.com/jnjaby/KEEP/releases/download/media/real_3.mp4", os.path.join(sample_videos_dir, "real_3.mp4"))
|
240 |
download_url_to_file("https://github.com/jnjaby/KEEP/releases/download/media/real_4.mp4", os.path.join(sample_videos_dir, "real_4.mp4"))
|
241 |
|
|
|
|
|
242 |
|
243 |
+
model_dir = "/home/user/app/weights/"
|
244 |
+
model_url = "https://github.com/jnjaby/KEEP/releases/download/v1.0.0/"
|
245 |
+
|
246 |
+
_ = load_file_from_url(url=os.path.join(model_url, 'KEEP-b76feb75.pth'),
|
247 |
+
model_dir=os.path.join(model_dir, "KEEP"), progress=True, file_name=None)
|
248 |
+
|
249 |
+
_ = load_file_from_url(url=os.path.join(model_url, 'detection_Resnet50_Final.pth'),
|
250 |
+
model_dir=os.path.join(model_dir, "facelib"), progress=True, file_name=None)
|
251 |
+
_ = load_file_from_url(url=os.path.join(model_url, 'detection_mobilenet0.25_Final.pth'),
|
252 |
+
model_dir=os.path.join(model_dir, "facelib"), progress=True, file_name=None)
|
253 |
+
_ = load_file_from_url(url=os.path.join(model_url, 'yolov5n-face.pth'),
|
254 |
+
model_dir=os.path.join(model_dir, "facelib"), progress=True, file_name=None)
|
255 |
+
_ = load_file_from_url(url=os.path.join(model_url, 'yolov5l-face.pth'),
|
256 |
+
model_dir=os.path.join(model_dir, "facelib"), progress=True, file_name=None)
|
257 |
+
_ = load_file_from_url(url=os.path.join(model_url, 'parsing_parsenet.pth'),
|
258 |
+
model_dir=os.path.join(model_dir, "facelib"), progress=True, file_name=None)
|
259 |
+
|
260 |
+
_ = load_file_from_url(url=os.path.join(model_url, 'RealESRGAN_x2plus.pth'),
|
261 |
+
model_dir=os.path.join(model_dir, "realesrgan"), progress=True, file_name=None)
|
262 |
+
|
263 |
+
|
264 |
|
265 |
# Launching the Gradio interface.
|
266 |
demo = gr.Interface(
|