Downloads · 30 days
14
42% of all-time downloads
migtissera/x-jpeg
x-jpeg is a machine learning model from migtissera. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for xjpeg. The card lists the license as mit.
Extending JPEG with neural networks (X-JPEG): Image-adaptive quantization with neural networks for JPEG
Downloads · 30 days
14
42% of all-time downloads
All-time downloads
33
Public
Parameters
2.2M
8.8 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8.8 MB · 100%
From the Hugging Face model README
Extending JPEG with neural networks (X-JPEG): Image-adaptive quantization with neural networks for JPEG
X-JPEG predicts image-adaptive JPEG quantization tables. The encoder produces
three 8×8 tables for Y, Cb, and Cr; those tables are passed to MozJPEG or
libjpeg to produce an ordinary, standards-compliant .jpg. No neural network
or custom software is required to decode the output.
Developed by Migel Tissera / Trinity Cloud.
| File | Purpose | SHA-256 |
|---|---|---|
model.safetensors | Encoder-only weights | 823a305b9cdf6d16e2296644d88a343dfc68621fa8e3d4b3c0125772c50b92e8 |
config.json | Architecture and preprocessing contract | f4766ca0045dc256645054da19dda60401e9f05d1438f1ef986e77bfd0cf5e87 |
benchmark.json | Sanitized low-rate aggregate results | 41ffb4739cb58e5687a8a200b27b1c5cfd016aae5d823f79a6cae5d22cc791a6 |
The source PyTorch checkpoint was converted with weights_only=True and
prediction parity was verified exactly on a deterministic non-square RGB
input. This repository contains no pickle checkpoint or training optimizer
state.
The PyPI package already contains these weights:
pip install xjpeg
xjpeg photo.png --target-bpp 0.5
To load this Hub snapshot explicitly:
from pathlib import Path
from huggingface_hub import snapshot_download
from xjpeg import XJPEG
snapshot = Path(snapshot_download(
"migtissera/x-jpeg",
allow_patterns=["model.safetensors", "config.json"],
))
codec = XJPEG(snapshot / "model.safetensors")
result = codec.compress("photo.png", output="photo.jpg", target_bpp=0.5)
print(result.bpp, result.msssim, result.backend)
Source, training code, and methodology: https://github.com/trinity-cloud/x-jpeg
3×8×8 table bottleneck.3×8×8 conditioning from full-resolution DCT-band
energy.[1, 255] and stored in JPEG DQT segments.The model has 19 tensors in its encoder artifact. The training-only mirror decoder, table entropy model, coefficient rate model, and optimizer state are not included.
The model was trained on COCO train2017. Its differentiable 4:2:0 JPEG objective combines RGB MS-SSIM, a 0.25-weight luma MS-SSIM guard, and a learned DCT-symbol rate proxy with rate weight 0.05. Release measurements use actual encoded files rather than the rate proxy.
100 deterministic held-out native-resolution COCO val2017 images, seed
20260721, complete-file conventional bpp, pinned MozJPEG pipeline:
| Method | bpp | RGB MS-SSIM ↑ | Y MS-SSIM ↑ | PSNR ↑ |
|---|---|---|---|---|
| X-JPEG default | 0.49975 | 0.957182 | 0.967685 | 27.045 dB |
| Annex-K + same MozJPEG | 0.50097 | 0.953630 | 0.972323 | 26.958 dB |
| WebP method 6 | 0.50015 | 0.956685 | 0.972758 | 29.164 dB |
| X-JPEG default | 0.25111 | 0.917638 | 0.932246 | 24.899 dB |
| Annex-K + same MozJPEG | 0.25000 | 0.912369 | 0.938567 | 25.009 dB |
| WebP method 6 | 0.24996 | 0.922521 | 0.942144 | 26.609 dB |
These results support an RGB MS-SSIM improvement over the declared standard-table JPEG control. They do not establish general superiority over WebP; WebP is clearly ahead at 0.25 bpp and in luma/PSNR.
Intended for lossy compression of natural photographs and research on adaptive JPEG quantization. It is not an archival or forensic-preservation codec.
--target-bpp performs multiple real encodes per image.The X-JPEG code and model weights are released under the MIT License. MozJPEG is not included in this model repository; platform wheels may bundle it under its upstream license notices.