File size: 3,628 Bytes
ba3f063
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
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
---
license: apache-2.0
library_name: pytorch
pipeline_tag: object-detection
tags:
- object-center-detection
- keypoint-detection
- edge
- npu
- mobilenetv4
- coco
---

# OCDet: Object Center Detection via Bounding Box-Aware Heatmap Prediction on Edge Devices with NPUs

OCDet is a lightweight Object Center Detection framework optimized for edge devices
with NPUs. It predicts heatmaps of object center probabilities and extracts center
points via peak identification. Built on an NPU-friendly Semantic FPN with
MobileNetV4 backbones, OCDet is trained with Balanced Continuous Focal Loss (BCFL)
and evaluated with the Center Alignment Score (CAS).

- **Code:** https://github.com/chen-xin-94/ocdet
- **Backbones:** MobileNetV4 (conv small / medium / large)
- **Tasks:** COCO 80-class object center detection (OCDet) and person-only center detection (PCDet)

## Files

This repo hosts 10 checkpoints. **Each `<model>.pt` has a matching `<model>.yaml`**
that records the exact architecture and hyperparameters it was trained with.
Always load a weight together with its own `.yaml` β€” the training templates in the
GitHub `configs/` folder can disagree with the released weights (e.g. `pcdet-n`
was trained with `out_channel=32`, not `64`).

| Group | Weights |
|-------|---------|
| OCDet (COCO 80-class) | `ocdet-{n,s,m,l,x}.pt` (+ `.yaml`) |
| PCDet (person-only)   | `pcdet-{n,s,m,l,x}.pt` (+ `.yaml`) |

## Model Zoo

### COCO 80-class Object Center Detection (OCDet)

| Model | #Params (M) | FLOPs (G) | NPU Latency i.MX 8M Plus (ms) | CAS ↑ | CP ↓ | MD ↓ | P ↑ | R ↑ | F1 ↑ |
|-------|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
| OCDet-N | 1.51 | 0.54 | 10.94 | 0.297 | 0.645 | 0.059 | 0.634 | 0.466 | 0.510 |
| OCDet-S | 1.59 | 0.94 | 24.25 | 0.313 | 0.644 | 0.055 | 0.621 | 0.507 | 0.531 |
| OCDet-M | 8.25 | 3.54 | 63.26 | 0.362 | 0.573 | 0.065 | 0.643 | 0.585 | 0.599 |
| OCDet-L | 31.88 | 7.67 | 94.14 | 0.389 | 0.563 | 0.064 | 0.694 | 0.596 | 0.630 |
| OCDet-X | 22.20 | 7.00 | 181.81 | 0.410 | 0.525 | 0.066 | 0.713 | 0.643 | 0.669 |

### Person Center Detection (PCDet)

| Model | #Params (M) | FLOPs (G) | NPU Latency i.MX 8M Plus (ms) | CAS ↑ | CP ↓ | MD ↓ | P ↑ | R ↑ | F1 ↑ |
|-------|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
| PCDet-N | 1.51 | 0.52 | 9.99 | 0.472 | 0.440 | 0.088 | 0.815 | 0.745 | 0.779 |
| PCDet-S | 1.59 | 0.92 | 18.41 | 0.506 | 0.411 | 0.083 | 0.830 | 0.762 | 0.794 |
| PCDet-M | 7.79 | 2.75 | 39.68 | 0.546 | 0.379 | 0.075 | 0.910 | 0.715 | 0.801 |
| PCDet-L | 30.96 | 6.06 | 60.47 | 0.557 | 0.366 | 0.077 | 0.894 | 0.750 | 0.816 |
| PCDet-X | 21.91 | 6.49 | 160.37 | 0.582 | 0.337 | 0.081 | 0.831 | 0.848 | 0.840 |

## Usage

Clone the [code](https://github.com/chen-xin-94/ocdet) and install its
dependencies, then download a weight together with its config:

```bash
mkdir -p weights
# either grab a single model + its config ...
wget -P weights https://huggingface.co/Moonxc/OCDet/resolve/main/pcdet-n.pt
wget -P weights https://huggingface.co/Moonxc/OCDet/resolve/main/pcdet-n.yaml
# ... or pull the whole repo at once
# pip install -U huggingface_hub && hf download Moonxc/OCDet --local-dir weights
```

Run inference (`predict.py` auto-loads `weights/pcdet-n.yaml` next to the weight):

```bash
python predict.py \
  --input_path images/000000032081.jpg \
  --trained weights/pcdet-n.pt \
  --n_classes 1 \
  --gpu -1 \
  --min_distance 3 --threshold_abs 0.5 --input_size 320 \
  --vis --save
```

## Citation

If you use OCDet, please cite the work and link back to the
[GitHub repository](https://github.com/chen-xin-94/ocdet).