• Stars
    star
    1,153
  • Rank 40,455 (Top 0.8 %)
  • Language
    Python
  • License
    BSD 3-Clause Clea...
  • Created over 4 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A PyTorch library and evaluation platform for end-to-end compression research

ID-CompressAI-logo

CompressAI

License PyPI Downloads

CompressAI (compress-ay) is a PyTorch library and evaluation platform for end-to-end compression research.

CompressAI currently provides:

  • custom operations, layers and models for deep learning based data compression
  • a partial port of the official TensorFlow compression library
  • pre-trained end-to-end compression models for learned image compression
  • evaluation scripts to compare learned models against classical image/video compression codecs

PSNR performances plot on Kodak

Note: Multi-GPU support is now experimental.

Installation

CompressAI supports python 3.6+ and PyTorch 1.7+.

pip:

pip install compressai

Note: wheels are available for Linux and MacOS.

From source:

A C++17 compiler, a recent version of pip (19.0+), and common python packages are also required (see setup.py for the full list).

To get started locally and install the development version of CompressAI, run the following commands in a virtual environment:

git clone https://github.com/InterDigitalInc/CompressAI compressai
cd compressai
pip install -U pip && pip install -e .

For a custom installation, you can also run one of the following commands:

  • pip install -e '.[dev]': install the packages required for development (testing, linting, docs)
  • pip install -e '.[tutorials]': install the packages required for the tutorials (notebooks)
  • pip install -e '.[all]': install all the optional packages

Note: Docker images will be released in the future. Conda environments are not officially supported.

Documentation

Usage

Examples

Script and notebook examples can be found in the examples/ directory.

To encode/decode images with the provided pre-trained models, run the codec.py example:

python3 examples/codec.py --help

An examplary training script with a rate-distortion loss is provided in examples/train.py. You can replace the model used in the training script with your own model implemented within CompressAI, and then run the script for a simple training pipeline:

python3 examples/train.py -d /path/to/my/image/dataset/ --epochs 300 -lr 1e-4 --batch-size 16 --cuda --save

Note: the training example uses a custom ImageFolder structure.

A jupyter notebook illustrating the usage of a pre-trained model for learned image compression is also provided in the examples directory:

pip install -U ipython jupyter ipywidgets matplotlib
jupyter notebook examples/

Evaluation

To evaluate a trained model on your own dataset, CompressAI provides an evaluation script:

python3 -m compressai.utils.eval_model checkpoint /path/to/images/folder/ -a $ARCH -p $MODEL_CHECKPOINT...

To evaluate provided pre-trained models:

python3 -m compressai.utils.eval_model pretrained /path/to/images/folder/ -a $ARCH -q $QUALITY_LEVELS...

To plot results from bench/eval_model simulations (requires matplotlib by default):

python3 -m compressai.utils.plot --help

To evaluate traditional codecs:

python3 -m compressai.utils.bench --help
python3 -m compressai.utils.bench bpg --help
python3 -m compressai.utils.bench vtm --help

For video, similar tests can be run, CompressAI only includes ssf2020 for now:

python3 -m compressai.utils.video.eval_model checkpoint /path/to/video/folder/ -a ssf2020 -p $MODEL_CHECKPOINT...
python3 -m compressai.utils.video.eval_model pretrained /path/to/video/folder/ -a ssf2020 -q $QUALITY_LEVELS...
python3 -m compressai.utils.video.bench x265 --help
python3 -m compressai.utils.video.bench VTM --help
python3 -m compressai.utils.video.plot --help

Tests

Run tests with pytest:

pytest -sx --cov=compressai --cov-append --cov-report term-missing tests

Slow tests can be skipped with the -m "not slow" option.

License

CompressAI is licensed under the BSD 3-Clause Clear License

Contributing

We welcome feedback and contributions. Please open a GitHub issue to report bugs, request enhancements or if you have any questions.

Before contributing, please read the CONTRIBUTING.md file.

Authors

  • Jean Bégaint, Fabien Racapé, Simon Feltman and Hyomin Choi, InterDigital AI Lab.

Citation

If you use this project, please cite the relevant original publications for the models and datasets, and cite this project as:

@article{begaint2020compressai,
	title={CompressAI: a PyTorch library and evaluation platform for end-to-end compression research},
	author={B{\'e}gaint, Jean and Racap{\'e}, Fabien and Feltman, Simon and Pushparaja, Akshay},
	year={2020},
	journal={arXiv preprint arXiv:2011.03029},
}

Related links

More Repositories

1

HRFAE

Official implementation for paper High Resolution Face Age Editing
Python
299
star
2

latent-transformer

Official implementation for paper: A Latent Transformer for Disentangled Face Editing in Images and Videos.
Python
142
star
3

FeatureStyleEncoder

Jupyter Notebook
90
star
4

CompressAI-Vision

CompressAI-Vision helps you design, test and compare Video Compression for Machines pipelines. Compression methods can be either pulled from custom AI-based modules from CompressAI or traditional codecs such as H.266/VVC.
Python
81
star
5

UnderPressure

Python
54
star
6

AdvantEDGE

AdvantEDGE, Mobile Edge Emulation Platform
Go
51
star
7

PccAI

PccAI is a framework for AI-based point cloud compression
Python
31
star
8

GRASP-Net

Source code of "GRASP-Net: Geometric Residual Analysis and Synthesis for Point Cloud Compression"
Python
27
star
9

TearingNet

Source code for the paper "TearingNet: Point Cloud Autoencoder to Learn Topology-Friendly Representations"
Python
26
star
10

VTMDecoder_VLCPlugin

VVC decoder plugin for VLC based on a multithreaded VTM
C
21
star
11

FESTA

Source code for the paper "FESTA: Flow Estimation via Spatial-Temporal Attention for Scene Point Clouds"
Python
18
star
12

CompressAI-Trainer

Training platform for End-to-End compression models, losses and metrics defined in Compressai
Python
17
star
13

SADL

C++
14
star
14

DeepFilmGrain

Official implementation for paper : Deep-based film grain removal and synthesis
Python
12
star
15

DialogSummary-VideoQA

Python
10
star
16

GstH266Enc

An open-source custom Gstreamer plugin for Versatile Video Coding (VVC) encoder.
C
9
star
17

Fireball

Deep Neural Network Library
Jupyter Notebook
9
star
18

VersatileFilmGrain

Software model of hardware-friendly film grain synthesis, supporting MPEG FGC SEI and AOM/AV1 parameters
C
7
star
19

QuantumChannelDecoding

A quantum algorithm for channel decoding of linear block codes such as Hamming codes and Polar codes
Jupyter Notebook
6
star
20

EdgeLink

EdgeLink, SDN controlled wireless mesh network
Java
5
star
21

StyleBasedFilmGrain

Official implementation for paper : Style-based film grain analysis and synthesis
4
star
22

ActiveLearning

Codes related to our paper Efficacy of Bayesian Neural Networks in Active Learning CVPR 2021
Jupyter Notebook
4
star
23

ObjectRemovalDetection

Detection of Removed Objects in 3D Meshes Using Up-to-Date Images for Mixed Reality Applications
C++
3
star
24

doec

Deep Octree Entropy Coding
Python
3
star
25

CoLDE

Companion Code for TKDD 2022 Journal Paper: "Supervised Contrastive Learning for Interpretable Long-Form Document Matching"
Python
2
star
26

ARDENT

Agnostic platfoRm DEploymeNt orchesTrator (ARDENT)
Go
1
star
27

GraphBasedSceneRegistration

Graph-based Model Registration for Semantically Rich Scenes
C++
1
star
28

nf-pcac

Python
1
star
29

IDCC_SkineticDriver

IDCC_SkineticDriver
C++
1
star