From f935290d40d7c312bf237d74bd19ea5cffa02338 Mon Sep 17 00:00:00 2001 From: Andrii Ryzhkov Date: Wed, 22 Apr 2026 16:33:52 +0200 Subject: [PATCH 1/3] Update RawNIND model attributes --- models/rawdenoise-nind/model.yaml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/models/rawdenoise-nind/model.yaml b/models/rawdenoise-nind/model.yaml index b1c407f..c0450fe 100644 --- a/models/rawdenoise-nind/model.yaml +++ b/models/rawdenoise-nind/model.yaml @@ -14,10 +14,24 @@ attributes: variants: bayer: onnx: model_bayer.onnx - input_kind: packed_bayer # 4ch R/G1/G2/B, half-resolution, pre-demosaic + # contract label: pins the preprocessing the restore loader will + # apply. see src/common/ai/restore.h for the full bayer_v1 + # contract (4ch R/G1/G2/B packed half-res, WB+black-level normalized) + input_kind: bayer_v1 + # policy knobs — all at their v1 defaults; made explicit so the + # manifest documents what preprocessing the model expects + wb_norm: daylight # training distribution; inverted post-inference + output_scale: match_gain # UtNet2 output scale is arbitrary linear: onnx: model_linear.onnx - input_kind: lin_rec2020 # already demosaicked (X-Trans, Foveon, etc.) + # 3ch full-res lin_rec2020, for pipelines with external demosaic + # (X-Trans, Foveon, etc.). see linear_v1 contract in + # src/common/ai/restore.h + input_kind: linear_v1 + input_colorspace: lin_rec2020 + wb_norm: as_shot # beats daylight for re-imported DNG tonemap match + output_scale: match_gain # per-channel mean-match; UtNet2 output scale is arbitrary + target_mean: 0.30 # pre-inference exposure boost (training brightness) repo: submodule: vendor/rawnind_jddc From c1fa93fa0a24edb6ad587736411a0c0ef110cef9 Mon Sep 17 00:00:00 2001 From: Andrii Ryzhkov Date: Thu, 23 Apr 2026 10:27:47 +0200 Subject: [PATCH 2/3] Add RawNIND-spesific attributes --- models/rawdenoise-nind/model.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/models/rawdenoise-nind/model.yaml b/models/rawdenoise-nind/model.yaml index c0450fe..ab13c97 100644 --- a/models/rawdenoise-nind/model.yaml +++ b/models/rawdenoise-nind/model.yaml @@ -20,8 +20,10 @@ attributes: input_kind: bayer_v1 # policy knobs — all at their v1 defaults; made explicit so the # manifest documents what preprocessing the model expects - wb_norm: daylight # training distribution; inverted post-inference - output_scale: match_gain # UtNet2 output scale is arbitrary + bayer_orientation: force_rggb # extract from R origin so ch0=R on any CFA + edge_pad: mirror_cropped # reflect in the RGGB-forced frame + wb_norm: daylight # training distribution; inverted post-inference + output_scale: match_gain # UtNet2 output scale is arbitrary linear: onnx: model_linear.onnx # 3ch full-res lin_rec2020, for pipelines with external demosaic From 923fec3be58de71d312134c6ee1946aa55c14cd0 Mon Sep 17 00:00:00 2001 From: Andrii Ryzhkov Date: Mon, 27 Apr 2026 13:54:56 +0200 Subject: [PATCH 3/3] Switch to preupsample variant and align preprocessing to upstream --- models/rawdenoise-nind/model.yaml | 37 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/models/rawdenoise-nind/model.yaml b/models/rawdenoise-nind/model.yaml index ab13c97..e398aa4 100644 --- a/models/rawdenoise-nind/model.yaml +++ b/models/rawdenoise-nind/model.yaml @@ -14,37 +14,36 @@ attributes: variants: bayer: onnx: model_bayer.onnx - # contract label: pins the preprocessing the restore loader will - # apply. see src/common/ai/restore.h for the full bayer_v1 - # contract (4ch R/G1/G2/B packed half-res, WB+black-level normalized) + # bayer_v1 contract — see src/common/ai/restore.h. + # policy knobs match upstream RawNIND inference input_kind: bayer_v1 - # policy knobs — all at their v1 defaults; made explicit so the - # manifest documents what preprocessing the model expects - bayer_orientation: force_rggb # extract from R origin so ch0=R on any CFA + bayer_orientation: force_rggb # ch0 = R on any CFA edge_pad: mirror_cropped # reflect in the RGGB-forced frame - wb_norm: daylight # training distribution; inverted post-inference - output_scale: match_gain # UtNet2 output scale is arbitrary + wb_norm: none # do NOT WB before inference + output_scale: match_gain # scalar mean ratio linear: onnx: model_linear.onnx - # 3ch full-res lin_rec2020, for pipelines with external demosaic - # (X-Trans, Foveon, etc.). see linear_v1 contract in - # src/common/ai/restore.h + # linear_v1 contract — see src/common/ai/restore.h. + # 3ch full-res lin_rec2020 (X-Trans, Foveon, external demosaic) input_kind: linear_v1 input_colorspace: lin_rec2020 - wb_norm: as_shot # beats daylight for re-imported DNG tonemap match - output_scale: match_gain # per-channel mean-match; UtNet2 output scale is arbitrary - target_mean: 0.30 # pre-inference exposure boost (training brightness) + wb_norm: none # do NOT WB before inference + output_scale: match_gain # scalar mean ratio + target_mean: null # disable exposure boost repo: submodule: vendor/rawnind_jddc checkpoints: - # DenoiserTrainingBayerToProfiledRGB_4ch_2024-02-21-bayer_ms-ssim_mgout_notrans_valeither_-4 - # canonical "Bayer" base variant (in_channels=4, funit=32, linear Rec.2020 target) - - url: "https://drive.google.com/file/d/1dFTLeljWi9wwojcZUsam8bE31JdYy3oM/view?usp=drive_link" + # DenoiserTrainingBayerToProfiledRGB_4ch_2024-03-11-bayer_ms-ssim_mgout_preupsample_notrans_valeither_-2 + # preupsample variant — needs `preupsample: true` in convert step + - url: "https://drive.google.com/file/d/1xgHafgqRC8ZEGbbXtduSlx9WunD0mgS_/view?usp=drive_link" path: "temp/rawdenoise-nind/denoiser_bayer2prgb_utnet2.pt" + # DenoiserTrainingBayerToProfiledRGB_4ch_2024-02-21-bayer_ms-ssim_mgout_notrans_valeither_-4 + # half-res alternative — ~4× faster, marginally lower quality + # - url: "https://drive.google.com/file/d/1dFTLeljWi9wwojcZUsam8bE31JdYy3oM/view?usp=drive_link" + # path: "temp/rawdenoise-nind/denoiser_bayer2prgb_utnet2.pt" # DenoiserTrainingProfiledRGBToProfiledRGB_3ch_2024-10-09-prgb_ms-ssim_mgout_notrans_valeither_-1 - # canonical "Linear RGB" base variant (in_channels=3, funit=32, lin-Rec.2020 in/out) - url: "https://drive.google.com/file/d/1kH8tK4RN_edak3r_VIAhCzPa6CNsuTYC/view?usp=drive_link" path: "temp/rawdenoise-nind/denoiser_prgb2prgb_utnet2.pt" @@ -67,7 +66,7 @@ convert: in_channels: 4 funit: 32 activation: "LeakyReLU" - opset: 17 + preupsample: true fp16: false - script: convert.py args: