Spaces:
Runtime error
Runtime error
Commit
·
457698d
0
Parent(s):
Duplicate from Gradio-Blocks/ViTPose
Browse filesCo-authored-by: hysts <[email protected]>
- .gitattributes +29 -0
- .gitignore +1 -0
- .gitmodules +3 -0
- .pre-commit-config.yaml +46 -0
- .style.yapf +5 -0
- README.md +13 -0
- ViTPose +1 -0
- app.py +199 -0
- images/README.md +9 -0
- images/pexels-cottonbro-5770445.jpg +3 -0
- images/pexels-cottonbro-5770708.jpg +3 -0
- images/pexels-haste-leart-v-690598.jpg +3 -0
- images/pexels-luis-gallegos-alvarez-1164975.jpg +3 -0
- images/pexels-victoria-borodinova-7909580.jpg +3 -0
- images/pexels-yan-krukov-5792907.jpg +3 -0
- images/pexels-лиза-медведева-8574605.jpg +3 -0
- mmdet_configs/LICENSE +203 -0
- mmdet_configs/README.md +2 -0
- mmdet_configs/configs.tar +3 -0
- model.py +221 -0
- requirements.txt +9 -0
- style.css +15 -0
.gitattributes
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
21 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
mmdet_configs/configs
|
.gitmodules
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
[submodule "ViTPose"]
|
2 |
+
path = ViTPose
|
3 |
+
url = https://github.com/ViTAE-Transformer/ViTPose
|
.pre-commit-config.yaml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
exclude: ^(ViTPose/|mmdet_configs/configs/)
|
2 |
+
repos:
|
3 |
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
4 |
+
rev: v4.2.0
|
5 |
+
hooks:
|
6 |
+
- id: check-executables-have-shebangs
|
7 |
+
- id: check-json
|
8 |
+
- id: check-merge-conflict
|
9 |
+
- id: check-shebang-scripts-are-executable
|
10 |
+
- id: check-toml
|
11 |
+
- id: check-yaml
|
12 |
+
- id: double-quote-string-fixer
|
13 |
+
- id: end-of-file-fixer
|
14 |
+
- id: mixed-line-ending
|
15 |
+
args: ['--fix=lf']
|
16 |
+
- id: requirements-txt-fixer
|
17 |
+
- id: trailing-whitespace
|
18 |
+
- repo: https://github.com/myint/docformatter
|
19 |
+
rev: v1.4
|
20 |
+
hooks:
|
21 |
+
- id: docformatter
|
22 |
+
args: ['--in-place']
|
23 |
+
- repo: https://github.com/pycqa/isort
|
24 |
+
rev: 5.10.1
|
25 |
+
hooks:
|
26 |
+
- id: isort
|
27 |
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
28 |
+
rev: v0.812
|
29 |
+
hooks:
|
30 |
+
- id: mypy
|
31 |
+
args: ['--ignore-missing-imports']
|
32 |
+
- repo: https://github.com/google/yapf
|
33 |
+
rev: v0.32.0
|
34 |
+
hooks:
|
35 |
+
- id: yapf
|
36 |
+
args: ['--parallel', '--in-place']
|
37 |
+
- repo: https://github.com/kynan/nbstripout
|
38 |
+
rev: 0.5.0
|
39 |
+
hooks:
|
40 |
+
- id: nbstripout
|
41 |
+
args: ['--extra-keys', 'metadata.interpreter metadata.kernelspec cell.metadata.pycharm']
|
42 |
+
- repo: https://github.com/nbQA-dev/nbQA
|
43 |
+
rev: 1.3.1
|
44 |
+
hooks:
|
45 |
+
- id: nbqa-isort
|
46 |
+
- id: nbqa-yapf
|
.style.yapf
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[style]
|
2 |
+
based_on_style = pep8
|
3 |
+
blank_line_before_nested_class_or_def = false
|
4 |
+
spaces_before_comment = 2
|
5 |
+
split_before_logical_operator = true
|
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: ViTPose
|
3 |
+
emoji: 📊
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: indigo
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.0.17
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
duplicated_from: Gradio-Blocks/ViTPose
|
11 |
+
---
|
12 |
+
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference
|
ViTPose
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit 86eced957665e62fa728eea059d5fffb9b94d653
|
app.py
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
|
3 |
+
from __future__ import annotations
|
4 |
+
|
5 |
+
import argparse
|
6 |
+
import pathlib
|
7 |
+
import tarfile
|
8 |
+
|
9 |
+
import gradio as gr
|
10 |
+
|
11 |
+
from model import AppDetModel, AppPoseModel
|
12 |
+
|
13 |
+
DESCRIPTION = '''# ViTPose
|
14 |
+
|
15 |
+
This is an unofficial demo for [https://github.com/ViTAE-Transformer/ViTPose](https://github.com/ViTAE-Transformer/ViTPose).'''
|
16 |
+
FOOTER = '<img id="visitor-badge" alt="visitor badge" src="https://visitor-badge.glitch.me/badge?page_id=hysts.vitpose" />'
|
17 |
+
|
18 |
+
|
19 |
+
def parse_args() -> argparse.Namespace:
|
20 |
+
parser = argparse.ArgumentParser()
|
21 |
+
parser.add_argument('--device', type=str, default='cpu')
|
22 |
+
parser.add_argument('--theme', type=str)
|
23 |
+
parser.add_argument('--share', action='store_true')
|
24 |
+
parser.add_argument('--port', type=int)
|
25 |
+
parser.add_argument('--disable-queue',
|
26 |
+
dest='enable_queue',
|
27 |
+
action='store_false')
|
28 |
+
return parser.parse_args()
|
29 |
+
|
30 |
+
|
31 |
+
def set_example_image(example: list) -> dict:
|
32 |
+
return gr.Image.update(value=example[0])
|
33 |
+
|
34 |
+
|
35 |
+
def extract_tar() -> None:
|
36 |
+
if pathlib.Path('mmdet_configs/configs').exists():
|
37 |
+
return
|
38 |
+
with tarfile.open('mmdet_configs/configs.tar') as f:
|
39 |
+
f.extractall('mmdet_configs')
|
40 |
+
|
41 |
+
|
42 |
+
def main():
|
43 |
+
args = parse_args()
|
44 |
+
|
45 |
+
extract_tar()
|
46 |
+
|
47 |
+
det_model = AppDetModel(device=args.device)
|
48 |
+
pose_model = AppPoseModel(device=args.device)
|
49 |
+
|
50 |
+
with gr.Blocks(theme=args.theme, css='style.css') as demo:
|
51 |
+
gr.Markdown(DESCRIPTION)
|
52 |
+
|
53 |
+
with gr.Box():
|
54 |
+
gr.Markdown('## Step 1')
|
55 |
+
with gr.Row():
|
56 |
+
with gr.Column():
|
57 |
+
with gr.Row():
|
58 |
+
input_image = gr.Image(label='Input Image',
|
59 |
+
type='numpy')
|
60 |
+
with gr.Row():
|
61 |
+
detector_name = gr.Dropdown(list(
|
62 |
+
det_model.MODEL_DICT.keys()),
|
63 |
+
value=det_model.model_name,
|
64 |
+
label='Detector')
|
65 |
+
with gr.Row():
|
66 |
+
detect_button = gr.Button(value='Detect')
|
67 |
+
det_preds = gr.Variable()
|
68 |
+
with gr.Column():
|
69 |
+
with gr.Row():
|
70 |
+
detection_visualization = gr.Image(
|
71 |
+
label='Detection Result',
|
72 |
+
type='numpy',
|
73 |
+
elem_id='det-result')
|
74 |
+
with gr.Row():
|
75 |
+
vis_det_score_threshold = gr.Slider(
|
76 |
+
0,
|
77 |
+
1,
|
78 |
+
step=0.05,
|
79 |
+
value=0.5,
|
80 |
+
label='Visualization Score Threshold')
|
81 |
+
with gr.Row():
|
82 |
+
redraw_det_button = gr.Button(value='Redraw')
|
83 |
+
|
84 |
+
with gr.Row():
|
85 |
+
paths = sorted(pathlib.Path('images').rglob('*.jpg'))
|
86 |
+
example_images = gr.Dataset(components=[input_image],
|
87 |
+
samples=[[path.as_posix()]
|
88 |
+
for path in paths])
|
89 |
+
|
90 |
+
with gr.Box():
|
91 |
+
gr.Markdown('## Step 2')
|
92 |
+
with gr.Row():
|
93 |
+
with gr.Column():
|
94 |
+
with gr.Row():
|
95 |
+
pose_model_name = gr.Dropdown(
|
96 |
+
list(pose_model.MODEL_DICT.keys()),
|
97 |
+
value=pose_model.model_name,
|
98 |
+
label='Pose Model')
|
99 |
+
det_score_threshold = gr.Slider(
|
100 |
+
0,
|
101 |
+
1,
|
102 |
+
step=0.05,
|
103 |
+
value=0.5,
|
104 |
+
label='Box Score Threshold')
|
105 |
+
with gr.Row():
|
106 |
+
predict_button = gr.Button(value='Predict')
|
107 |
+
pose_preds = gr.Variable()
|
108 |
+
with gr.Column():
|
109 |
+
with gr.Row():
|
110 |
+
pose_visualization = gr.Image(label='Result',
|
111 |
+
type='numpy',
|
112 |
+
elem_id='pose-result')
|
113 |
+
with gr.Row():
|
114 |
+
vis_kpt_score_threshold = gr.Slider(
|
115 |
+
0,
|
116 |
+
1,
|
117 |
+
step=0.05,
|
118 |
+
value=0.3,
|
119 |
+
label='Visualization Score Threshold')
|
120 |
+
with gr.Row():
|
121 |
+
vis_dot_radius = gr.Slider(1,
|
122 |
+
10,
|
123 |
+
step=1,
|
124 |
+
value=4,
|
125 |
+
label='Dot Radius')
|
126 |
+
with gr.Row():
|
127 |
+
vis_line_thickness = gr.Slider(1,
|
128 |
+
10,
|
129 |
+
step=1,
|
130 |
+
value=2,
|
131 |
+
label='Line Thickness')
|
132 |
+
with gr.Row():
|
133 |
+
redraw_pose_button = gr.Button(value='Redraw')
|
134 |
+
|
135 |
+
gr.Markdown(FOOTER)
|
136 |
+
|
137 |
+
detector_name.change(fn=det_model.set_model,
|
138 |
+
inputs=detector_name,
|
139 |
+
outputs=None)
|
140 |
+
detect_button.click(fn=det_model.run,
|
141 |
+
inputs=[
|
142 |
+
detector_name,
|
143 |
+
input_image,
|
144 |
+
vis_det_score_threshold,
|
145 |
+
],
|
146 |
+
outputs=[
|
147 |
+
det_preds,
|
148 |
+
detection_visualization,
|
149 |
+
])
|
150 |
+
redraw_det_button.click(fn=det_model.visualize_detection_results,
|
151 |
+
inputs=[
|
152 |
+
input_image,
|
153 |
+
det_preds,
|
154 |
+
vis_det_score_threshold,
|
155 |
+
],
|
156 |
+
outputs=detection_visualization)
|
157 |
+
|
158 |
+
pose_model_name.change(fn=pose_model.set_model,
|
159 |
+
inputs=pose_model_name,
|
160 |
+
outputs=None)
|
161 |
+
predict_button.click(fn=pose_model.run,
|
162 |
+
inputs=[
|
163 |
+
pose_model_name,
|
164 |
+
input_image,
|
165 |
+
det_preds,
|
166 |
+
det_score_threshold,
|
167 |
+
vis_kpt_score_threshold,
|
168 |
+
vis_dot_radius,
|
169 |
+
vis_line_thickness,
|
170 |
+
],
|
171 |
+
outputs=[
|
172 |
+
pose_preds,
|
173 |
+
pose_visualization,
|
174 |
+
])
|
175 |
+
redraw_pose_button.click(fn=pose_model.visualize_pose_results,
|
176 |
+
inputs=[
|
177 |
+
input_image,
|
178 |
+
pose_preds,
|
179 |
+
vis_kpt_score_threshold,
|
180 |
+
vis_dot_radius,
|
181 |
+
vis_line_thickness,
|
182 |
+
],
|
183 |
+
outputs=pose_visualization)
|
184 |
+
|
185 |
+
example_images.click(
|
186 |
+
fn=set_example_image,
|
187 |
+
inputs=example_images,
|
188 |
+
outputs=input_image,
|
189 |
+
)
|
190 |
+
|
191 |
+
demo.launch(
|
192 |
+
enable_queue=args.enable_queue,
|
193 |
+
server_port=args.port,
|
194 |
+
share=args.share,
|
195 |
+
)
|
196 |
+
|
197 |
+
|
198 |
+
if __name__ == '__main__':
|
199 |
+
main()
|
images/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
These images are from the following public domain:
|
2 |
+
|
3 |
+
- https://www.pexels.com/photo/women-in-active-wear-balancing-their-body-while-leaning-by-the-doorway-5770445/
|
4 |
+
- https://www.pexels.com/photo/woman-balancing-her-body-on-a-handstand-using-one-hand-5770708/
|
5 |
+
- https://www.pexels.com/photo/persons-in-black-shirt-and-pants-690598/
|
6 |
+
- https://www.pexels.com/photo/photo-of-woman-doing-a-ballet-dance-1164975/
|
7 |
+
- https://www.pexels.com/photo/beautiful-woman-in-a-red-dress-wearing-red-lipstick-7909580/
|
8 |
+
- https://www.pexels.com/photo/girl-in-red-jacket-riding-bicycle-5792907/
|
9 |
+
- https://www.pexels.com/photo/woman-wearing-a-white-gown-walking-on-grass-field-8574605/
|
images/pexels-cottonbro-5770445.jpg
ADDED
![]() |
Git LFS Details
|
images/pexels-cottonbro-5770708.jpg
ADDED
![]() |
Git LFS Details
|
images/pexels-haste-leart-v-690598.jpg
ADDED
![]() |
Git LFS Details
|
images/pexels-luis-gallegos-alvarez-1164975.jpg
ADDED
![]() |
Git LFS Details
|
images/pexels-victoria-borodinova-7909580.jpg
ADDED
![]() |
Git LFS Details
|
images/pexels-yan-krukov-5792907.jpg
ADDED
![]() |
Git LFS Details
|
images/pexels-лиза-медведева-8574605.jpg
ADDED
![]() |
Git LFS Details
|
mmdet_configs/LICENSE
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright 2018-2023 OpenMMLab. All rights reserved.
|
2 |
+
|
3 |
+
Apache License
|
4 |
+
Version 2.0, January 2004
|
5 |
+
http://www.apache.org/licenses/
|
6 |
+
|
7 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
8 |
+
|
9 |
+
1. Definitions.
|
10 |
+
|
11 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
12 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
13 |
+
|
14 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
15 |
+
the copyright owner that is granting the License.
|
16 |
+
|
17 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
18 |
+
other entities that control, are controlled by, or are under common
|
19 |
+
control with that entity. For the purposes of this definition,
|
20 |
+
"control" means (i) the power, direct or indirect, to cause the
|
21 |
+
direction or management of such entity, whether by contract or
|
22 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
23 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
24 |
+
|
25 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
26 |
+
exercising permissions granted by this License.
|
27 |
+
|
28 |
+
"Source" form shall mean the preferred form for making modifications,
|
29 |
+
including but not limited to software source code, documentation
|
30 |
+
source, and configuration files.
|
31 |
+
|
32 |
+
"Object" form shall mean any form resulting from mechanical
|
33 |
+
transformation or translation of a Source form, including but
|
34 |
+
not limited to compiled object code, generated documentation,
|
35 |
+
and conversions to other media types.
|
36 |
+
|
37 |
+
"Work" shall mean the work of authorship, whether in Source or
|
38 |
+
Object form, made available under the License, as indicated by a
|
39 |
+
copyright notice that is included in or attached to the work
|
40 |
+
(an example is provided in the Appendix below).
|
41 |
+
|
42 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
43 |
+
form, that is based on (or derived from) the Work and for which the
|
44 |
+
editorial revisions, annotations, elaborations, or other modifications
|
45 |
+
represent, as a whole, an original work of authorship. For the purposes
|
46 |
+
of this License, Derivative Works shall not include works that remain
|
47 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
48 |
+
the Work and Derivative Works thereof.
|
49 |
+
|
50 |
+
"Contribution" shall mean any work of authorship, including
|
51 |
+
the original version of the Work and any modifications or additions
|
52 |
+
to that Work or Derivative Works thereof, that is intentionally
|
53 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
54 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
55 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
56 |
+
means any form of electronic, verbal, or written communication sent
|
57 |
+
to the Licensor or its representatives, including but not limited to
|
58 |
+
communication on electronic mailing lists, source code control systems,
|
59 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
60 |
+
Licensor for the purpose of discussing and improving the Work, but
|
61 |
+
excluding communication that is conspicuously marked or otherwise
|
62 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
63 |
+
|
64 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
65 |
+
on behalf of whom a Contribution has been received by Licensor and
|
66 |
+
subsequently incorporated within the Work.
|
67 |
+
|
68 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
69 |
+
this License, each Contributor hereby grants to You a perpetual,
|
70 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
71 |
+
copyright license to reproduce, prepare Derivative Works of,
|
72 |
+
publicly display, publicly perform, sublicense, and distribute the
|
73 |
+
Work and such Derivative Works in Source or Object form.
|
74 |
+
|
75 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
76 |
+
this License, each Contributor hereby grants to You a perpetual,
|
77 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
78 |
+
(except as stated in this section) patent license to make, have made,
|
79 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
80 |
+
where such license applies only to those patent claims licensable
|
81 |
+
by such Contributor that are necessarily infringed by their
|
82 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
83 |
+
with the Work to which such Contribution(s) was submitted. If You
|
84 |
+
institute patent litigation against any entity (including a
|
85 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
86 |
+
or a Contribution incorporated within the Work constitutes direct
|
87 |
+
or contributory patent infringement, then any patent licenses
|
88 |
+
granted to You under this License for that Work shall terminate
|
89 |
+
as of the date such litigation is filed.
|
90 |
+
|
91 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
92 |
+
Work or Derivative Works thereof in any medium, with or without
|
93 |
+
modifications, and in Source or Object form, provided that You
|
94 |
+
meet the following conditions:
|
95 |
+
|
96 |
+
(a) You must give any other recipients of the Work or
|
97 |
+
Derivative Works a copy of this License; and
|
98 |
+
|
99 |
+
(b) You must cause any modified files to carry prominent notices
|
100 |
+
stating that You changed the files; and
|
101 |
+
|
102 |
+
(c) You must retain, in the Source form of any Derivative Works
|
103 |
+
that You distribute, all copyright, patent, trademark, and
|
104 |
+
attribution notices from the Source form of the Work,
|
105 |
+
excluding those notices that do not pertain to any part of
|
106 |
+
the Derivative Works; and
|
107 |
+
|
108 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
109 |
+
distribution, then any Derivative Works that You distribute must
|
110 |
+
include a readable copy of the attribution notices contained
|
111 |
+
within such NOTICE file, excluding those notices that do not
|
112 |
+
pertain to any part of the Derivative Works, in at least one
|
113 |
+
of the following places: within a NOTICE text file distributed
|
114 |
+
as part of the Derivative Works; within the Source form or
|
115 |
+
documentation, if provided along with the Derivative Works; or,
|
116 |
+
within a display generated by the Derivative Works, if and
|
117 |
+
wherever such third-party notices normally appear. The contents
|
118 |
+
of the NOTICE file are for informational purposes only and
|
119 |
+
do not modify the License. You may add Your own attribution
|
120 |
+
notices within Derivative Works that You distribute, alongside
|
121 |
+
or as an addendum to the NOTICE text from the Work, provided
|
122 |
+
that such additional attribution notices cannot be construed
|
123 |
+
as modifying the License.
|
124 |
+
|
125 |
+
You may add Your own copyright statement to Your modifications and
|
126 |
+
may provide additional or different license terms and conditions
|
127 |
+
for use, reproduction, or distribution of Your modifications, or
|
128 |
+
for any such Derivative Works as a whole, provided Your use,
|
129 |
+
reproduction, and distribution of the Work otherwise complies with
|
130 |
+
the conditions stated in this License.
|
131 |
+
|
132 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
133 |
+
any Contribution intentionally submitted for inclusion in the Work
|
134 |
+
by You to the Licensor shall be under the terms and conditions of
|
135 |
+
this License, without any additional terms or conditions.
|
136 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
137 |
+
the terms of any separate license agreement you may have executed
|
138 |
+
with Licensor regarding such Contributions.
|
139 |
+
|
140 |
+
6. Trademarks. This License does not grant permission to use the trade
|
141 |
+
names, trademarks, service marks, or product names of the Licensor,
|
142 |
+
except as required for reasonable and customary use in describing the
|
143 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
144 |
+
|
145 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
146 |
+
agreed to in writing, Licensor provides the Work (and each
|
147 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
148 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
149 |
+
implied, including, without limitation, any warranties or conditions
|
150 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
151 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
152 |
+
appropriateness of using or redistributing the Work and assume any
|
153 |
+
risks associated with Your exercise of permissions under this License.
|
154 |
+
|
155 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
156 |
+
whether in tort (including negligence), contract, or otherwise,
|
157 |
+
unless required by applicable law (such as deliberate and grossly
|
158 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
159 |
+
liable to You for damages, including any direct, indirect, special,
|
160 |
+
incidental, or consequential damages of any character arising as a
|
161 |
+
result of this License or out of the use or inability to use the
|
162 |
+
Work (including but not limited to damages for loss of goodwill,
|
163 |
+
work stoppage, computer failure or malfunction, or any and all
|
164 |
+
other commercial damages or losses), even if such Contributor
|
165 |
+
has been advised of the possibility of such damages.
|
166 |
+
|
167 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
168 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
169 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
170 |
+
or other liability obligations and/or rights consistent with this
|
171 |
+
License. However, in accepting such obligations, You may act only
|
172 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
173 |
+
of any other Contributor, and only if You agree to indemnify,
|
174 |
+
defend, and hold each Contributor harmless for any liability
|
175 |
+
incurred by, or claims asserted against, such Contributor by reason
|
176 |
+
of your accepting any such warranty or additional liability.
|
177 |
+
|
178 |
+
END OF TERMS AND CONDITIONS
|
179 |
+
|
180 |
+
APPENDIX: How to apply the Apache License to your work.
|
181 |
+
|
182 |
+
To apply the Apache License to your work, attach the following
|
183 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
184 |
+
replaced with your own identifying information. (Don't include
|
185 |
+
the brackets!) The text should be enclosed in the appropriate
|
186 |
+
comment syntax for the file format. We also recommend that a
|
187 |
+
file or class name and description of purpose be included on the
|
188 |
+
same "printed page" as the copyright notice for easier
|
189 |
+
identification within third-party archives.
|
190 |
+
|
191 |
+
Copyright 2018-2023 OpenMMLab.
|
192 |
+
|
193 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
194 |
+
you may not use this file except in compliance with the License.
|
195 |
+
You may obtain a copy of the License at
|
196 |
+
|
197 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
198 |
+
|
199 |
+
Unless required by applicable law or agreed to in writing, software
|
200 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
201 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
202 |
+
See the License for the specific language governing permissions and
|
203 |
+
limitations under the License.
|
mmdet_configs/README.md
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
`configs.tar` is a tarball of https://github.com/open-mmlab/mmdetection/tree/v2.24.1/configs.
|
2 |
+
The license file of the mmdetection is also included in this directory.
|
mmdet_configs/configs.tar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d2091e07da6b74a6cd694e895b653485f7ce9d5d17738a415ca77a56940b989
|
3 |
+
size 3389440
|
model.py
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import annotations
|
2 |
+
|
3 |
+
import os
|
4 |
+
import pathlib
|
5 |
+
import subprocess
|
6 |
+
import sys
|
7 |
+
|
8 |
+
if os.getenv('SYSTEM') == 'spaces':
|
9 |
+
import mim
|
10 |
+
|
11 |
+
mim.uninstall('mmcv-full', confirm_yes=True)
|
12 |
+
mim.install('mmcv-full==1.5.0', is_yes=True)
|
13 |
+
|
14 |
+
subprocess.run('pip uninstall -y opencv-python'.split())
|
15 |
+
subprocess.run('pip uninstall -y opencv-python-headless'.split())
|
16 |
+
subprocess.run('pip install opencv-python-headless==4.5.5.64'.split())
|
17 |
+
|
18 |
+
import huggingface_hub
|
19 |
+
import numpy as np
|
20 |
+
import torch
|
21 |
+
import torch.nn as nn
|
22 |
+
|
23 |
+
app_dir = pathlib.Path(__file__).parent
|
24 |
+
submodule_dir = app_dir / 'ViTPose/'
|
25 |
+
sys.path.insert(0, submodule_dir.as_posix())
|
26 |
+
|
27 |
+
from mmdet.apis import inference_detector, init_detector
|
28 |
+
from mmpose.apis import (inference_top_down_pose_model, init_pose_model,
|
29 |
+
process_mmdet_results, vis_pose_result)
|
30 |
+
|
31 |
+
HF_TOKEN = os.environ['HF_TOKEN']
|
32 |
+
|
33 |
+
|
34 |
+
class DetModel:
|
35 |
+
MODEL_DICT = {
|
36 |
+
'YOLOX-tiny': {
|
37 |
+
'config':
|
38 |
+
'mmdet_configs/configs/yolox/yolox_tiny_8x8_300e_coco.py',
|
39 |
+
'model':
|
40 |
+
'https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_tiny_8x8_300e_coco/yolox_tiny_8x8_300e_coco_20211124_171234-b4047906.pth',
|
41 |
+
},
|
42 |
+
'YOLOX-s': {
|
43 |
+
'config':
|
44 |
+
'mmdet_configs/configs/yolox/yolox_s_8x8_300e_coco.py',
|
45 |
+
'model':
|
46 |
+
'https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_s_8x8_300e_coco/yolox_s_8x8_300e_coco_20211121_095711-4592a793.pth',
|
47 |
+
},
|
48 |
+
'YOLOX-l': {
|
49 |
+
'config':
|
50 |
+
'mmdet_configs/configs/yolox/yolox_l_8x8_300e_coco.py',
|
51 |
+
'model':
|
52 |
+
'https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_l_8x8_300e_coco/yolox_l_8x8_300e_coco_20211126_140236-d3bd2b23.pth',
|
53 |
+
},
|
54 |
+
'YOLOX-x': {
|
55 |
+
'config':
|
56 |
+
'mmdet_configs/configs/yolox/yolox_x_8x8_300e_coco.py',
|
57 |
+
'model':
|
58 |
+
'https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_x_8x8_300e_coco/yolox_x_8x8_300e_coco_20211126_140254-1ef88d67.pth',
|
59 |
+
},
|
60 |
+
}
|
61 |
+
|
62 |
+
def __init__(self, device: str | torch.device):
|
63 |
+
self.device = torch.device(device)
|
64 |
+
self._load_all_models_once()
|
65 |
+
self.model_name = 'YOLOX-l'
|
66 |
+
self.model = self._load_model(self.model_name)
|
67 |
+
|
68 |
+
def _load_all_models_once(self) -> None:
|
69 |
+
for name in self.MODEL_DICT:
|
70 |
+
self._load_model(name)
|
71 |
+
|
72 |
+
def _load_model(self, name: str) -> nn.Module:
|
73 |
+
dic = self.MODEL_DICT[name]
|
74 |
+
return init_detector(dic['config'], dic['model'], device=self.device)
|
75 |
+
|
76 |
+
def set_model(self, name: str) -> None:
|
77 |
+
if name == self.model_name:
|
78 |
+
return
|
79 |
+
self.model_name = name
|
80 |
+
self.model = self._load_model(name)
|
81 |
+
|
82 |
+
def detect_and_visualize(
|
83 |
+
self, image: np.ndarray,
|
84 |
+
score_threshold: float) -> tuple[list[np.ndarray], np.ndarray]:
|
85 |
+
out = self.detect(image)
|
86 |
+
vis = self.visualize_detection_results(image, out, score_threshold)
|
87 |
+
return out, vis
|
88 |
+
|
89 |
+
def detect(self, image: np.ndarray) -> list[np.ndarray]:
|
90 |
+
image = image[:, :, ::-1] # RGB -> BGR
|
91 |
+
out = inference_detector(self.model, image)
|
92 |
+
return out
|
93 |
+
|
94 |
+
def visualize_detection_results(
|
95 |
+
self,
|
96 |
+
image: np.ndarray,
|
97 |
+
detection_results: list[np.ndarray],
|
98 |
+
score_threshold: float = 0.3) -> np.ndarray:
|
99 |
+
person_det = [detection_results[0]] + [np.array([]).reshape(0, 5)] * 79
|
100 |
+
|
101 |
+
image = image[:, :, ::-1] # RGB -> BGR
|
102 |
+
vis = self.model.show_result(image,
|
103 |
+
person_det,
|
104 |
+
score_thr=score_threshold,
|
105 |
+
bbox_color=None,
|
106 |
+
text_color=(200, 200, 200),
|
107 |
+
mask_color=None)
|
108 |
+
return vis[:, :, ::-1] # BGR -> RGB
|
109 |
+
|
110 |
+
|
111 |
+
class AppDetModel(DetModel):
|
112 |
+
def run(self, model_name: str, image: np.ndarray,
|
113 |
+
score_threshold: float) -> tuple[list[np.ndarray], np.ndarray]:
|
114 |
+
self.set_model(model_name)
|
115 |
+
return self.detect_and_visualize(image, score_threshold)
|
116 |
+
|
117 |
+
|
118 |
+
class PoseModel:
|
119 |
+
MODEL_DICT = {
|
120 |
+
'ViTPose-B (single-task train)': {
|
121 |
+
'config':
|
122 |
+
'ViTPose/configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/ViTPose_base_coco_256x192.py',
|
123 |
+
'model': 'models/vitpose-b.pth',
|
124 |
+
},
|
125 |
+
'ViTPose-L (single-task train)': {
|
126 |
+
'config':
|
127 |
+
'ViTPose/configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/ViTPose_large_coco_256x192.py',
|
128 |
+
'model': 'models/vitpose-l.pth',
|
129 |
+
},
|
130 |
+
'ViTPose-B (multi-task train, COCO)': {
|
131 |
+
'config':
|
132 |
+
'ViTPose/configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/ViTPose_base_coco_256x192.py',
|
133 |
+
'model': 'models/vitpose-b-multi-coco.pth',
|
134 |
+
},
|
135 |
+
'ViTPose-L (multi-task train, COCO)': {
|
136 |
+
'config':
|
137 |
+
'ViTPose/configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/ViTPose_large_coco_256x192.py',
|
138 |
+
'model': 'models/vitpose-l-multi-coco.pth',
|
139 |
+
},
|
140 |
+
}
|
141 |
+
|
142 |
+
def __init__(self, device: str | torch.device):
|
143 |
+
self.device = torch.device(device)
|
144 |
+
self.model_name = 'ViTPose-B (multi-task train, COCO)'
|
145 |
+
self.model = self._load_model(self.model_name)
|
146 |
+
|
147 |
+
def _load_all_models_once(self) -> None:
|
148 |
+
for name in self.MODEL_DICT:
|
149 |
+
self._load_model(name)
|
150 |
+
|
151 |
+
def _load_model(self, name: str) -> nn.Module:
|
152 |
+
dic = self.MODEL_DICT[name]
|
153 |
+
ckpt_path = huggingface_hub.hf_hub_download('hysts/ViTPose',
|
154 |
+
dic['model'],
|
155 |
+
use_auth_token=HF_TOKEN)
|
156 |
+
model = init_pose_model(dic['config'], ckpt_path, device=self.device)
|
157 |
+
return model
|
158 |
+
|
159 |
+
def set_model(self, name: str) -> None:
|
160 |
+
if name == self.model_name:
|
161 |
+
return
|
162 |
+
self.model_name = name
|
163 |
+
self.model = self._load_model(name)
|
164 |
+
|
165 |
+
def predict_pose_and_visualize(
|
166 |
+
self,
|
167 |
+
image: np.ndarray,
|
168 |
+
det_results: list[np.ndarray],
|
169 |
+
box_score_threshold: float,
|
170 |
+
kpt_score_threshold: float,
|
171 |
+
vis_dot_radius: int,
|
172 |
+
vis_line_thickness: int,
|
173 |
+
) -> tuple[list[dict[str, np.ndarray]], np.ndarray]:
|
174 |
+
out = self.predict_pose(image, det_results, box_score_threshold)
|
175 |
+
vis = self.visualize_pose_results(image, out, kpt_score_threshold,
|
176 |
+
vis_dot_radius, vis_line_thickness)
|
177 |
+
return out, vis
|
178 |
+
|
179 |
+
def predict_pose(
|
180 |
+
self,
|
181 |
+
image: np.ndarray,
|
182 |
+
det_results: list[np.ndarray],
|
183 |
+
box_score_threshold: float = 0.5) -> list[dict[str, np.ndarray]]:
|
184 |
+
image = image[:, :, ::-1] # RGB -> BGR
|
185 |
+
person_results = process_mmdet_results(det_results, 1)
|
186 |
+
out, _ = inference_top_down_pose_model(self.model,
|
187 |
+
image,
|
188 |
+
person_results=person_results,
|
189 |
+
bbox_thr=box_score_threshold,
|
190 |
+
format='xyxy')
|
191 |
+
return out
|
192 |
+
|
193 |
+
def visualize_pose_results(self,
|
194 |
+
image: np.ndarray,
|
195 |
+
pose_results: list[np.ndarray],
|
196 |
+
kpt_score_threshold: float = 0.3,
|
197 |
+
vis_dot_radius: int = 4,
|
198 |
+
vis_line_thickness: int = 1) -> np.ndarray:
|
199 |
+
image = image[:, :, ::-1] # RGB -> BGR
|
200 |
+
vis = vis_pose_result(self.model,
|
201 |
+
image,
|
202 |
+
pose_results,
|
203 |
+
kpt_score_thr=kpt_score_threshold,
|
204 |
+
radius=vis_dot_radius,
|
205 |
+
thickness=vis_line_thickness)
|
206 |
+
return vis[:, :, ::-1] # BGR -> RGB
|
207 |
+
|
208 |
+
|
209 |
+
class AppPoseModel(PoseModel):
|
210 |
+
def run(
|
211 |
+
self, model_name: str, image: np.ndarray,
|
212 |
+
det_results: list[np.ndarray], box_score_threshold: float,
|
213 |
+
kpt_score_threshold: float, vis_dot_radius: int,
|
214 |
+
vis_line_thickness: int
|
215 |
+
) -> tuple[list[dict[str, np.ndarray]], np.ndarray]:
|
216 |
+
self.set_model(model_name)
|
217 |
+
return self.predict_pose_and_visualize(image, det_results,
|
218 |
+
box_score_threshold,
|
219 |
+
kpt_score_threshold,
|
220 |
+
vis_dot_radius,
|
221 |
+
vis_line_thickness)
|
requirements.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
mmcv-full==1.5.0
|
2 |
+
mmdet==2.24.1
|
3 |
+
mmpose==0.25.1
|
4 |
+
numpy==1.22.4
|
5 |
+
opencv-python-headless==4.5.5.64
|
6 |
+
openmim==0.1.5
|
7 |
+
timm==0.5.4
|
8 |
+
torch==1.11.0
|
9 |
+
torchvision==0.12.0
|
style.css
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
h1 {
|
2 |
+
text-align: center;
|
3 |
+
}
|
4 |
+
div#det-result {
|
5 |
+
max-width: 600px;
|
6 |
+
max-height: 600px;
|
7 |
+
}
|
8 |
+
div#pose-result {
|
9 |
+
max-width: 600px;
|
10 |
+
max-height: 600px;
|
11 |
+
}
|
12 |
+
img#visitor-badge {
|
13 |
+
display: block;
|
14 |
+
margin: auto;
|
15 |
+
}
|