Spaces:
Running
on
Zero
Running
on
Zero
update readme
Browse files
README.md
CHANGED
@@ -13,23 +13,61 @@ short_description: RTMO PyTorch Checkpoint Tester
|
|
13 |
|
14 |
# RTMO PyTorch Checkpoint Tester
|
15 |
|
16 |
-
This HuggingFace Space
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
## Usage
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
## Files
|
24 |
-
- **app.py**: Gradio application script that loads the RTMO model, runs inference, and displays results.
|
25 |
-
- **requirements.txt**: Python dependencies, including the patched MMCV build and MMPose.
|
26 |
|
27 |
-
|
28 |
-
|
|
|
29 |
|
30 |
## Development
|
31 |
-
If you need to update dependencies or change the model, modify `requirements.txt` and `app.py` accordingly.
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
# RTMO PyTorch Checkpoint Tester
|
15 |
|
16 |
+
This HuggingFace Space provides a real-time 2D multi-person pose estimation demo using the RTMO model from OpenMMLab, accelerated with ZeroGPU.
|
17 |
+
|
18 |
+
## Features
|
19 |
+
|
20 |
+
- **Remote Checkpoint Selection**: Choose from multiple pre-trained variants (COCO, BODY7, CrowdPose, retrainable RTMO-s) via a dropdown.
|
21 |
+
- **Custom Checkpoint Upload**: Upload your own `.pth` file; the application auto-detects RTMO-t/s/m/l variants.
|
22 |
+
- **Threshold Adjustment**: Fine-tune **Bounding Box Threshold** and **NMS Threshold** sliders to refine detections.
|
23 |
+
- **Example Images**: Three license-free images with people are included for quick testing via the **Examples** panel.
|
24 |
+
- **ZeroGPU Acceleration**: Utilizes the `@spaces.GPU()` decorator for GPU inference on HuggingFace Spaces.
|
25 |
|
26 |
## Usage
|
27 |
+
|
28 |
+
1. **Upload Image**: Drag-and-drop or select an image in the **Upload Image** component (or choose from **Examples**).
|
29 |
+
2. **Select Remote Checkpoint**: Pick a preloaded variant from the dropdown menu.
|
30 |
+
3. **(Optional) Upload Your Own Checkpoint**: Provide a `.pth` file to override the remote selection; the model variant is detected automatically.
|
31 |
+
4. **Adjust Thresholds**: Set **Bounding Box Threshold** (`bbox_thr`) and **NMS Threshold** (`nms_thr`) to control confidence and suppression behavior.
|
32 |
+
5. **Run Inference**: Click **Run Inference**. The annotated image and the active checkpoint name will appear.
|
33 |
+
|
34 |
+
## Remote Checkpoints
|
35 |
+
|
36 |
+
The following variants are available out of the box:
|
37 |
+
|
38 |
+
- `rtmo-s_8xb32-600e_coco`
|
39 |
+
- `rtmo-m_16xb16-600e_coco`
|
40 |
+
- `rtmo-l_16xb16-600e_coco`
|
41 |
+
- `rtmo-t_8xb32-600e_body7`
|
42 |
+
- `rtmo-s_8xb32-600e_body7`
|
43 |
+
- `rtmo-m_16xb16-600e_body7`
|
44 |
+
- `rtmo-l_16xb16-600e_body7`
|
45 |
+
- `rtmo-s_8xb32-700e_crowdpose`
|
46 |
+
- `rtmo-m_16xb16-700e_crowdpose`
|
47 |
+
- `rtmo-l_16xb16-700e_crowdpose`
|
48 |
+
- `rtmo-s_coco_retrainable` (from Hugging Face)
|
49 |
+
|
50 |
+
## Implementation Details
|
51 |
+
|
52 |
+
- **GPU Decorator**: `@spaces.GPU()` marks the `predict` function for GPU execution under ZeroGPU.
|
53 |
+
- **Inference API**: Leverages `MMPoseInferencer` from MMPose with `pose2d`, `pose2d_weights`, and category `[0]` for person detection.
|
54 |
+
- **Monkey-Patch**: Applies a regex patch to bypass `mmdet`’s MMCV version assertion for compatibility.
|
55 |
+
- **Variant Detection**: Inspects `backbone.stem.conv.conv.weight` channels in the checkpoint to select the correct RTMO variant.
|
56 |
+
- **Checkpoint Management**: Remote files are downloaded to `/tmp/{key}.pth` on demand; uploads use the provided local path.
|
57 |
+
- **Output**: Saves visualization images to `/tmp/vis` and displays the first result in the UI.
|
58 |
|
59 |
## Files
|
|
|
|
|
60 |
|
61 |
+
- **app.py**: Main Gradio application script.
|
62 |
+
- **requirements.txt**: Python dependencies, including MMCV and MMPose.
|
63 |
+
- **README.md**: This documentation file.
|
64 |
|
65 |
## Development
|
|
|
66 |
|
67 |
+
To update dependencies, edit `requirements.txt`. To extend functionality or add new variants, modify `app.py` accordingly.
|
68 |
+
|
69 |
+
## Future Plans
|
70 |
+
|
71 |
+
1. Support video input streams.
|
72 |
+
2. Enable ONNX model inference via `rtmlib`.
|
73 |
+
|