pixl demosaic

Noisy RAW in. Clean colour out. One step.

License: Apache-2.0 ONNX Bayer and X-Trans

Try it 路 Input and output 路 Measured 路 Known limits 路 PIXL

A camera sensor records only one colour at each point. This model fills in the other two and removes noise at the same time. It is the RAW model inside the PIXL engine.

Illustration: a noisy RAW mosaic becomes a clean RGB picture in one step

Two models

File Camera sensor Parameters Size SHA-256
pixl_demosaic_v1_bayer.onnx Bayer (most cameras) 12,438,684 50 MB c31ca11b71f43f8a3a212229bcc1d0f9d63cd157879c8a68dc3bd3db6be99945
pixl_demosaic_v1_xtrans.onnx X-Trans (many Fujifilm cameras) 27,851,211 112 MB 7e96aa6ab6aaa53cd96ba4a73fcca1392ae4b30bb698ec143d2d39d6f4f2d7ea

Try it

pip install numpy onnxruntime
python example.py pixl_demosaic_v1_bayer.onnx bayer
python example.py pixl_demosaic_v1_xtrans.onnx xtrans

The example uses a made-up picture. It does not open RAW files.

Input and output

Four input layers, red, green, blue and noise, become one RGB picture
  • Input: input, float32, [1, 4, height, width]. Height and width must be multiples of 16 (Bayer) or 24 (X-Trans).
  • First three layers: the red, green and blue photosites, each in its own layer and 0 elsewhere. Values are black-subtracted and white-balanced, with 1.0 = the sensor's clip before white balance. They go through the curve below.
  • Fourth layer: each photosite's noise level (standard deviation), after white balance, times the curve's slope. example.py shows the exact steps.
  • Pattern: the top-left must match PATTERN in example.py. Crop your mosaic to line it up.
  • Output: output, float32, [1, 3, height, width]: RGB in the same curve. Undo the curve to get white-balanced camera RGB. Your own code must then apply the camera's colour matrix.
  • Curve: y = sign(x) * ln(1 + 64 * min(|x|, 8)) / ln(513).
  • Large photos: use overlapping tiles. PIXL uses 576 x 576, overlapping by 32 (Bayer) or 48 (X-Trans) pixels.

Measured

Higher is better. Every method goes from a noisy RAW mosaic to clean RGB. All were scored on the same crops, with the same alignment, colour fit and scoring code.

Bayer: nine noisy frames from three RawNIND scenes, each on a different Canon camera.

Method PSNR (dB) MS-SSIM
pixl-demosaic-v1-bayer 39.94 0.9792
RawForge TreeNetDenoiseHeavy 39.33 0.9786
demosaicnet, then SCUNet 39.26 0.9738
demosaicnet, then NAFNet (SIDD) 39.19 0.9758
RawNIND's joint model 38.84 0.9757
PMRID, then demosaicnet 38.83 0.9739

Our PSNR was highest on eight of nine frames. SCUNet was 0.09 dB ahead on the Canon 500D at ISO 3200.

X-Trans: nine noisy frames from one RawNIND scene on a Fujifilm X-T1.

Method PSNR (dB) MS-SSIM
pixl-demosaic-v1-xtrans 40.15 0.9744
RawForge RestormerXTrans 39.88 0.9742
RawForge TreeNetDenoiseXTrans 39.34 0.9703
demosaicnet-xtrans, then PIXL's denoise 36.05 0.9374
Markesteijn, then PIXL's denoise 35.47 0.9285

Our PSNR was highest on eight of nine frames. Restormer was 1.3 dB ahead on one very dark frame. Overall the two are close: this test does not show which is better.

Read these scores with care

  • We ran these tests ourselves on 2026-10-13, with 12 crops per frame. They are small and are not a public benchmark.
  • Our models and RawNIND's model did not train on the test scenes they are scored on. They did train on other scenes from some of the same cameras.
  • RawForge trained on RawNIND but does not document which scenes, so it may have seen these.
  • "Restormer" here means RawForge's X-Trans version, not the original Restormer release.
  • Our models were told the noise PIXL measured from each frame. Newer PIXL versions measure it differently. Results depend on your noise estimate.
  • Blown highlights were left out for every method. The SCUNet and NAFNet routes had one extra 16-bit rounding step.

Known limits

  • It needs a good noise estimate. A wrong one leaves noise or removes detail.
  • Dead and hot pixels are not repaired.
  • Blown highlights were not part of training.
  • It can invent texture in very underexposed photos.
  • It did not train on banding, row noise or fixed-pattern noise.
  • On clean, noise-free Bayer patches it is 0.73 dB below demosaicnet.

Training data

  • raw.pixls.us: CC0 1.0.
  • RawNIND: CC0 1.0, and CC BY-SA 4.0 for its LucieB_* scenes.
  • HDR+: CC BY-SA 4.0.
  • The owner's own photos: Bayer model only.

No training photos are included. Full credits are in NOTICE.

License

Copyright 2026 xuckless and PIXL. Apache License 2.0. Keep the NOTICE with copies. This covers the files here. The PIXL engine is separate and closed source.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 馃檵 Ask for provider support