Real-image denoising for on-device use, converted from
megvii-research/NAFNet (NAFNet-SIDD-width32.pth,
MIT license) to a LiteRT/TFLite model.
| File | nafnet_sidd_w32.tflite (61,780,512 bytes) |
| SHA-256 | 3722dc58227ee81587fa3d988b526b38594056fbf413c37f6b1bbbb9036d8415 |
| Input | float32 NHWC [1, 256, 256, 3], sRGB in [0, 1] |
| Output | float32 NHWC [1, 256, 256, 3], sRGB in [0, 1] (may slightly exceed; clamp) |
| Weights | FP16 storage with DEQUANTIZE; activations FP32 |
| Ops | CONV_2D, DEPTHWISE_CONV_2D, TRANSPOSE_CONV, elementwise, MEAN, RSQRT, RESHAPE (rank ≤ 4, no TRANSPOSE) |
Process images in 256 × 256 tiles (overlap and blend the tiles): channel attention pools over the whole tile and the activation bounds below are calibrated for this tile size.
The original FP32 network diverges on low-noise dark input (black, flat dark gray, crushed shadows): outputs reach ±1–8 and appear as coloured grid blocks. The divergence starts at the simplified channel attention (SCA) of the deeper encoder levels and accumulates along the residual stream. This conversion bounds the activations:
Equivalent rewrites (identical in FP32): LayerNorm computed on a power-of-two pre-scaled input so the variance stays within FP16 range (the model runs correctly with GPU FP16 precision); SimpleGate's channel split folded into the producing convolutions; 1×1 conv + PixelShuffle rewritten as a 2×2 stride-2 transposed convolution.
Measured offline: on normal content the output is within ≤0.1 dB PSNR of the original network at four noise levels; diverging tiles (e.g. pure black: original output [-1.09, 0.75]) produce valid output ([-0.023, 0.017]).
@article{chen2022simple,
title={Simple Baselines for Image Restoration},
author={Chen, Liangyu and Chu, Xiaojie and Zhang, Xiangyu and Sun, Jian},
journal={arXiv preprint arXiv:2204.04676},
year={2022}
}