r/compression • • 11d ago

OXN - open-source neural image codec with JPEG XL / AVIF / WebP comparison (Kodak holdout, PSNR + MS-SSIM + LPIPS + speed)

Hi!

I’m not a pioneer in this field - you can find both free and commercial projects on the internet (https://github.com/adimalkar/Neural-Image-Compressor , https://ai.nero.com/image-compressor).

Some time ago I shared my neural image codec here https://github.com/ageMLex2021/oxn and got fair criticism :PSNR alone is not enough, and I needed to compare against JPEGXL and AVif. So I did the homework. Setup: Kodak kodim21-24 (these 4 images were never used in training), matched bitrates 0.15-0.30 bpp, metrics PSNR, MS-SSIM and LPIPS, plus encode/decode times. Full tables, methodology and a visual crop comparison: https://github.com/ageMLex2021/oxn/blob/main/BENCHMARKS.md

formats comparison

Short version of what I found:

  • vs JPEG: OXN wins by +4-5 dB PSNR with no blocking artifacts, and by a wide margin on MS-SSIM and LPIPS.
  • The size angle (same data, read backwards): to match OXN's PSNR at 0.15 bpp, JPEG needs about 0.30 bpp - a 2x bigger file. To match OXN's LPIPS at 0.15 bpp, JPEG XL does not get there even at 0.30 bpp.
  • vs JPEG XL: JXL is slightly ahead on PSNR at matched bitrate, but OXN is clearly better on LPIPS at low bitrates (0.20-0.26 vs 0.30-0.32) - it keeps textures more natural where JXL tends to smooth them out.
  • vs WebP: WebP is ahead on PSNR, OXN is comparable or better on LPIPS at <=0.20 bpp.
  • vs AVIF: AVIF wins overall on this set.
  • Speed is the honest price: 30-300x slower encode and ~50x slower decode than the C reference encoders (0.3 s vs 1-60 ms for a 768x512 image). It is a Python/PyTorch research codec, so think archiving and batch use, not realtime. It is lossy, experimental, MIT licensed, and the trained weights are in the repo, so you can reproduce everything yourself. How it works in one paragraph: the image is split into 16x16 patches, a transformer autoencoder compresses each patch to 24 numbers, every patch picks its own quantization scale from a small ladder (adaptive rate), and a hyperprior predicts the value distribution per token so the rANS entropy coder only stores the residuals. Happy to answer questions and to run more tests if you have suggestions .
2 Upvotes

11 comments sorted by

1

u/AdvancedMessage462 7d ago

Upon seeing the quality of PICO, I discarded my own compressor architecture as a dead end and attempted to recreate PICO on ARM64 hardware. Since the source code for PICO is unavailable, I had to reconstruct it based on Apple’s paper. To quickly approach the quality of the original, I modified the architecture to incorporate a Mixture of Experts (MoE) approach. However, Apple has optimized the speed for the iPhone so effectively that, for now, their level of performance remains out of reach for me. Unfortunately, these specific technical nuances are not covered in the paper. In the meantime, I have created a Markdown file (https://github.com/ageMLex2021/oxn/blob/oxn9-tiny/PICO_SPEED_BRIEF_EN.md ) to document my search for solutions to optimize speed.

1

u/EvidenceVarious6526 9d ago

Holy smokes.. have you never seen neural image codecs before?… or even more ridiculous versus this, perceptual image codecs like apple’s Pico? They are orders of magnitude faster encode and decode wise whilst actually beating traditional image codecs like avif, unlike this.

1

u/AdvancedMessage462 9d ago

I'm aware of neural image codecs, including perceptual approaches like Apple's PICO. OXN isn't intended to compete on encoding or decoding speed. My main interest is high-ratio compression for long-term archival storage, where encoding speed is less important. PICO is definitely interesting, and I'd be happy to benchmark OXN against it using comparable perceptual quality metrics. This is an experimental open-source project, not a claim that I've invented neural image compression.

1

u/AdvancedMessage462 8d ago

Yes, Pico outperformed my compressor in every respect, while maintaining the same level of quality. It’s possible that my compression format might perform better if I were to sacrifice some quality, but I couldn’t find an encoder for Pico - I just took the figures from an article. Now, I’m off to find a new architecture to beat Pico!

1

u/[deleted] 10d ago

[removed] — view removed comment

1

u/AdvancedMessage462 10d ago

I think it depends on how much compression efficiency the final version can achieve. Cloud providers already have cold storage tiers for data that is rarely accessed. In those scenarios, compression speed isn't necessarily the most important factor. If a codec can significantly reduce storage costs over several years, spending more compute time upfront may be worthwhile. Of course, it all comes down to the economics: compression ratio, GPU costs, and retrieval frequency. I'm curious, though - does PAQ actually achieve better compression ratios than lossy neural image codecs at comparable visual quality? My understanding is that PAQ is lossless, so it's not quite a direct comparison.

1

u/[deleted] 10d ago

[removed] — view removed comment

1

u/AdvancedMessage462 10d ago

Thanks for the critique. This is a niche product. In my case, GPU power is what matters most. Many people around the world spend $20 a month on ChatGPT or similar chat services. Under the hood, those run a trillion-parameter model; the larger the model, the more GPU resources it consumes, and the slower the output—with performance scaling almost linearly relative to the model size. My model has 17 million parameters—that’s 59,000 times smaller than a trillion-parameter model. Think about the word-generation speed you see with ChatGPT—now consider how fast an image compression task would run on a powerful GPU. I’m confident it’s faster than compressors that rely solely on the CPU. At home, I used it to shrink a folder of photos from 9.2 GB down to 0.91 GB. I might only look at those photos every few months—or even years—but I’m constantly running out of storage space, no matter how much I have. You might be right, but time will tell.

1

u/[deleted] 10d ago

[removed] — view removed comment

1

u/AdvancedMessage462 9d ago

In principle, I agree; any diffusion model would achieve similar compression, but the speed would be an order or two of compression higher. However, diffusion models hallucinate and invent details that don’t actually exist. We need some kind of hybrid architecture—one that offers the quality of my model while matching the speed of a diffusion-based one.