bcdl-xfeat / README.md
ruisv's picture
XFeat for RDK S100/S100P β€” compiled BPU model
42511d3 verified
|
Raw History Blame Contribute Delete
3.36 kB
---
license: apache-2.0
library_name: bcdl
tags:
- rdk-s100
- rdk-s100p
- d-robotics
- bpu
- hbm
- image-feature-extraction
- keypoint-detection
---
# XFeat for RDK S100/S100P β€” sparse local features
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: [XFeat / accelerated_features](https://github.com/verlab/accelerated_features)
> [!TIP]
> **Redistributable, including commercially.** The licence chain was checked on
> the code, the pretrained weights it started from, and the data it was trained
> on β€” all three, because a permissive repository badge does not by itself say
> anything about the weights. See [Licence](#licence).
## Files
| file | what it is |
|---|---|
| `xfeat_nashm_640x480.hbm` | backbone, 640x480, 3 outputs β€” 3.0 MB |
## Measured on an S100P
| stage | latency | throughput |
|---|---|---|
| backbone | 0.99 ms | 1013 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("xfeat_nashm_640x480.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
**Only the convolutional backbone is compiled** β€” 3 MB of it. Keypoint NMS,
top-k selection and sparse descriptor sampling stay on the CPU, which is what
keeps the graph free of dynamic control flow. BCDL does that half for you.
Two rewrites were needed to export it at all, and both were checked numerically
before being trusted: the input `InstanceNorm` was lifted out of the graph into
CPU preprocessing, and `_unfold2d` became `pixel_unshuffle` (a single
`SpaceToDepth`), asserted equal to the original beforehand.
**The descriptor sampler is bicubic, not bilinear.** Upstream takes the default
mode of `InterpolateSparse2d`, which is bicubic, while the *reliability* map in
the same file uses bilinear. Getting that wrong leaves shapes, counts and
keypoints all correct and the descriptor cosine stuck at 0.9965 β€” which reads
like quantisation noise. It is not.
## Licence
Apache-2.0, and the pretrained weights are committed inside that repository β€” so the same grant covers them.
**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.