Repair photosites beyond 8 sigma of every neighbour before the network

The app's hot-pixel pass takes gross defects only; at ISO 6400-25600 a 6D
frame keeps 1000-2000 photosites more than 8 sigma beyond all their
same-colour and adjacent neighbours, which the network turned into specks.
The same two tests with the threshold in the photosite's own sigma, plus
the factor of two that keeps a bright point of light (where 8 sigma is a
sliver of the signal). The next model is trained behind exactly this; on
an ISO 25600 frame the Rust and training code both repair 935.
This commit is contained in:
2026-10-04 07:30:09 -04:00
parent 75e12441fd
commit 0c9d564586
3 changed files with 161 additions and 4 deletions
+13 -1
View File
@@ -19,6 +19,7 @@
pub mod noise;
#[cfg(feature = "onnx")]
pub mod onnx;
pub mod repair;
pub mod tile;
use dr_decode::RawImage;
@@ -67,12 +68,23 @@ pub fn denoise(
}
let active = noise::active(raw);
let (h, w) = (active.h, active.w);
// The active area laid out once, then the noise-aware repair the model
// was trained behind (see `repair`).
let mut mosaic: Vec<f32> = (0..h * w).map(|i| active.at(i / w, i % w)).collect();
let pattern = raw.cfa_pattern;
let repaired = repair::repair(&mut mosaic, h, w, repair::REPAIR_K, &|y, x, v| {
noise.sigma(pattern.colour_at(x as u32, y as u32) as usize, v)
});
log::info!(
"learned denoise: {repaired} photosites beyond {}σ of every neighbour repaired",
repair::REPAIR_K
);
tile::run_tiled(
net,
h,
w,
raw.cfa_pattern,
&|y, x| active.at(y, x),
&|y, x| mosaic[y * w + x],
&|c, v| noise.sigma(c, v),
progress,
)