How to use from the
Use from the
MLX library
# Download the model from the Hub
pip install huggingface_hub[hf_xet]

huggingface-cli download --local-dir HVI-CIDNet-LOLv1-fp32 mlx-community/HVI-CIDNet-LOLv1-fp32

mlx-community/HVI-CIDNet-LOLv1-fp32

HVI-CIDNet low-light / exposure correction, converted to Apple MLX for Apple-Silicon inference via the mlx-cidnet-swift Swift package.

Yan et al., HVI: A New Color Space for Low-light Image Enhancement, CVPR 2025 — 1st place, NTIRE 2025 Low-Light Enhancement Challenge. 1,975,569 parameters (7.9 MB). Underexposed image in → re-exposed image at the same resolution out.

The headline LOL-v1 model (perceptual loss). Strongest lift on severely underexposed input (+14.50 dB at 0.15x exposure) and the best published LOL numbers.

Use with mlx-cidnet-swift

import CIDNetMLXCore

let model = CIDNet()
try model.loadWeights(from: weightsURL)   // model.safetensors from this repo
let brightened = model(imageNHWC)          // NHWC RGB in [0,1]

Or as an MLXEngine imageRelight ModelPackage (MLXCIDNet.CIDNetRelightPackage), which resolves this repo via the Hub and applies the exposure gate below automatically.

⚠️ Gate this model on input exposure — it is not safe to apply unconditionally

Every published checkpoint drives its output toward a target mean luma regardless of input. On an image that is already correctly exposed the model therefore degrades it. Measured against a correctly-exposed reference:

checkpoint applied to an already-correct exposure
Generalization 23.37 dB
LOLv1-wperc 20.99 dB
SICE 16.10 dB

SICE's output mean stays within 0.35–0.40 across a 12× input range — it is an auto-exposure normalizer, not a shadow lift.

Estimate input luma and bypass above a threshold; expose a strength blend for partial application. mlx-cidnet-swift does both. Note also that Generalization scores −0.52 dB — worse than doing nothing — at 0.70× exposure, which is the moderate underexposure regime that LOL-trained models are documented to handle badly.

Conversion

MLX NHWC layout: 191 tensors → 81 conv + 61 depthwise transposed (O,I,kH,kW) → (O,kH,kW,I), 49 passthrough. Upstream already publishes safetensors, so this is a relayout, not a format change.

trans.density_k is a learned parameter and differs per checkpoint (this one: 1.1255; init is 0.2). It rides in the weights — do not hardcode it.

Parity

Gated against the PyTorch oracle on the CPU stream, fp32, judged on relative error:

  • key contract — 191 tensors / 1,975,569 params / 0 missing / 0 unused, strict load
  • HVI colour transformbit-exact (worst 6.6e-07), including the degenerate colours and the yellow/cyan channel ties that decide the masking priority
  • primitives — PReLU exactly 0.00e+00; the align-corners resamplers ~5e-07
  • full model — cosine 1.00000000 at 64² / 128² / 256², and on a severely underexposed tile

Weights: MIT (Fediory/HVI-CIDNet, published first-party by the authors). Port code: MIT.

Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
1.98M params
Tensor type
F32
·
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for mlx-community/HVI-CIDNet-LOLv1-fp32

Finetuned
(3)
this model

Collection including mlx-community/HVI-CIDNet-LOLv1-fp32

Free AI Image Generator No sign-up. Instant results. Open Now