YOLO Poser
A Python package for human pose detection and visualization using YOLO.
Installation
pip install yolo-poser
Usage
Pose Detection
Process videos to detect and visualize human poses.
Command Line:
yolo-poser input_video.mp4 --output output.mp4 --output-format h264
Python API:
from yolo_poser import process_video
process_video(
input_path="input.mp4",
output_path="output.mp4",
output_format="h264",
debug=True
)
Video Cropping
Automatically crop videos to focus on detected people using YOLO person detection.
Command Line:
yolo-crop input_video.mp4 --padding 0.3 --output cropped.mp4
Options:
--padding: Padding around detected area (default: 0.5)--no-keep-proportions: Don't maintain original video proportions--no-preview: Skip preview and confirmation--debug: Save debug frames showing detections--output: Output video path (default: input_cropped.mp4)
Python API:
from yolo_poser import crop_video, calculate_crop_params
# Calculate crop parameters
bbox = (100, 100, 500, 700) # min_x, min_y, max_x, max_y
crop_params = calculate_crop_params(
video_path="input.mp4",
bbox=bbox,
padding=0.3,
keep_proportions=True
)
# Apply crop
crop_video(
input_path="input.mp4",
output_path="cropped.mp4",
crop_params=crop_params
)
Video Splitting
Split videos into shots based on audio peaks. Useful for creating training data or breaking down performances.
Command Line:
yolo-split input.mp4 --output-dir shots/ --peak-sensitivity 0.5 --shot-duration 2.5
Options:
--output-dir: Directory for output files (default: same as input)--peak-sensitivity: Peak detection sensitivity, 0.1-1.0 (default: 0.8). Lower values create more shots--shot-duration: Duration of each shot in seconds (default: 2.0)--debug: Keep temporary audio files--json: Output JSON list of generated files to stdout
Python API:
from yolo_poser.split import split_video
result = split_video(
input_path="input.mp4",
output_dir="shots/",
peak_sensitivity=0.8,
shot_duration=2.0
)
# Returns: {'chunks': ['shots/chunk_001.mp4', 'shots/chunk_002.mp4', ...]}
Audio Syncing
Sync audio from one video to another, with automatic duration adjustment.
Python API:
from yolo_poser import sync_audio
output_path = sync_audio(
source_video="original.mp4", # Video with audio
destination_video="processed.mp4", # Video without audio
output_path="final.mp4" # Optional
)
Web API
To use the HTTP API, first install with API dependencies:
pip install "yolo-poser[api]"
Start the API server:
yolo-poser-api [--host HOST] [--port PORT]
For example:
yolo-poser-api --host 127.0.0.1 --port 9000
Or programmatically:
from yolo_poser.api import app
import uvicorn
uvicorn.run(app, host="127.0.0.1", port=9000)
The API provides endpoints for:
- Processing videos from URLs: POST /detect/url
- Processing uploaded video files: POST /detect/file
- Health check: GET /health
See the API documentation at http://localhost:8000/docs when running the server.
Features
- Pose Detection: Human pose detection and visualization using YOLO
- Video Cropping: Automatically crop videos to focus on detected people
- Video Splitting: Split videos into shots based on audio peaks
- Audio Syncing: Sync audio from one video to another with automatic duration adjustment
- Multiple Output Formats: Support for MJPEG, H264, and WebM
- Smooth Tracking: Exponential smoothing for stable keypoint tracking
- HTTP API: FastAPI-based REST API for video processing
- Debug Mode: Performance metrics and visualization of detection results
Requirements
- Python 3.8+ (<3.13)
- PyTorch
- Ultralytics YOLO
- OpenCV
- NumPy
- SciPy (for video splitting)
- FFmpeg (for video processing and audio syncing)
Development
Continuous Integration
This project uses GitHub Actions for continuous integration and deployment:
- Every push to the
mainbranch triggers a test build that publishes to TestPyPI - Tagged releases (e.g.
v0.1.0) trigger a build that publishes to PyPI
To release a new version:
- Update the version in
src/yolo_poser/__init__.py - Commit the changes
- Create and push a tag:
git tag v0.1.0
git push origin v0.1.0
The GitHub Action will automatically build and publish the new version to PyPI.
Local Development
- Clone the repository:
git clone https://github.com/tomdyson/yolo-poser.git
cd yolo-poser
- Install in development mode:
pip install -e .
License
MIT License
Metadata
Release files for yolo-poser 0.1.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yolo_poser-0.1.18.tar.gz | 5.6 MB | Without provenance | Details for yolo_poser-0.1.18.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yolo_poser-0.1.18-py3-none-any.whl | Python 3 | none | any | Details for yolo_poser-0.1.18-py3-none-any.whl |
Total release size: 11.1 MB
Release files / yolo_poser-0.1.18.tar.gz
| Download URL | yolo_poser-0.1.18.tar.gz |
|---|---|
| Size | 5.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79d8986b3ed6935f6727e9574d66377fffea806aa18b408d5b5aadeabfb7be4e
|
|
BLAKE2b-256 checksum How to use checksums |
6478174d5250617de34978e7472d097f723b86cb548cc5ca204205b6525a097f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / yolo_poser-0.1.18-py3-none-any.whl
| Download URL | yolo_poser-0.1.18-py3-none-any.whl |
|---|---|
| Size | 5.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ae34a30743363b5694cc6317bf16a9e24bd058e074a7a6246d2882454563ebe
|
|
BLAKE2b-256 checksum How to use checksums |
d9be66606577cb89bddaacd8e3581d9c2828bd678f30db7c114535f7fc325d15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for yolo-poser 0.1.18
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.