This is a personal reimplementation of NIPS2018 paper: D. Minnen et al. "Joint Autoregressive and Hierarchical Priors for Learned Image Compression". We achieved almost the same results as in the paper.
Paper [ArXiv] | [NIPS2018]
- Anaconda
This creates an Anaconda environment with Python 3.6 and CUDA libraries, and then installs TensorFlow and tensorflow-compression with GPU support:
conda create --name py36 python=3.6 cudatoolkit=10.0 cudnn
conda activate py36
pip install tensorflow-gpu==1.15 tensorflow-compression
Importing the library from your Python code as follows:
import tensorflow as tf
import tensorflow_compression as tfc
Download the file and run:
python tfci.py -h
This will give you a list of options. Briefly, the command
python tfci.py compress <model> <PNG file>
will compress an image using a pre-trained model and write a file ending in
.tfci
. Execute python tfci.py models
to give you a list of supported
pre-trained models. The command
python tfci.py decompress <TFCI file>
will decompress a TFCI file and write a PNG file. By default, an output file will be named like the input file, only with the appropriate file extension appended (any existing extensions will not be removed).
To train the models, you need to supply it with a dataset of RGB training images. They should be provided in PNG format. Training can be as simple as the following command:
python joint_NIPS2018.py --verbose train --train_glob="images/*.png"