A compressed version of NAFNet (width 64, trained for real-noise denoising on SIDD), starting from the ONNX export by Qualcomm AI Hub (qualcomm/NAFNet-DeNoise). Produced with SmolAnything: structured pruning and low-rank replacements fitted on noisy calibration crops, with an LLM (Claude Opus 5.5, medium effort) deciding what to cut. No retraining. The replacements were fitted on noisy crops only; clean images were used only to choose the acceptance limit and to evaluate.
| Original | This model | |
|---|---|---|
| Parameters | 116M | 97.5M (−15.9%) |
| MACs (256×256 input) | 63.2G | 61.6G (−2.6%) |
| SIDD test PSNR ↑ | 40.016 dB | 39.961 dB (−0.055 dB) |
| SIDD test SSIM ↑ | 0.9182 | 0.9178 |
| PolyU PSNR ↑ (91 crops, see below) | 36.789 dB | 36.783 dB (−0.006 dB) |
| PolyU SSIM ↑ (91 crops) | 0.9546 | 0.9546 |
| Latency, RTX 3070 Ti (ONNX Runtime, CUDA) | 32.6 ms | 32.0 ms (−1.8%) |
| Latency, CPU, Ryzen 5 5600X (ONNX Runtime) | 703 ms | 700 ms (−0.4%) |
| ONNX file size | 465.7 MB | 390.2 MB (−16.2%) |
The saved parameters sit in the low-resolution (16×16) middle stack, so compute and latency barely change. The gain is mainly in model size.
Noisy SIDD test crop, output of the original, output of this model, clean ground truth, absolute difference between the two outputs in 8-bit levels (mean 0.85). PSNR per crop in brackets. The crop was chosen by rule: of the 10% most detailed test crops, the one with the median PSNR change.
image is 1×3×256×256, RGB, float32 in [0, 1] (8-bit value / 255), no mean/std normalization. This is the same as the Qualcomm export; the original PyTorch NAFNet accepts any size. Denoise larger images in 256×256 tiles.denoised_image (1×3×256×256), RGB in [0, 1]. Clip to [0, 1] before converting to 8 bit.import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
path = hf_hub_download("GavGuile/smolanything-nafnet-denoise", "onnx/model.onnx")
hf_hub_download("GavGuile/smolanything-nafnet-denoise", "onnx/model.onnx_data")
session = ort.InferenceSession(path, providers=["CUDAExecutionProvider", "CPUExecutionProvider"])
noisy = np.zeros((1, 3, 256, 256), dtype=np.float32) # RGB crop, 8-bit value / 255
denoised = np.clip(session.run(["denoised_image"], {"image": noisy})[0], 0, 1)
Found and verified by SmolAnything (full report with evidence and reasoning: study report):
MIT, like the original model. All credit for the architecture and training goes to the NAFNet authors (Chen, Chu, Zhang and Sun, "Simple Baselines for Image Restoration", ECCV 2022); the ONNX export is by Qualcomm AI Hub. This repository only contains a post-training compressed version. Calibration and test data: SIDD (Abdelhamed, Lin and Brown, "A High-Quality Denoising Dataset for Smartphone Cameras", CVPR 2018).
SmolAnything is an independent project and is not affiliated with Hugging Face, Qualcomm or the authors of NAFNet.