wai-rs: jpegai_icci::IcciNet — the eICCI filter, float-exact vs the ONNX #15

Merged
dcharlot merged 1 commit from feat/jpegai-icci-net2 into main 2026-07-15 09:07:48 -04:00
Owner

Completes eICCI, the last unported JPEG-AI decode stage: three planes in, three refined planes out (wavelet included).

The shipped ONNX is far smaller than the reference class implies — trust the export, not icci_models.py:

class says ONNX is
nf 64 48
Y blocks 8 2
UV blocks 8 4

(145,265 params, 21 tensors.) The exporter folded/deduped nearly everything: the luma BN is folded into onnx::Conv_8299; every conv bias is zero (hence deduped to one tensor); every block scale = scaleY = 0.1 (also deduped); BNUV is γ=1,β=0,μ=0,σ²=1 ⇒ x/√(1+ε), folded into conv_firstUV.

IcciNet also drops a redundancy: the reference rebuilds identical chroma features once per chroma plane. The trunk is evaluated once and fed to both heads — same output, half the chroma work.

Validated against the ONNX (ort): max|Δ| = 0.0 / 1e-7 / 0.0 for Y/U/V. Float, not quantised — the net is float in the reference, and IEEE-754 with fixed accumulation order is deterministic, so the port is byte-identical with no PTQ error.

Completes **eICCI**, the last unported JPEG-AI decode stage: three planes in, three refined planes out (wavelet included). The shipped ONNX is far smaller than the reference class implies — **trust the export, not `icci_models.py`**: | | class says | ONNX is | |---|---|---| | nf | 64 | **48** | | Y blocks | 8 | **2** | | UV blocks | 8 | **4** | (145,265 params, 21 tensors.) The exporter folded/deduped nearly everything: the luma BN is folded into `onnx::Conv_8299`; **every conv bias is zero** (hence deduped to one tensor); **every block scale = scaleY = 0.1** (also deduped); `BNUV` is γ=1,β=0,μ=0,σ²=1 ⇒ `x/√(1+ε)`, folded into `conv_firstUV`. `IcciNet` also drops a redundancy: the reference rebuilds identical chroma features once per chroma plane. The trunk is evaluated **once** and fed to both heads — same output, half the chroma work. **Validated against the ONNX (ort): max|Δ| = 0.0 / 1e-7 / 0.0 for Y/U/V.** Float, not quantised — the net is float in the reference, and IEEE-754 with fixed accumulation order is deterministic, so the port is byte-identical with no PTQ error.
Completes eICCI, the last unported JPEG-AI decode stage: three planes in, three
refined planes out (wavelet transform included).

The shipped ONNX is much smaller than the reference Python class implies — trust the
export, not icci_models.py:

  class says   nf=64, nbY=8, nbUV=8
  ONNX is      nf=48, nbY=2, nbUV=4     (145,265 params, 21 tensors)

and the exporter has already folded/deduped nearly everything: the luma stem's BN is
folded into onnx::Conv_8299; every conv bias is zero (hence deduped to one tensor);
every block scale equals scaleY=0.1 (also deduped); BNUV is γ=1,β=0,μ=0,σ²=1, i.e.
x/√(1+ε), folded into conv_firstUV here.

IcciNet also drops a redundancy: the reference's process_U and process_V each rebuild
the same chroma features, so it runs that trunk twice. The trunk is evaluated once and
fed to both heads — identical output, half the chroma work.

Validated against the ONNX itself (planes → planes, ort): max|Δ| = 0.0 / 1e-7 / 0.0 for
Y/U/V. Float, not quantised: the net is float in the reference, and IEEE-754 with a
fixed accumulation order is deterministic across machines — so the port is byte-identical
and carries no PTQ error.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!15
No description provided.