XFeat is a lightweight feature extractor and matcher. Hailo-8 accelerates compatible neural graphs, but compatibility is not automatic: the compiler rejected the graph produced by the original export.
UnsupportedShuffleLayerError Transpose × 71 (5-D) Slice × 72 (5-D) Unsqueeze × 70 (5-D)
The tempting move is to fight 213 operations. The useful move was noticing they aren’t 213 problems, or even 71. They’re one: a helper called _unfold2d(x, ws=8), written with Tensor.unfold, which PyTorch traces as a pile of five-dimensional slicing. That operation has a name, space-to-depth: fold each 8 × 8 patch of pixels into 64 channels. PyTorch already has it as pixel_unshuffle, and the chip supports that natively. One substitution, and the graph parses.
The proof, not the claim
Compilation alone cannot establish equivalence. A graph that quietly changes the feature layout can degrade matching and make quantisation look responsible. The export check compares the replacement operation and the complete floating-point network with the stock graph at the supported resolutions. The recorded checks used torch.equal for the permutation and reported zero maximum difference across the network’s three output heads on the tested inputs.
unfold2d vs pixel_unshuffle torch.equal: True full network vs stock max |Δ| = 0.000e+00 → ONNX export allowed; compile and INT8 evaluation follow
The structural reason an exact replacement is possible is that space-to-depth rearranges values rather than estimating new ones. Channel order, block order and supported image dimensions still have to agree. A finite equality check guards the actual export; it is not a claim about arbitrary unsupported input shapes. Nor does floating-point equality prove that the later INT8 model preserves matching quality.
A HEF that compiles is not a result.
Throughput is not the cost of a call
The archived 320 × 240 measurements contain two different comparisons:
| Measurement | Recorded value | Scope |
|---|---|---|
| Hailo-8 sustained backbone throughput | 701.22 frames/s | Batched chip benchmark, not complete matching |
| Pi CPU backbone benchmark | 30.2 frames/s | The earlier CPU comparison |
Hailo single detect() call | 13.4 ms | Host call through InferVStreams |
| CPU call in the same single-shot script | 20.0 ms | The corresponding application-facing comparison |
The first pair produces the roughly 23-fold throughput headline. The second gives about a 1.5-fold improvement per call in that historical harness. The distinction is consequential: a control loop cannot spend batched throughput as though each newly captured image returns in its reciprocal time.
The single-shot path paid host-API and network-activation overhead. The backbone was only one stage, too: keypoint decoding, non-maximum suppression and feature matching remained on the CPU. These are archived measurements from this revision, not the present shared-camera graph’s latency or a claim of 701 complete matches per second.
Spend the saved work where it matters
The change made an otherwise rejected graph compilable without intentionally approximating the floating-point operation. The next question was whether its output remained useful after quantisation and through the actual postprocessor. That requires a separate task-level comparison; the canary investigation and the fine-tuning retraction show why an attractive backbone number cannot answer it.
The matcher also has a different scaling law. Comparing K query descriptors with K reference descriptors builds a similarity matrix whose pair count grows as K². Doubling keypoints can quadruple that part of the work without doubling the useful geometric evidence. That is why the choice between denser features and more reference views needs a cost-and-quality experiment, not the accelerator’s TOPS rating.
The archived configuration preferred four references at top_k = 1024 over one at 2048 under its measured budget. That is a result for its footage and settings, not a universal optimum. Profiling the bank then uncovered repeated feature extraction on identical pixels: the next investigation.
