Skip to content

DeJPEGNet v2

Latest

Choose a tag to compare

@Miosp Miosp released this 01 Nov 20:26

DeJPEGNet v2

A new default model for dejpeg. It removes JPEG artifacts without being told the quality, and it beats FBCNN on PSNR, LPIPS and DISTS at every quality tested on LIVE1, with about a fifth of the parameters (7.47M vs 35.7M).

Try it: https://dejpeg.ludwina.top

Files

File Size Use
dejpeg-v2.onnx 15.4 MB Default model. Stays closest to the original.
dejpeg-v2-texture.onnx 15.3 MB The same model with a texture control: a float input g of shape [1, 1], from 0 to 1.
dejpeg-c40.onnx 5.4 MB DeJPEGNet v1, re-exported as the web app ships it, included so the app can be built from one release.

The v2 files use FP16 weights, FP32 I/O, opset 17 and dynamic N/H/W axes. The texture layers use FP32 weights: dejpeg-v2-texture.onnx was replaced after the first upload because the FP16 version returned NaN on GPUs that flush subnormals to zero. The input is input and the output is output, RGB in [0, 1], and each side must be a multiple of 16. They run in ONNX Runtime Web on WebGPU or WASM.

The Python package (models/dejpeg) still loads v1. The v2 weights are published as ONNX only, and the v2 training code is not in this repository.

Results

LIVE1, one pass with no flip ensemble, PSNR (dB) / LPIPS / DISTS. Lower is better for LPIPS and DISTS.

Model QF10 QF20 QF30 QF40
JPEG input 25.69 / 0.3013 / 0.2387 28.06 / 0.1799 / 0.1653 29.37 / 0.1292 / 0.1315 30.28 / 0.1005 / 0.1126
FBCNN 27.77 / 0.2503 / 0.1785 30.11 / 0.1583 / 0.1319 31.43 / 0.1187 / 0.1083 32.34 / 0.0965 / 0.0936
v2 28.05 / 0.2389 / 0.1742 30.37 / 0.1516 / 0.1287 31.70 / 0.1134 / 0.1055 32.61 / 0.0920 / 0.0913
v2 + Texture, 0.5 28.04 / 0.2280 / 0.1581 30.33 / 0.1415 / 0.1115 31.65 / 0.1037 / 0.0887 32.54 / 0.0828 / 0.0750
v2 + Texture, 1.0 27.97 / 0.2096 / 0.1374 30.23 / 0.1245 / 0.0906 31.50 / 0.0881 / 0.0693 32.35 / 0.0683 / 0.0570
  • Classic5, v2: 30.01 / 32.23 / 33.47 / 34.29 dB at QF10 to QF40, which is 0.17 to 0.22 dB above FBCNN.
  • Speed, v2: about 55 ms per 512x512 tile and 206 ms per 1024x1024 tile, measured in Edge on WebGPU on one NVIDIA GPU. Other hardware will differ.
  • Speed, v2 + Texture: about 70 ms per 512x512 tile.

Which model to use

  • v2 is the choice for fidelity to the original.
  • v2 + Texture looks crisper as the slider goes up, and it scores better on LPIPS and DISTS. The grain it adds is synthetic, not recovered detail, so don't use it where accuracy matters.
  • v1 is a much smaller download and was tuned for perceptual quality rather than PSNR. Its published DISTS on LIVE1 (0.1292 / 0.0895 / 0.0699 / 0.0602) is lower than plain v2's. Those figures come from the v1.0.0 evaluation, whose protocol differs slightly, so treat that comparison as approximate.

Web app changes

  • v2 is now the default, and visitors move to it automatically. v1 stays in the model menu.
  • Tile origins stay on a fixed grid, and tiles past the image edge are mirrored instead of padded with black. Black padding cost up to 0.19 dB on the last 16 pixels.
  • A model picked while another is loading now loads afterwards instead of being ignored.
  • /tool now redirects properly instead of showing source text.

Limitations

  • Trained only on JPEG degradation. It is not a general denoiser or restoration model.
  • The numbers above are from the LIVE1 and Classic5 benchmark sets, and those images are not distributed here.

License

Apache-2.0, like the rest of the repository.