Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: pytorch
|
| 4 |
+
pipeline_tag: object-detection
|
| 5 |
+
tags:
|
| 6 |
+
- object-center-detection
|
| 7 |
+
- keypoint-detection
|
| 8 |
+
- edge
|
| 9 |
+
- npu
|
| 10 |
+
- mobilenetv4
|
| 11 |
+
- coco
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# OCDet: Object Center Detection via Bounding Box-Aware Heatmap Prediction on Edge Devices with NPUs
|
| 15 |
+
|
| 16 |
+
OCDet is a lightweight Object Center Detection framework optimized for edge devices
|
| 17 |
+
with NPUs. It predicts heatmaps of object center probabilities and extracts center
|
| 18 |
+
points via peak identification. Built on an NPU-friendly Semantic FPN with
|
| 19 |
+
MobileNetV4 backbones, OCDet is trained with Balanced Continuous Focal Loss (BCFL)
|
| 20 |
+
and evaluated with the Center Alignment Score (CAS).
|
| 21 |
+
|
| 22 |
+
- **Code:** https://github.com/chen-xin-94/ocdet
|
| 23 |
+
- **Backbones:** MobileNetV4 (conv small / medium / large)
|
| 24 |
+
- **Tasks:** COCO 80-class object center detection (OCDet) and person-only center detection (PCDet)
|
| 25 |
+
|
| 26 |
+
## Files
|
| 27 |
+
|
| 28 |
+
This repo hosts 10 checkpoints. **Each `<model>.pt` has a matching `<model>.yaml`**
|
| 29 |
+
that records the exact architecture and hyperparameters it was trained with.
|
| 30 |
+
Always load a weight together with its own `.yaml` β the training templates in the
|
| 31 |
+
GitHub `configs/` folder can disagree with the released weights (e.g. `pcdet-n`
|
| 32 |
+
was trained with `out_channel=32`, not `64`).
|
| 33 |
+
|
| 34 |
+
| Group | Weights |
|
| 35 |
+
|-------|---------|
|
| 36 |
+
| OCDet (COCO 80-class) | `ocdet-{n,s,m,l,x}.pt` (+ `.yaml`) |
|
| 37 |
+
| PCDet (person-only) | `pcdet-{n,s,m,l,x}.pt` (+ `.yaml`) |
|
| 38 |
+
|
| 39 |
+
## Model Zoo
|
| 40 |
+
|
| 41 |
+
### COCO 80-class Object Center Detection (OCDet)
|
| 42 |
+
|
| 43 |
+
| Model | #Params (M) | FLOPs (G) | NPU Latency i.MX 8M Plus (ms) | CAS β | CP β | MD β | P β | R β | F1 β |
|
| 44 |
+
|-------|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
| 45 |
+
| OCDet-N | 1.51 | 0.54 | 10.94 | 0.297 | 0.645 | 0.059 | 0.634 | 0.466 | 0.510 |
|
| 46 |
+
| OCDet-S | 1.59 | 0.94 | 24.25 | 0.313 | 0.644 | 0.055 | 0.621 | 0.507 | 0.531 |
|
| 47 |
+
| OCDet-M | 8.25 | 3.54 | 63.26 | 0.362 | 0.573 | 0.065 | 0.643 | 0.585 | 0.599 |
|
| 48 |
+
| OCDet-L | 31.88 | 7.67 | 94.14 | 0.389 | 0.563 | 0.064 | 0.694 | 0.596 | 0.630 |
|
| 49 |
+
| OCDet-X | 22.20 | 7.00 | 181.81 | 0.410 | 0.525 | 0.066 | 0.713 | 0.643 | 0.669 |
|
| 50 |
+
|
| 51 |
+
### Person Center Detection (PCDet)
|
| 52 |
+
|
| 53 |
+
| Model | #Params (M) | FLOPs (G) | NPU Latency i.MX 8M Plus (ms) | CAS β | CP β | MD β | P β | R β | F1 β |
|
| 54 |
+
|-------|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
| 55 |
+
| PCDet-N | 1.51 | 0.52 | 9.99 | 0.472 | 0.440 | 0.088 | 0.815 | 0.745 | 0.779 |
|
| 56 |
+
| PCDet-S | 1.59 | 0.92 | 18.41 | 0.506 | 0.411 | 0.083 | 0.830 | 0.762 | 0.794 |
|
| 57 |
+
| PCDet-M | 7.79 | 2.75 | 39.68 | 0.546 | 0.379 | 0.075 | 0.910 | 0.715 | 0.801 |
|
| 58 |
+
| PCDet-L | 30.96 | 6.06 | 60.47 | 0.557 | 0.366 | 0.077 | 0.894 | 0.750 | 0.816 |
|
| 59 |
+
| PCDet-X | 21.91 | 6.49 | 160.37 | 0.582 | 0.337 | 0.081 | 0.831 | 0.848 | 0.840 |
|
| 60 |
+
|
| 61 |
+
## Usage
|
| 62 |
+
|
| 63 |
+
Clone the [code](https://github.com/chen-xin-94/ocdet) and install its
|
| 64 |
+
dependencies, then download a weight together with its config:
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
mkdir -p weights
|
| 68 |
+
# either grab a single model + its config ...
|
| 69 |
+
wget -P weights https://huggingface.co/Moonxc/OCDet/resolve/main/pcdet-n.pt
|
| 70 |
+
wget -P weights https://huggingface.co/Moonxc/OCDet/resolve/main/pcdet-n.yaml
|
| 71 |
+
# ... or pull the whole repo at once
|
| 72 |
+
# pip install -U huggingface_hub && hf download Moonxc/OCDet --local-dir weights
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
Run inference (`predict.py` auto-loads `weights/pcdet-n.yaml` next to the weight):
|
| 76 |
+
|
| 77 |
+
```bash
|
| 78 |
+
python predict.py \
|
| 79 |
+
--input_path images/000000032081.jpg \
|
| 80 |
+
--trained weights/pcdet-n.pt \
|
| 81 |
+
--n_classes 1 \
|
| 82 |
+
--gpu -1 \
|
| 83 |
+
--min_distance 3 --threshold_abs 0.5 --input_size 320 \
|
| 84 |
+
--vis --save
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
## Citation
|
| 88 |
+
|
| 89 |
+
If you use OCDet, please cite the work and link back to the
|
| 90 |
+
[GitHub repository](https://github.com/chen-xin-94/ocdet).
|