Low-light enhancement
Zero-DCE++ (low light)
Brightens dark photos with a tiny network of 10,561 parameters that bends each pixel's brightness curve. CC BY-NC 4.0.
About this model
Zero-DCE++ brightens photos taken in low light. For every pixel it estimates a brightening curve and applies it eight times, so dark areas lift strongly while bright areas stay in range.
It was trained without any reference images (zero-reference), and the whole network has 10,561 parameters. This pack runs it at full resolution, as it was trained. The authors' test script estimates the curves on a picture shrunk 12 times for speed; on our photos that differs from the full-resolution result by about 9 levels of 255 on average.
Photos of any size work: Slab cuts the photo into 256 x 256 tiles that overlap by 8 pixels, the network's reach, runs each one and stitches the centers, which matches a whole-photo run.
What you can build
- Brighten night and indoor photos
- Make dark video frames readable before detection or recognition
- Dash cams, doorbells and other cameras that work at night
Night alley
f16Sonia Sevilla, CC0, https://commons.wikimedia.org/wiki/File:Kamran_Alley_-_Night_-_Tehran.jpg
960 x 720 in 37 ms on Metal (FP16 pack). Mean brightness 0.15 before, 0.41 after (0 black, 1 white).
Night harbor
f16W.carter, CC0, https://commons.wikimedia.org/wiki/File:Norra_Grundsund_harbor_at_night.jpg
960 x 640 in 22 ms on Metal (FP16 pack). Mean brightness 0.11 before, 0.35 after (0 black, 1 white).
Dark forest
f16Will Aelethrune, Public domain, https://commons.wikimedia.org/wiki/File:Forest_dark_and_light.jpg
960 x 636 in 22 ms on Metal (FP16 pack). Mean brightness 0.12 before, 0.40 after (0 black, 1 white).
Variants & downloads
Choose the build for your appModel files are hosted on Google Drive. Large files may open a confirmation page before downloading.
Small
SlabWeights stored as int8 in blocks of 64. Slab decodes them to float when loading, so it runs at the same speed; images move more than with FP16 (see Accuracy).
Platforms: macos · android
zero-dce-pp-int8.slab
496 KB · Hosted download
SHA-256 checksum
44bc64e9228c6d0794c2dd2887a934c33f504702afb7d47f4cb7dd07653df2c0NOTICE-Zero-DCE-plus-plus.txt
634 B
SHA-256 checksum
6153241eeea70cf48992dc1c0e486143e182d0575b332a554c24cba0cc43fda7Conversion details
- command
- git clone https://github.com/Li-Chongyi/Zero-DCE_extension && git -C Zero-DCE_extension checkout 09f202b690f82da939b8e6ec8535960ae97ad8bd python -c "import torch, importlib.util as u; s = u.spec_from_file_location('m', 'Zero-DCE_extension/Zero-DCE++/model.py'); m = u.module_from_spec(s); s.loader.exec_module(m); n = m.enhance_net_nopool(1); n.load_state_dict(torch.load('Zero-DCE_extension/Zero-DCE++/snapshots_Zero_DCE++/Epoch99.pth', map_location='cpu', weights_only=True)); W = type('W', (torch.nn.Module,), {'forward': lambda s, x: s.net(x)[0]}); w = W(); w.net = n; torch.onnx.export(w.eval(), torch.rand(1, 3, 256, 256), 'model.onnx', input_names=['input'], output_names=['enhanced'], opset_version=17, dynamo=False)" slab-load convert model.onnx model.slab --input input=1x3x256x256 --meta task=enhance --meta normalize=scale255 --meta color=rgb --meta tile_pad:i64=8 slab-load quantize model.slab zero-dce-pp-int8.slab slab-load meta set zero-dce-pp-int8.slab default_backend.macos=gpu
Integration examples
Python
python
import slab
cfg = slab.Config(cache_dir="/tmp/slab_cache", license=open("license.slablic.txt").read())
session = slab.Session(cfg, "zero-dce-pp-f16.slab", warmup=True)
photo = slab.Frame.open("photo.jpg")
result = session.run(slab.Input(frame=photo)).to_frame() # Slab tiles the photo and stitches the result
print(photo.width, photo.height, "->", result.width, result.height)
Device & backend compatibility
Pack default: macos / GPU. The fastest backend on the Mac: about 70 ms for a 1920 x 1080 photo.
| Platform | Engine | Status | Precision |
|---|---|---|---|
| apple | CPU CPU | Supported Measured on macOS. | f32 |
| apple | Metal GPU | Supported Measured on macOS. The default. | f32 |
| apple | Apple Neural Engine NPU | Supported Measured on macOS. The Neural Engine computes in FP16. | f16 |
| android | CPU CPU | Supported Measured on a Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2, Adreno 740), Android 17. | f32 |
| android | Vulkan GPU | Supported Measured on a Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2, Adreno 740), Android 17. | f32 |
| android | Qualcomm Hexagon NPU (QNN) NPU | Supported Measured on a Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2, Adreno 740), Android 17. The NPU computes in FP16 (the int8 pack's weights are widened to FP16). | f16 |
Performance
Results depend on the device, runtime, and test conditions. Each measurement keeps its own context.
Mac with Apple M1 Max
Slab · CPU
macOS 26.6.2
12.8 ms
Measured time · scope below
Median of 100 warm runs on one 256 x 256 tile (Slab's run time). A 1920 x 1080 photo, tiling, stitching and to_frame() included: 530 ms median of 10.
Mac with Apple M1 Max
Slab · GPU
macOS 26.6.2
1.5 ms
Measured time · scope below
Median of 100 warm runs on one 256 x 256 tile (Slab's run time). A 1920 x 1080 photo, tiling, stitching and to_frame() included: 70 ms median of 10.
Mac with Apple M1 Max
Slab · NPU
macOS 26.6.2
2.1 ms
Measured time · scope below
Median of 100 warm runs on one 256 x 256 tile (Slab's run time). A 1920 x 1080 photo, tiling, stitching and to_frame() included: 124 ms median of 10.
Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)
Slab · CPU
Android 17
58.0 ms
Measured time · scope below
Median of 10 warm runs of the model (Slab's run time). open_ms: opening the session. Peak memory (resident) after the runs: 176 MB.
Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)
Slab · GPU
Android 17
23.9 ms
Measured time · scope below
Median of 10 warm runs of the model (Slab's run time). open_ms: opening the session with the GPU programs already in the cache folder (the first open on a device compiles them, about 0.3 s more). Peak memory (resident) after the runs: 112 MB.
Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)
Slab · NPU
Android 17
4.4 ms
Measured time · scope below
Median of 20 warm runs of the model (Slab's run time). open_ms: opening the session, including preparing the model for the Hexagon NPU. Peak memory (resident) after the runs: 109 MB.
Accuracy checks
macos · CPU · int8
The upstream network at scale factor 1 (as trained) on the whole photo, output clamped and rounded to 8 bits; 11 public-domain and CC0 photos (Wikimedia Commons), compared as 8-bit images
PSNR 53.1 dB on average (52.6 dB on the worst photo); mean difference 0.320 levels of 255, largest 1; 0.00% of values off by more than 2.
macos · GPU · int8
The upstream network at scale factor 1 (as trained) on the whole photo, output clamped and rounded to 8 bits; 11 public-domain and CC0 photos (Wikimedia Commons), compared as 8-bit images
PSNR 53.1 dB on average (52.6 dB on the worst photo); mean difference 0.320 levels of 255, largest 1; 0.00% of values off by more than 2.
macos · NPU · int8
The upstream network at scale factor 1 (as trained) on the whole photo, output clamped and rounded to 8 bits; 11 public-domain and CC0 photos (Wikimedia Commons), compared as 8-bit images
PSNR 55.8 dB on average (54.9 dB on the worst photo); mean difference 0.173 levels of 255, largest 1; 0.00% of values off by more than 2.
android · NPU · int8
Slab's CPU engine (FP32) on the same 1920 x 1080 photo
Cosine similarity of the output with the CPU's: 0.99999.
Before you choose this model
- Non-commercial use only (CC BY-NC 4.0; the authors say academic research).
- Noise in dark areas is brightened too, not removed.
- Strongly colored lights can shift colors.
- It always brightens: well-exposed photos get brighter as well.
- Blown-out highlights stay blown out.