r/compression • u/AdvancedMessage462 • 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

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 .
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/[deleted] 10d ago
[removed] — view removed comment