Upload 3 files
Browse files- packages.txt +5 -4
- requirements.txt +93 -91
- visualize_pose.py +71 -30
packages.txt
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
libgl1
|
| 2 |
-
libglib2.0-0
|
| 3 |
-
libgles2
|
| 4 |
-
libegl1
|
|
|
|
|
|
| 1 |
+
libgl1
|
| 2 |
+
libglib2.0-0
|
| 3 |
+
libgles2
|
| 4 |
+
libegl1
|
| 5 |
+
ffmpeg
|
requirements.txt
CHANGED
|
@@ -1,91 +1,93 @@
|
|
| 1 |
-
absl-py==2.4.0
|
| 2 |
-
accelerate==1.14.0
|
| 3 |
-
annotated-doc==0.0.4
|
| 4 |
-
annotated-types==0.7.0
|
| 5 |
-
anyio==4.14.0
|
| 6 |
-
brotli==1.2.0
|
| 7 |
-
certifi==2026.6.17
|
| 8 |
-
cffi==2.0.0
|
| 9 |
-
charset-normalizer==3.4.7
|
| 10 |
-
click==8.4.1
|
| 11 |
-
colorama==0.4.6
|
| 12 |
-
contourpy==1.3.3
|
| 13 |
-
cycler==0.12.1
|
| 14 |
-
decord==0.6.0
|
| 15 |
-
einops==0.8.2
|
| 16 |
-
fastapi==0.138.0
|
| 17 |
-
filelock==3.29.0
|
| 18 |
-
flatbuffers==25.12.19
|
| 19 |
-
fonttools==4.63.0
|
| 20 |
-
fsspec==2026.4.0
|
| 21 |
-
gradio==5.50.0
|
| 22 |
-
gradio-client==1.14.0
|
| 23 |
-
groovy==0.1.2
|
| 24 |
-
h11==0.16.0
|
| 25 |
-
hf-xet==1.5.1
|
| 26 |
-
httpcore==1.0.9
|
| 27 |
-
httpx==0.28.1
|
| 28 |
-
huggingface-hub==0.36.2
|
| 29 |
-
idna==3.18
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
python-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
absl-py==2.4.0
|
| 2 |
+
accelerate==1.14.0
|
| 3 |
+
annotated-doc==0.0.4
|
| 4 |
+
annotated-types==0.7.0
|
| 5 |
+
anyio==4.14.0
|
| 6 |
+
brotli==1.2.0
|
| 7 |
+
certifi==2026.6.17
|
| 8 |
+
cffi==2.0.0
|
| 9 |
+
charset-normalizer==3.4.7
|
| 10 |
+
click==8.4.1
|
| 11 |
+
colorama==0.4.6
|
| 12 |
+
contourpy==1.3.3
|
| 13 |
+
cycler==0.12.1
|
| 14 |
+
decord==0.6.0
|
| 15 |
+
einops==0.8.2
|
| 16 |
+
fastapi==0.138.0
|
| 17 |
+
filelock==3.29.0
|
| 18 |
+
flatbuffers==25.12.19
|
| 19 |
+
fonttools==4.63.0
|
| 20 |
+
fsspec==2026.4.0
|
| 21 |
+
gradio==5.50.0
|
| 22 |
+
gradio-client==1.14.0
|
| 23 |
+
groovy==0.1.2
|
| 24 |
+
h11==0.16.0
|
| 25 |
+
hf-xet==1.5.1
|
| 26 |
+
httpcore==1.0.9
|
| 27 |
+
httpx==0.28.1
|
| 28 |
+
huggingface-hub==0.36.2
|
| 29 |
+
idna==3.18
|
| 30 |
+
imageio==2.37.3
|
| 31 |
+
imageio-ffmpeg==0.6.0
|
| 32 |
+
Jinja2==3.1.6
|
| 33 |
+
kiwisolver==1.5.0
|
| 34 |
+
markdown-it-py==4.2.0
|
| 35 |
+
MarkupSafe==3.0.3
|
| 36 |
+
matplotlib==3.11.0
|
| 37 |
+
mdurl==0.1.2
|
| 38 |
+
mediapipe==0.10.35
|
| 39 |
+
mpmath==1.3.0
|
| 40 |
+
networkx==3.6.1
|
| 41 |
+
numpy==2.4.4
|
| 42 |
+
nvidia-ml-py==13.610.43
|
| 43 |
+
opencv-contrib-python==4.13.0.92
|
| 44 |
+
opencv-python==4.13.0.92
|
| 45 |
+
orjson==3.11.9
|
| 46 |
+
packaging==26.0
|
| 47 |
+
pandas<3.0
|
| 48 |
+
pillow<12.0
|
| 49 |
+
pip==26.1.2
|
| 50 |
+
polars==1.41.2
|
| 51 |
+
polars-runtime-32==1.41.2
|
| 52 |
+
protobuf==7.35.1
|
| 53 |
+
psutil==7.2.2
|
| 54 |
+
pycparser==3.0
|
| 55 |
+
pydantic<=2.12.3
|
| 56 |
+
pydub==0.25.1
|
| 57 |
+
Pygments==2.20.0
|
| 58 |
+
pyparsing==3.3.2
|
| 59 |
+
python-dateutil==2.9.0.post0
|
| 60 |
+
python-dotenv==1.2.2
|
| 61 |
+
python-multipart==0.0.32
|
| 62 |
+
pytz==2026.2
|
| 63 |
+
PyYAML==6.0.3
|
| 64 |
+
regex==2026.5.9
|
| 65 |
+
requests==2.34.2
|
| 66 |
+
rich==15.0.0
|
| 67 |
+
safehttpx==0.1.7
|
| 68 |
+
safetensors==0.8.0
|
| 69 |
+
scipy==1.17.1
|
| 70 |
+
semantic-version==2.10.0
|
| 71 |
+
sentencepiece==0.2.1
|
| 72 |
+
setuptools==70.2.0
|
| 73 |
+
shellingham==1.5.4
|
| 74 |
+
six==1.17.0
|
| 75 |
+
sounddevice==0.5.5
|
| 76 |
+
starlette>=0.40.0,<1.0
|
| 77 |
+
sympy==1.14.0
|
| 78 |
+
tiktoken==0.13.0
|
| 79 |
+
tokenizers==0.19.1
|
| 80 |
+
tomlkit>=0.12.0,<0.14.0
|
| 81 |
+
torch==2.12.1+cpu
|
| 82 |
+
torchvision==0.27.1+cpu
|
| 83 |
+
tqdm==4.68.3
|
| 84 |
+
transformers==4.44.2
|
| 85 |
+
typer==0.25.1
|
| 86 |
+
typing_extensions==4.15.0
|
| 87 |
+
typing-inspection==0.4.2
|
| 88 |
+
tzdata==2026.2
|
| 89 |
+
ultralytics==8.4.75
|
| 90 |
+
ultralytics-thop==2.0.20
|
| 91 |
+
urllib3==2.7.0
|
| 92 |
+
uvicorn==0.49.0
|
| 93 |
+
wheel==0.47.0
|
visualize_pose.py
CHANGED
|
@@ -9,12 +9,17 @@ Encodes the output as a high-definition H.264 MP4 video for browser playback.
|
|
| 9 |
"""
|
| 10 |
|
| 11 |
import os
|
|
|
|
| 12 |
import tempfile
|
| 13 |
import time
|
| 14 |
import subprocess
|
| 15 |
import cv2
|
| 16 |
import numpy as np
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# ==============================================================================
|
| 20 |
# 1. LANDMARK SKELETON CONNECTIONS & FACIAL DETAIL INDICES
|
|
@@ -328,35 +333,71 @@ def render_keypoints_video(
|
|
| 328 |
ts = int(time.time() * 1000)
|
| 329 |
out_path = os.path.join(out_dir, f"keypoints_1080p_{ts}.mp4")
|
| 330 |
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 360 |
|
| 361 |
if os.path.exists(out_path) and os.path.getsize(out_path) > 0:
|
| 362 |
print(f"Rendered crisp 1080p keypoints video: {out_w}x{out_h} at {out_path}")
|
|
|
|
| 9 |
"""
|
| 10 |
|
| 11 |
import os
|
| 12 |
+
import shutil
|
| 13 |
import tempfile
|
| 14 |
import time
|
| 15 |
import subprocess
|
| 16 |
import cv2
|
| 17 |
import numpy as np
|
| 18 |
+
|
| 19 |
+
try:
|
| 20 |
+
import imageio_ffmpeg
|
| 21 |
+
except ImportError:
|
| 22 |
+
imageio_ffmpeg = None
|
| 23 |
|
| 24 |
# ==============================================================================
|
| 25 |
# 1. LANDMARK SKELETON CONNECTIONS & FACIAL DETAIL INDICES
|
|
|
|
| 333 |
ts = int(time.time() * 1000)
|
| 334 |
out_path = os.path.join(out_dir, f"keypoints_1080p_{ts}.mp4")
|
| 335 |
|
| 336 |
+
# Resolve ffmpeg binary (from imageio_ffmpeg, system PATH, or fallback)
|
| 337 |
+
ffmpeg_bin = None
|
| 338 |
+
if imageio_ffmpeg is not None:
|
| 339 |
+
try:
|
| 340 |
+
ffmpeg_bin = imageio_ffmpeg.get_ffmpeg_exe()
|
| 341 |
+
except Exception:
|
| 342 |
+
ffmpeg_bin = None
|
| 343 |
+
if not ffmpeg_bin:
|
| 344 |
+
ffmpeg_bin = shutil.which("ffmpeg")
|
| 345 |
+
|
| 346 |
+
use_ffmpeg = False
|
| 347 |
+
if ffmpeg_bin:
|
| 348 |
+
try:
|
| 349 |
+
test_proc = subprocess.run([ffmpeg_bin, "-version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 350 |
+
if test_proc.returncode == 0:
|
| 351 |
+
use_ffmpeg = True
|
| 352 |
+
except Exception:
|
| 353 |
+
use_ffmpeg = False
|
| 354 |
+
|
| 355 |
+
if use_ffmpeg:
|
| 356 |
+
cmd = [
|
| 357 |
+
ffmpeg_bin, "-y",
|
| 358 |
+
"-f", "rawvideo",
|
| 359 |
+
"-vcodec", "rawvideo",
|
| 360 |
+
"-s", f"{out_w}x{out_h}",
|
| 361 |
+
"-pix_fmt", "rgb24",
|
| 362 |
+
"-r", str(fps),
|
| 363 |
+
"-i", "-",
|
| 364 |
+
"-c:v", "libx264",
|
| 365 |
+
"-preset", "fast",
|
| 366 |
+
"-crf", "18", # Near lossless visual quality
|
| 367 |
+
"-pix_fmt", "yuv420p",
|
| 368 |
+
"-movflags", "+faststart",
|
| 369 |
+
out_path
|
| 370 |
+
]
|
| 371 |
+
|
| 372 |
+
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 373 |
+
for frame, kps in zip(video_frames, keypoints_list):
|
| 374 |
+
drawn = draw_keypoints_frame(
|
| 375 |
+
frame=frame,
|
| 376 |
+
kps=kps,
|
| 377 |
+
target_width=out_w,
|
| 378 |
+
target_height=out_h,
|
| 379 |
+
**render_kwargs
|
| 380 |
+
)
|
| 381 |
+
proc.stdin.write(drawn.tobytes())
|
| 382 |
+
proc.stdin.close()
|
| 383 |
+
proc.wait()
|
| 384 |
+
else:
|
| 385 |
+
# Fallback to OpenCV VideoWriter if ffmpeg is completely absent
|
| 386 |
+
fourcc = cv2.VideoWriter_fourcc(*'avc1')
|
| 387 |
+
writer = cv2.VideoWriter(out_path, fourcc, float(fps), (out_w, out_h))
|
| 388 |
+
if not writer.isOpened():
|
| 389 |
+
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
| 390 |
+
writer = cv2.VideoWriter(out_path, fourcc, float(fps), (out_w, out_h))
|
| 391 |
+
for frame, kps in zip(video_frames, keypoints_list):
|
| 392 |
+
drawn = draw_keypoints_frame(
|
| 393 |
+
frame=frame,
|
| 394 |
+
kps=kps,
|
| 395 |
+
target_width=out_w,
|
| 396 |
+
target_height=out_h,
|
| 397 |
+
**render_kwargs
|
| 398 |
+
)
|
| 399 |
+
writer.write(cv2.cvtColor(drawn, cv2.COLOR_RGB2BGR))
|
| 400 |
+
writer.release()
|
| 401 |
|
| 402 |
if os.path.exists(out_path) and os.path.getsize(out_path) > 0:
|
| 403 |
print(f"Rendered crisp 1080p keypoints video: {out_w}x{out_h} at {out_path}")
|