L3C-PyTorch  by fab-jul

PyTorch implementation for learned lossless image compression (CVPR'19 paper)

created 6 years ago
402 stars

Top 73.2% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides a PyTorch implementation of the L3C system for learned lossless image compression, achieving state-of-the-art results that outperform traditional codecs like PNG and WebP. It is targeted at researchers and engineers in computer vision and image processing interested in efficient lossless compression techniques.

How It Works

L3C employs a fully parallelizable hierarchical probabilistic model for adaptive entropy coding. Unlike autoregressive models that operate solely in RGB space, L3C jointly models the image distribution with learned auxiliary representations. This approach requires only three forward passes for all pixel probabilities, offering a significant speedup (over two orders of magnitude) compared to methods like PixelCNN. The learned auxiliary representations are crucial for performance, outperforming predefined ones.

Quick Start & Requirements

  • Install: Clone the repo, create a conda environment (conda create --name l3c_env python=3.7 pip), activate it (conda activate l3c_env), and install dependencies (conda install pytorch=1.1 torchvision cudatoolkit=10.0 -c pytorch, pip install -r pip_requirements.txt). Install torchac separately as described in the README for entropy coding.
  • Prerequisites: Python 3.7, PyTorch 1.1 (PyTorch 1.2 is not supported), CUDA, GCC (tested with 5.5), NVCC (tested with 9.0). scikit-image and awscli are needed for data preprocessing.
  • Setup: Training data preparation for Open Images can take hours and requires ~300 GB of disk space.
  • Links: Paper, FAQ, torchac repo

Highlighted Details

  • Outperforms PNG, WebP, and JPEG 2000 in lossless compression.
  • Achieves over 2x speedup in sampling compared to PixelCNN variants.
  • Offers released trained models for Open Images and ImageNet datasets.
  • Includes a custom C++ extension (torchac) for fast arithmetic coding with optional CUDA support.

Maintenance & Community

The project is associated with ETH Zurich. The README mentions an update to the repo (issue #14) and provides contact information via email (in the paper) or GitHub issues for questions.

Licensing & Compatibility

The repository does not explicitly state a license in the README. However, the nature of the project and its academic origin suggest it is likely intended for research purposes. Commercial use would require clarification of licensing terms.

Limitations & Caveats

PyTorch 1.2 is not supported. The code does not natively support multi-GPU training, requiring modifications for nn.DataParallel. The torchac module's CUDA compilation can be sensitive to specific GCC and NVCC versions. Data preprocessing for Open Images is resource-intensive.

Health Check
Last commit

2 years ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
2 stars in the last 90 days

Explore Similar Projects

Starred by Aravind Srinivas Aravind Srinivas(Cofounder of Perplexity), Ross Taylor Ross Taylor(Cofounder of General Reasoning; Creator of Papers with Code), and
3 more.

pixel-cnn by openai

0.1%
2k
TensorFlow implementation for PixelCNN++ research paper
created 9 years ago
updated 5 years ago
Starred by Lilian Weng Lilian Weng(Cofounder of Thinking Machines Lab), Patrick Kidger Patrick Kidger(Core Contributor to JAX ecosystem), and
4 more.

glow by openai

0.1%
3k
Generative flow research paper code
created 7 years ago
updated 1 year ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Jiayi Pan Jiayi Pan(Author of SWE-Gym; AI Researcher at UC Berkeley), and
4 more.

taming-transformers by CompVis

0.1%
6k
Image synthesis research paper using transformers
created 4 years ago
updated 1 year ago
Feedback? Help us improve.