wai-rs: jpegai_icci — the eICCI network body (conv, BN-fold, residual block, plane path) #14

Merged
dcharlot merged 1 commit from feat/jpegai-icci-net into main 2026-07-15 03:46:58 -04:00
Owner

Second piece of eICCI. The reference network is float, so this runs in f32 rather than quantising: IEEE-754 with a fixed accumulation order is deterministic across machines, so a faithful float port is byte-identical and carries no PTQ error — no quantise/calibrate loop is needed for this filter.

  • Conv — stride-1 zero-padded conv; covers the 3x3 stem and the separable [1,3]/[3,1] block kernels
  • Conv::fold_bn — folds BatchNorm into the conv, exact at inference: (w·γ/√(σ²+ε))·x + ((b−μ)·γ/√(σ²+ε) + β)
  • ResBlock — x + scale·BN2(conv2_3x1(relu(BN1(conv1_1x3(x)))))
  • IcciPath — relu(BN(conv_first(yuv48))) → resblocks → conv_last → out·scale + subbands16 → idwt2

Unit tests: identity conv + edge zero-padding, fold_bn vs an explicit BatchNorm, and the residual block (scale=0 → identity; scale=1 + identity convs → adds relu(x)).

Remaining for eICCI: the 20 models float weights from ONNX, and the per-tile model selection.

Second piece of **eICCI**. The reference network is float, so this runs in **f32 rather than quantising**: IEEE-754 with a fixed accumulation order is deterministic across machines, so a faithful float port is byte-identical *and* carries no PTQ error — **no quantise/calibrate loop is needed for this filter**. - `Conv` — stride-1 zero-padded conv; covers the 3x3 stem and the separable [1,3]/[3,1] block kernels - `Conv::fold_bn` — folds BatchNorm into the conv, exact at inference: `(w·γ/√(σ²+ε))·x + ((b−μ)·γ/√(σ²+ε) + β)` - `ResBlock` — `x + scale·BN2(conv2_3x1(relu(BN1(conv1_1x3(x)))))` - `IcciPath` — `relu(BN(conv_first(yuv48))) → resblocks → conv_last → out·scale + subbands16 → idwt2` Unit tests: identity conv + edge zero-padding, `fold_bn` vs an explicit BatchNorm, and the residual block (scale=0 → identity; scale=1 + identity convs → adds relu(x)). Remaining for eICCI: the 20 models float weights from ONNX, and the per-tile model selection.
Second piece of eICCI. The reference network is float, so this runs in f32 rather than
quantising: IEEE-754 add/mul with a fixed accumulation order is deterministic across
machines, so a faithful float port is byte-identical AND carries no PTQ error — no
quantise/calibrate loop is needed for this filter.

  Conv          stride-1 zero-padded conv, [cout,cin,kh,kw]; supports the 3x3 stem and
                the separable [1,3] / [3,1] block kernels
  Conv::fold_bn folds BatchNorm into the preceding conv (exact at inference):
                  BN(conv(x)) = (w·γ/√(σ²+ε))·x + ((b−μ)·γ/√(σ²+ε) + β)
  ResBlock      x + scale · BN2(conv2_3x1(relu(BN1(conv1_1x3(x)))))   [BNs folded]
  IcciPath      relu(BN(conv_first(yuv48))) -> N residual blocks -> conv_last
                -> out·scale + subbands16 -> idwt2 -> plane

Unit tests: identity conv + zero-padding at the edge, fold_bn matching an explicit
BatchNorm, and the residual block (scale=0 is the identity; scale=1 with identity convs
adds relu(x) back).

Remaining for eICCI: load the 20 models' float weights from the ONNX, and the per-tile
model selection.

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!14
No description provided.