rtmo-ort


Namertmo-ort JSON
Version 0.1.0.post1 PyPI version JSON
download
home_pageNone
SummaryRTMO pose estimation with pure ONNX Runtime (tiny class + CLI).
upload_time2025-08-29 19:34:51
maintainerNone
docs_urlNone
authorNamas
requires_python>=3.8
licenseNone
keywords rtmo keypoints mmpose onnxruntime pose realtime
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RTMO-ORT — RTMO pose on pure ONNX Runtime

Minimal, fast RTMO (person detection + 2D pose) inference with **no heavy frameworks**. One tiny Python class, three simple CLIs, and ready-to-download ONNX models.

If this saves you time, please consider **starring the repo** — it really helps.

---

## Install (two ways)

### A) pip (recommended)
```bash
# CPU
pip install "rtmo-ort[cpu]"

# GPU (uses onnxruntime-gpu if present)
pip install "rtmo-ort[gpu]"
```

### B) From source
```bash
git clone https://github.com/namas191297/rtmo-ort.git
cd rtmo-ort
python -m venv .venv && source .venv/bin/activate   # optional
pip install -e ".[cpu]"                             # or ".[gpu]"
```

Python ≥ 3.8. Works on Linux/macOS/Windows.

---

## Get models

This repo ships a helper to fetch ONNX files into `models/…`.

```bash
# fetch a specific release tag (e.g., v0.1.0)
./get_models.sh v0.1.0

# or omit to use the default in the script
./get_models.sh
```

You can also download individual models manually (see table below).  
By default, the CLIs look in `models/`. To change that, set `RTMO_MODELS_DIR=/path/to/models`.

---

## Models table (direct downloads)

Each file should be placed at `models/<name>/<name>.onnx`.  
Example: `models/rtmo_s_640x640_coco/rtmo_s_640x640_coco.onnx`.

> Replace `v0.1.0` with your chosen tag if needed.

| Size   | Dataset         | Input | Download |
|:------:|:----------------|:----:|:--|
| tiny   | body7           | 416  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_t_416x416_body7.onnx |
| small  | coco            | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_s_640x640_coco.onnx |
| small  | crowdpose       | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_s_640x640_crowdpose.onnx |
| small  | body7           | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_s_640x640_body7.onnx |
| medium | coco            | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_m_640x640_coco.onnx |
| medium | body7           | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_m_640x640_body7.onnx |
| large  | coco            | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_l_640x640_coco.onnx |
| large  | crowdpose       | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_l_640x640_crowdpose.onnx |
| large  | body7           | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_l_640x640_body7.onnx |
| large  | body7_crowdpose | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_l_640x640_body7_crowdpose.onnx |

---

## Use the CLIs

All commands accept the same presets and thresholds:

- `--model-type {tiny,small,medium,large}` (default: `small`)
- `--dataset {coco,crowdpose,body7,body7_crowdpose}` (default: `coco`)
- `--no-letterbox` (disable square letterbox; default is letterbox on)
- `--score-thr`, `--kpt-thr`, `--max-det`
- `--device {cpu,cuda}`
- `--onnx /path/to/model.onnx` (overrides presets)
- `--models-dir /path/to/models` (default: `models`)

### Image
```bash
rtmo-image --model-type small --dataset coco \
  --input path/to/in.jpg --output out.jpg --device cpu
```

### Video
```bash
rtmo-video --model-type small --dataset coco \
  --input in.mp4 --output out.mp4 --device cuda
```

### Webcam
```bash
rtmo-webcam --model-type small --dataset coco --device cpu
# pick another camera:
# rtmo-webcam --cam 1
```

---

## Python API

```python
import cv2
from rtmo_ort import PoseEstimatorORT

onnx = "models/rtmo_s_640x640_coco/rtmo_s_640x640_coco.onnx"
pe = PoseEstimatorORT(onnx, device="cpu", letterbox=True)

img = cv2.imread("assets/demo.jpg")
boxes, kpts, scores = pe.infer(img)

vis = pe.annotate(img, boxes, kpts, scores)
cv2.imwrite("vis.jpg", vis)
```

**Outputs**
- `boxes`: `[N,4]` in xyxy
- `kpts`: `[N,K,3]` with `(x,y,score)` per keypoint
- `scores`: `[N]` person scores

---

## Notes and tips

- **NMS is fused** inside the ONNX models. Do not run NMS again.
- **Letterbox vs. stretch.** Letterbox (default) preserves aspect ratio and generally matches training; stretching (`--no-letterbox`) may reduce accuracy but can be fine for quick demos.
- **Keypoints count.** COCO = 17; CrowdPose = 14; Body7 is coarse. Some Body7 exports use 17-dim outputs for compatibility; semantics remain coarse.
- **GPU provider.** If you installed `onnxruntime-gpu`, use `--device cuda`. If CUDA isn’t found, ONNX Runtime falls back to CPU.
- **Codecs.** If `rtmo-video` fails to write a file, try `mp4v`, `XVID`, or install OS-level codecs.

---

## Project structure

```
rtmo_ort/
  ├─ estimator.py   # PoseEstimatorORT (ONNX Runtime + postprocess + drawing)
  ├─ cli.py         # rtmo-image / rtmo-video / rtmo-webcam
  └─ __init__.py
models/             # place ONNX files here (or use --onnx)
get_models.sh       # fetches model files for a given tag
```

---

If you want something specific, open an issue.

---

## Contributing & support

Issues and pull requests are welcome. If you found this useful, **star the repo** and consider sharing a short demo clip — it helps others discover it.

- Website: namasbhandari.in
- Repo: https://github.com/namas191297/rtmo-ort  
- Issues: https://github.com/namas191297/rtmo-ort/issues  
- License: Apache-2.0
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "rtmo-ort",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "RTMO, keypoints, mmpose, onnxruntime, pose, realtime",
    "author": "Namas",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/43/e9/2eee2e14770d29ae7dadf433709c9c67c20ef75ae1676ed6974fd95db7e0/rtmo_ort-0.1.0.post1.tar.gz",
    "platform": null,
    "description": "# RTMO-ORT \u2014 RTMO pose on pure ONNX Runtime\n\nMinimal, fast RTMO (person detection + 2D pose) inference with **no heavy frameworks**. One tiny Python class, three simple CLIs, and ready-to-download ONNX models.\n\nIf this saves you time, please consider **starring the repo** \u2014 it really helps.\n\n---\n\n## Install (two ways)\n\n### A) pip (recommended)\n```bash\n# CPU\npip install \"rtmo-ort[cpu]\"\n\n# GPU (uses onnxruntime-gpu if present)\npip install \"rtmo-ort[gpu]\"\n```\n\n### B) From source\n```bash\ngit clone https://github.com/namas191297/rtmo-ort.git\ncd rtmo-ort\npython -m venv .venv && source .venv/bin/activate   # optional\npip install -e \".[cpu]\"                             # or \".[gpu]\"\n```\n\nPython \u2265 3.8. Works on Linux/macOS/Windows.\n\n---\n\n## Get models\n\nThis repo ships a helper to fetch ONNX files into `models/\u2026`.\n\n```bash\n# fetch a specific release tag (e.g., v0.1.0)\n./get_models.sh v0.1.0\n\n# or omit to use the default in the script\n./get_models.sh\n```\n\nYou can also download individual models manually (see table below).  \nBy default, the CLIs look in `models/`. To change that, set `RTMO_MODELS_DIR=/path/to/models`.\n\n---\n\n## Models table (direct downloads)\n\nEach file should be placed at `models/<name>/<name>.onnx`.  \nExample: `models/rtmo_s_640x640_coco/rtmo_s_640x640_coco.onnx`.\n\n> Replace `v0.1.0` with your chosen tag if needed.\n\n| Size   | Dataset         | Input | Download |\n|:------:|:----------------|:----:|:--|\n| tiny   | body7           | 416  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_t_416x416_body7.onnx |\n| small  | coco            | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_s_640x640_coco.onnx |\n| small  | crowdpose       | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_s_640x640_crowdpose.onnx |\n| small  | body7           | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_s_640x640_body7.onnx |\n| medium | coco            | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_m_640x640_coco.onnx |\n| medium | body7           | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_m_640x640_body7.onnx |\n| large  | coco            | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_l_640x640_coco.onnx |\n| large  | crowdpose       | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_l_640x640_crowdpose.onnx |\n| large  | body7           | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_l_640x640_body7.onnx |\n| large  | body7_crowdpose | 640  | https://github.com/namas191297/rtmo-ort/releases/download/v0.1.0/rtmo_l_640x640_body7_crowdpose.onnx |\n\n---\n\n## Use the CLIs\n\nAll commands accept the same presets and thresholds:\n\n- `--model-type {tiny,small,medium,large}` (default: `small`)\n- `--dataset {coco,crowdpose,body7,body7_crowdpose}` (default: `coco`)\n- `--no-letterbox` (disable square letterbox; default is letterbox on)\n- `--score-thr`, `--kpt-thr`, `--max-det`\n- `--device {cpu,cuda}`\n- `--onnx /path/to/model.onnx` (overrides presets)\n- `--models-dir /path/to/models` (default: `models`)\n\n### Image\n```bash\nrtmo-image --model-type small --dataset coco \\\n  --input path/to/in.jpg --output out.jpg --device cpu\n```\n\n### Video\n```bash\nrtmo-video --model-type small --dataset coco \\\n  --input in.mp4 --output out.mp4 --device cuda\n```\n\n### Webcam\n```bash\nrtmo-webcam --model-type small --dataset coco --device cpu\n# pick another camera:\n# rtmo-webcam --cam 1\n```\n\n---\n\n## Python API\n\n```python\nimport cv2\nfrom rtmo_ort import PoseEstimatorORT\n\nonnx = \"models/rtmo_s_640x640_coco/rtmo_s_640x640_coco.onnx\"\npe = PoseEstimatorORT(onnx, device=\"cpu\", letterbox=True)\n\nimg = cv2.imread(\"assets/demo.jpg\")\nboxes, kpts, scores = pe.infer(img)\n\nvis = pe.annotate(img, boxes, kpts, scores)\ncv2.imwrite(\"vis.jpg\", vis)\n```\n\n**Outputs**\n- `boxes`: `[N,4]` in xyxy\n- `kpts`: `[N,K,3]` with `(x,y,score)` per keypoint\n- `scores`: `[N]` person scores\n\n---\n\n## Notes and tips\n\n- **NMS is fused** inside the ONNX models. Do not run NMS again.\n- **Letterbox vs. stretch.** Letterbox (default) preserves aspect ratio and generally matches training; stretching (`--no-letterbox`) may reduce accuracy but can be fine for quick demos.\n- **Keypoints count.** COCO = 17; CrowdPose = 14; Body7 is coarse. Some Body7 exports use 17-dim outputs for compatibility; semantics remain coarse.\n- **GPU provider.** If you installed `onnxruntime-gpu`, use `--device cuda`. If CUDA isn\u2019t found, ONNX Runtime falls back to CPU.\n- **Codecs.** If `rtmo-video` fails to write a file, try `mp4v`, `XVID`, or install OS-level codecs.\n\n---\n\n## Project structure\n\n```\nrtmo_ort/\n  \u251c\u2500 estimator.py   # PoseEstimatorORT (ONNX Runtime + postprocess + drawing)\n  \u251c\u2500 cli.py         # rtmo-image / rtmo-video / rtmo-webcam\n  \u2514\u2500 __init__.py\nmodels/             # place ONNX files here (or use --onnx)\nget_models.sh       # fetches model files for a given tag\n```\n\n---\n\nIf you want something specific, open an issue.\n\n---\n\n## Contributing & support\n\nIssues and pull requests are welcome. If you found this useful, **star the repo** and consider sharing a short demo clip \u2014 it helps others discover it.\n\n- Website: namasbhandari.in\n- Repo: https://github.com/namas191297/rtmo-ort  \n- Issues: https://github.com/namas191297/rtmo-ort/issues  \n- License: Apache-2.0",
    "bugtrack_url": null,
    "license": null,
    "summary": "RTMO pose estimation with pure ONNX Runtime (tiny class + CLI).",
    "version": "0.1.0.post1",
    "project_urls": {
        "Homepage": "https://github.com/namas191297/rtmo-ort",
        "Issues": "https://github.com/namas191297/rtmo-ort/issues"
    },
    "split_keywords": [
        "rtmo",
        " keypoints",
        " mmpose",
        " onnxruntime",
        " pose",
        " realtime"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fd14551a1922c37b6dcebc3c1ff57c2a3f5f73e2304542aeb5005485beacc6b6",
                "md5": "d4a50d89aa77670fdc4ba2d65987bc81",
                "sha256": "4fd71980d2762555f5ce159be9193cd1dd82d8e45af1462b8091bc10b795555c"
            },
            "downloads": -1,
            "filename": "rtmo_ort-0.1.0.post1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d4a50d89aa77670fdc4ba2d65987bc81",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11887,
            "upload_time": "2025-08-29T19:34:50",
            "upload_time_iso_8601": "2025-08-29T19:34:50.300898Z",
            "url": "https://files.pythonhosted.org/packages/fd/14/551a1922c37b6dcebc3c1ff57c2a3f5f73e2304542aeb5005485beacc6b6/rtmo_ort-0.1.0.post1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "43e92eee2e14770d29ae7dadf433709c9c67c20ef75ae1676ed6974fd95db7e0",
                "md5": "ff172e2f4fe39964d1c93f05ebe5beaa",
                "sha256": "dab94ada57abccc4a898380fcaf3510d2d15759f034c7528db0d2f6b1144fe5e"
            },
            "downloads": -1,
            "filename": "rtmo_ort-0.1.0.post1.tar.gz",
            "has_sig": false,
            "md5_digest": "ff172e2f4fe39964d1c93f05ebe5beaa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8252,
            "upload_time": "2025-08-29T19:34:51",
            "upload_time_iso_8601": "2025-08-29T19:34:51.227632Z",
            "url": "https://files.pythonhosted.org/packages/43/e9/2eee2e14770d29ae7dadf433709c9c67c20ef75ae1676ed6974fd95db7e0/rtmo_ort-0.1.0.post1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-29 19:34:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "namas191297",
    "github_project": "rtmo-ort",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "rtmo-ort"
}
        
Elapsed time: 1.08271s