mlx-community/HVI-CIDNet-Generalization-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.

Recommended default. Trained for cross-dataset generalization. Does the least damage when the exposure gate mis-fires (23.37 dB on an already-correct exposure, vs 20.99 / 16.10 for the others).

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: 0.9835; 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 transform โ€” bit-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-Generalization-fp32

Finetuned
(3)
this model

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