Add dr-denoise: the learned demosaic and denoise, without the UI

The noise model takes the best source the frame has: the body's measured
table (the Canon EOS 6D's, from the library), the DNG's NoiseProfile, or
the frame itself — read, row and column noise from its masked border, and
only the shot gain estimated, from the quietest flat patches. Checked on
130 6D frames, the estimate is within 10 % from ISO 1000 up; the network
loses under 0.3 dB for a sigma off by 15-20 %, so every Bayer body is
eligible.

Tiles of 1408 keep their central 1024 behind a 192-photosite halo, past the
185-photosite receptive field, and the frame is extended by reflection,
which keeps every photosite's colour; a pattern that starts on another
colour is read from one photosite up or left so the network sees RGGB, and
nothing is cropped. The tests run every Bayer phase, tiled against whole,
with a stand-in network of known reach.

The model ships as models/denoise/mosaic-1408.onnx (LFS), trained in
darkroom-denoise on the maintainer's own photographs, GPL like the code.
denoise_raw runs a file end to end: on a 6D frame at ISO 8000 the result
matches the training repository's own path to 2.5e-4 at worst, and takes
3.1 s on TensorRT fp16 (75 dB from f32) or 14.4 s on the CPU.
This commit is contained in:
2026-10-03 11:15:50 -04:00
parent 20b7bd7663
commit d8304d7c82
12 changed files with 1072 additions and 1 deletions
+1 -1
View File
@@ -757,7 +757,7 @@ pub fn read_noise_profile(decoder: &dyn rawler::decoders::Decoder) -> Option<Vec
let ifd = decoder.ifd(WellKnownIFD::Root).ok()??;
let entry = ifd.get_entry_recursive(DngTag::NoiseProfile)?;
let n = entry.count() as usize;
if n < 2 || n % 2 != 0 {
if n < 2 || !n.is_multiple_of(2) {
return None;
}
let pairs: Vec<(f32, f32)> = (0..n / 2)