Update latency figures; document fp16/CUDA-graph/TensorRT deployment
Browse files
README.md
CHANGED
|
@@ -41,13 +41,13 @@ F-measure.
|
|
| 41 |
| `F_beta^w` (beta^2 = 0.3), this checkpoint | 0.8582 |
|
| 42 |
| `F_beta^w` (beta^2 = 1), mean of 3 seeds | 0.8675 Β± 0.0009 |
|
| 43 |
| Mask quality on detected instances | 0.8933 |
|
| 44 |
-
| Latency, 640x640, fp32, RTX 6000 Ada |
|
| 45 |
-
| Throughput |
|
| 46 |
|
| 47 |
Against published baselines on the same benchmark: Mask R-CNN 0.844 at 45 ms,
|
| 48 |
deterministic Swin-T 0.883 at 42 ms, Bayesian Swin-T deep ensemble 0.906 at
|
| 49 |
-
roughly 1015 ms. AffKernel beats the Mask R-CNN baseline at about
|
| 50 |
-
latency and trails the deterministic Swin-T by 1.55 points at
|
| 51 |
latency, with fully deterministic single-pass inference.
|
| 52 |
|
| 53 |
**On seed selection.** This is seed 42, which is both the primary anchor seed
|
|
@@ -110,6 +110,81 @@ The first run downloads ImageNet-pretrained ResNet-50vd backbone weights from
|
|
| 110 |
the RT-DETR release artefacts, so it needs network access. For an offline
|
| 111 |
deployment, set `PResNet.pretrained: False` in the config.
|
| 112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
## Classes
|
| 114 |
|
| 115 |
**Objects (10):** bowl, tvm, pan, hammer, knife, cup, drill, racket, spatula, bottle
|
|
@@ -127,8 +202,9 @@ Intended for research on affordance perception and perception-guided grasping.
|
|
| 127 |
- The residual error is dominated by **missed detections**, not by mask quality.
|
| 128 |
On instances the detector does fire on, mask quality (0.893) already exceeds
|
| 129 |
the deterministic Swin-T baseline's overall score.
|
| 130 |
-
-
|
| 131 |
-
|
|
|
|
| 132 |
- Not validated for safety-critical deployment. A predicted grasp region is a
|
| 133 |
perception cue, not a guarantee of a safe grasp.
|
| 134 |
|
|
|
|
| 41 |
| `F_beta^w` (beta^2 = 0.3), this checkpoint | 0.8582 |
|
| 42 |
| `F_beta^w` (beta^2 = 1), mean of 3 seeds | 0.8675 Β± 0.0009 |
|
| 43 |
| Mask quality on detected instances | 0.8933 |
|
| 44 |
+
| Latency, 640x640, fp32, RTX 6000 Ada | 16.3 ms median |
|
| 45 |
+
| Throughput | 61.5 img/s |
|
| 46 |
|
| 47 |
Against published baselines on the same benchmark: Mask R-CNN 0.844 at 45 ms,
|
| 48 |
deterministic Swin-T 0.883 at 42 ms, Bayesian Swin-T deep ensemble 0.906 at
|
| 49 |
+
roughly 1015 ms. AffKernel beats the Mask R-CNN baseline at about a third of its
|
| 50 |
+
latency and trails the deterministic Swin-T by 1.55 points at 39% of its
|
| 51 |
latency, with fully deterministic single-pass inference.
|
| 52 |
|
| 53 |
**On seed selection.** This is seed 42, which is both the primary anchor seed
|
|
|
|
| 110 |
the RT-DETR release artefacts, so it needs network access. For an offline
|
| 111 |
deployment, set `PResNet.pretrained: False` in the config.
|
| 112 |
|
| 113 |
+
## Deployment
|
| 114 |
+
|
| 115 |
+
All rows below use **these same weights** β fp16, CUDA graphs, BatchNorm folding
|
| 116 |
+
and the TensorRT backbone are runtime configurations, not separate checkpoints.
|
| 117 |
+
|
| 118 |
+
**RTX 6000 Ada**, 640x640, batch 1, end to end (preprocess, forward, mask decode,
|
| 119 |
+
device-to-host copy):
|
| 120 |
+
|
| 121 |
+
| Inference path | End to end | FPS | Peak GPU | `F_beta^w` (0.3 / 1) |
|
| 122 |
+
|---|---:|---:|---:|---:|
|
| 123 |
+
| fp32, as released | 35.7 ms | 28.0 | 0.43 GiB | 0.8582 / 0.8685 |
|
| 124 |
+
| fp16 + CUDA graph + BN fold | **16.0 ms** | **62.7** | 0.29 GiB | 0.8577 / 0.8680 |
|
| 125 |
+
|
| 126 |
+
**Jetson AGX Orin** Developer Kit (64 GB), JetPack 6.2, MAXN:
|
| 127 |
+
|
| 128 |
+
| Inference path | End to end | FPS | Peak GPU | `F_beta^w` (0.3 / 1) |
|
| 129 |
+
|---|---:|---:|---:|---:|
|
| 130 |
+
| fp32, as released | 199.5 ms | 5.0 | 1.29 GiB | 0.8598 / 0.8680 |
|
| 131 |
+
| `--half --cudagraph` | 53.2 ms | 18.8 | 0.21 GiB | 0.8596 / 0.8678 |
|
| 132 |
+
| `--trt-backbone` | **43.4 ms** | **23.1** | 0.23 GiB | 0.8591 / 0.8673 |
|
| 133 |
+
|
| 134 |
+
The fastest path costs **0.0007** `F_beta^w` at beta^2=1 β below the Β±0.0009
|
| 135 |
+
seed-to-seed spread of the training run itself. Dropping the input to 512x512 is
|
| 136 |
+
*not* worth it by comparison: it costs 0.007, ten times more, to save less time.
|
| 137 |
+
|
| 138 |
+
### `backbone_fp16.plan` β prebuilt TensorRT engine
|
| 139 |
+
|
| 140 |
+
This repository also ships an fp16 TensorRT engine for the **backbone only**. The
|
| 141 |
+
dynamic-kernel affordance head cannot be exported to ONNX, but the backbone is
|
| 142 |
+
plain convolutions, exports cleanly, and is the largest single term of the forward
|
| 143 |
+
pass: 17.7 ms β 5.3 ms. The encoder, decoder and affordance head stay in PyTorch,
|
| 144 |
+
CUDA-graphed against the engine's output buffers.
|
| 145 |
+
|
| 146 |
+
| | |
|
| 147 |
+
|---|---|
|
| 148 |
+
| Built on | Jetson AGX Orin (64 GB), JetPack 6.2 (L4T R36.4.7) |
|
| 149 |
+
| TensorRT / CUDA | 10.3.0 / 12.6 |
|
| 150 |
+
| Input | `images` β `(1, 3, 640, 640)`, fp16, fixed |
|
| 151 |
+
| Outputs | `feat0..feat3` β fp16 |
|
| 152 |
+
| Size | 46.4 MiB |
|
| 153 |
+
|
| 154 |
+
> **Engine files are not portable.** A `.plan` is compiled for one specific GPU,
|
| 155 |
+
> TensorRT version and input shape. On any other device, JetPack/TensorRT version
|
| 156 |
+
> or input size it will fail to deserialize β or load and behave incorrectly. It
|
| 157 |
+
> is published here as a convenience for setups identical to the table above.
|
| 158 |
+
> **If yours differs in any respect, build your own** β one command, a few
|
| 159 |
+
> minutes. That is the supported path.
|
| 160 |
+
|
| 161 |
+
```bash
|
| 162 |
+
# use the prebuilt engine (identical setups only)
|
| 163 |
+
hf download anhrisn/affkernel-iit-aff backbone_fp16.plan --local-dir weights/
|
| 164 |
+
|
| 165 |
+
# or build your own (recommended)
|
| 166 |
+
python tools/build_trt_backbone.py \
|
| 167 |
+
-c configs/rtdetr/rtdetr_r50vd_6x_iit_v3_stride2_deepsup.yml \
|
| 168 |
+
-r weights/affkernel_iit_r50vd_stride2_deepsup_seed42.pth \
|
| 169 |
+
--out weights/backbone_fp16.plan
|
| 170 |
+
|
| 171 |
+
python tools/infer.py \
|
| 172 |
+
-c configs/rtdetr/rtdetr_r50vd_6x_iit_v3_stride2_deepsup.yml \
|
| 173 |
+
-r weights/affkernel_iit_r50vd_stride2_deepsup_seed42.pth \
|
| 174 |
+
--input path/to/image.jpg --output outputs/ \
|
| 175 |
+
--trt-backbone weights/backbone_fp16.plan --gpu-preprocess
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
Keep the checkpoint either way β the engine replaces the backbone at inference
|
| 179 |
+
only, and training is unaffected.
|
| 180 |
+
|
| 181 |
+
## Files
|
| 182 |
+
|
| 183 |
+
| File | What it is |
|
| 184 |
+
|---|---|
|
| 185 |
+
| `affkernel_iit_r50vd_stride2_deepsup_seed42.pth` | The model. fp32 EMA weights, 174 MB. |
|
| 186 |
+
| `backbone_fp16.plan` | Optional deployment artifact. TensorRT fp16 backbone engine for AGX Orin / JetPack 6.2 / TensorRT 10.3 @ 640x640. Not portable; not usable on its own. |
|
| 187 |
+
|
| 188 |
## Classes
|
| 189 |
|
| 190 |
**Objects (10):** bowl, tvm, pan, hammer, knife, cup, drill, racket, spatula, bottle
|
|
|
|
| 202 |
- The residual error is dominated by **missed detections**, not by mask quality.
|
| 203 |
On instances the detector does fire on, mask quality (0.893) already exceeds
|
| 204 |
the deterministic Swin-T baseline's overall score.
|
| 205 |
+
- The headline latency is fp32 on an RTX 6000 Ada. fp16, CUDA graphs and a
|
| 206 |
+
TensorRT backbone are now characterised on both a workstation and a Jetson AGX
|
| 207 |
+
Orin β see [Deployment](#deployment) β and cost at most 0.0007 `F_beta^w`.
|
| 208 |
- Not validated for safety-critical deployment. A predicted grasp region is a
|
| 209 |
perception cue, not a guarantee of a safe grasp.
|
| 210 |
|