greycard denoise
Raw-domain denoisers for greycard,
a RAW development engine and editor. The editor and the greycard CLI download
these on first use; nothing here needs to be fetched by hand.
Three tiers, one UNet architecture at three widths. Every one of them is a single ONNX file (opset 17), fp32, with an fp16 copy for Core ML.
| Tier | File | Parameters | Network time, 24 MP frame |
|---|---|---|---|
| fast | denoise-v19.onnx |
1.2 M | ~1 s |
| balanced | denoise-v15.onnx |
2.3 M | ~2 s |
| best | denoise-v20.onnx |
5.3 M | ~3 s |
Times are the network alone on the reference hardware; greycard tiles and blends the answer, and the whole develop takes longer.
fp16 files
denoise-v19-fp16.onnx, denoise-v15-fp16.onnx and denoise-v20-fp16.onnx
are the same networks with their weights and arithmetic in fp16. Input and
output stay float32, so the contract below is unchanged. They are for
Core ML on Apple Silicon, where the Neural Engine takes fp16: on an M5
they run 1.4 to 2.5 times faster than the fp32 files, and a develop
differs from the fp32 one by about 0.001 stops on average, under 0.01
stops at the 99.9th percentile outside the deepest shadows, at ISO 1600 to
12800. Other providers keep the fp32 files.
They are made from the fp32 files by tools/denoise/fp16.py in the greycard
repository (onnxconverter-common 1.16.0, keep_io_types), and the
measurements are in its notes, sections
481
and
489.
Contract
- Input
packed:1 × 4 × h × w, float32. The Bayer mosaic packed to half resolution as R, G1, G2, B, after black and white level normalisation and white balance, each channel through greycard's variance stabiliser (2x / (sqrt(a·x + s0²) + s0)with the frame's measured noise parameters). Height and width are dynamic. - Output
rgb:1 × 3 × 2h × 2w, float32. Demosaiced RGB at the mosaic's resolution, in the same stabilised space, camera RGB, white balanced. greycard inverts the stabiliser and carries on with its usual pipeline.
The network is not a general-purpose image denoiser: it expects stabilised, white-balanced camera-space mosaic data and will do the wrong thing on sRGB pictures.
Training
Trained by the greycard author on frames from their own archive, with noise
synthesised from greycard's per-frame noise model (photon plus read noise,
sampled log-uniformly over a wide range, with per-channel gain jitter).
L1 loss in the stabilised space, EMA weights. The code is in the greycard
repository under tools/denoise (train.py, model.py, export.py,
fp16.py).
Licence
GPL-3.0-or-later, the same as greycard. Source and training code: https://github.com/jessolmstead/greycard.