bcdl-pidnet / README.md
ruisv's picture
Compiled BPU models for RDK S100/S100P
7138684 verified
|
Raw
History Blame Contribute Delete
3.36 kB
---
license: other
library_name: bcdl
tags:
- rdk-s100
- rdk-s100p
- d-robotics
- bpu
- hbm
- image-segmentation
- semantic-segmentation
---
# PIDNet-S for RDK S100/S100P β€” real-time semantic segmentation
Compiled BPU models (`.hbm`) for the **D-Robotics RDK S100 / S100P**, ready to
load β€” no ONNX export, no calibration, no `hb_compile`. Built and measured with
[**BCDL**](https://github.com/ruisv/bcdl), a C++17 inference and media library
for the RDK S-series with Python bindings.
Upstream: [PIDNet](https://github.com/XuJiacong/PIDNet)-S, Cityscapes 19 classes
> [!WARNING]
> **Non-commercial.** These weights carry a restriction the upstream *code*
> licence never mentions β€” see [Licence](#licence) at the bottom. Redistribution
> is permitted; commercial use is not. If you need a commercial build, the
> recipe is public and you can retrain or substitute the backbone.
## Files
| file | what it is |
|---|---|
| `pidnet_s_nashm_1024x2048_nv12_v3.hbm` | 2048x1024 NV12, 19 classes β€” 18.0 MB |
## Measured on an S100P
| stage | latency | throughput |
|---|---|---|
| segmentation | 4.48 ms | 223 FPS |
`hrt_model_exec perf`, one thread, minimum of three runs, on a board first gated
against its own previously recorded numbers. **BPU time only** β€” CPU
pre/post-processing is on top and is listed per task in BCDL's
[benchmark results](https://github.com/ruisv/bcdl/blob/main/benchmarks/RESULTS.md).
## Use it
```bash
conda install -c https://mirrors.ruis.ai/conda -c conda-forge bcdl
```
```python
import bcdl
engine = bcdl.Engine("pidnet_s_nashm_1024x2048_nv12_v3.hbm")
print(engine.input_shape(0), engine.output_shape(0))
```
Each task has a decoder in BCDL that turns those raw outputs into boxes,
keypoints, masks, disparity or text β€” see the
[Python API](https://github.com/ruisv/bcdl/blob/main/docs/API.md)
([δΈ­ζ–‡](https://github.com/ruisv/bcdl/blob/main/docs/API.zh.md)).
## What to know before deploying
**11x faster than the DeepLabV3+ build it replaces** (4.48 ms against 49.6 ms) at
half the model size, for a 0.9859 output cosine and 94.6% pixel agreement.
The output is at 1/8 resolution β€” `[1, 19, 128, 256]` β€” and the label map is
upsampled by the caller. Argmax costs 0.18 ms here, so folding it into the graph
would buy nothing.
**The `_v3` suffix is load-bearing.** Earlier builds were calibrated on data that
had not been pre-normalised. When `cal_data_type` is float32 the compiler's
`norm_type` does **not** apply to the calibration data, so the input thresholds
come out wrong β€” and the model still compiles without a warning and segments to
noise. If you rebuild this, check the input threshold in `quant_info.json`.
**Non-commercial.** See the licence note above.
## Licence
MIT on the code, but the weights are trained on **Cityscapes**, whose terms permit distributing a trained model and bar commercial use of it in the same breath.
**BCDL itself is Apache-2.0 and is unrelated to these terms** β€” it is a
general-purpose runtime that loads any `.hbm`. The licence above constrains
*these weights and this compiled artefact*.
The conversion recipe β€” ONNX export, calibration, `hb_compile` config and the
acceptance numbers β€” is public in
[**bcdl-model-zoo**](https://github.com/ruisv/bcdl-model-zoo), so this build can
be reproduced or retargeted rather than taken on trust.