File size: 3,623 Bytes
cc9476a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
92
93
94
---
license: other
library_name: bcdl
tags:
- rdk-s100
- rdk-s100p
- d-robotics
- bpu
- hbm
- image-to-image
- super-resolution
---

# x4 super-resolution for RDK S100/S100P β€” Real-ESRGAN Compact and SPAN

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: [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) general-x4v3 (BSD-3) and [SPAN](https://github.com/hongyuanyu/SPAN) x4 ch48 (Apache-2.0)

> [!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 |
|---|---|
| `realesr_general_x4v3_nashm_128.hbm` | Real-ESRGAN Compact, 128x128 tile β€” 37.1 MB |
| `spanx4_ch48_nashm_128.hbm` | SPAN ch48, 128x128 tile β€” 5.8 MB |

## Measured on an S100P

| stage | latency | throughput |
|---|---|---|
| Compact | 2.01 ms/tile | 498 FPS |
| SPAN | 1.09 ms/tile | 915 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("realesr_general_x4v3_nashm_128.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

**Two models, and neither supersedes the other.** SPAN is fidelity-oriented and
wins on a clean downscale (32.95 dB against Compact's 30.01 and bicubic's 32.29)
at a sixth of the size. Compact is perceptual, trained on real degradations, and
wins on blurred or JPEG-compressed input (28.54 against 27.60). **Pick by your
input domain, not by benchmark rank.**

**The 128x128 tile is deliberate.** A compiled `.hbm` is mostly instruction
stream rather than weights, and it scales with tile *area*: the same network at
256x256 is a 148 MB model against 37 MB here, for identical per-pixel
throughput. If your runtime already tiles β€” BCDL's `SuperResolver` does, with
overlapped cross-fading β€” take the small tile.

PSNR alone is the wrong headline for a perceptual upscaler, which is why the two
numbers above are quoted per input domain.

## Licence

Real-ESRGAN is BSD-3 with weights released by the copyright holder; SPAN is Apache-2.0 by project statement, though its checkpoints ship from a separate file host with no terms attached to the artefact.

**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.