This repository provides a learned compression algorithm for human portraits.
Use the following to clone this repository:
git clone git@github.com:mlomnitz/CompressionGAN.git
This package provides an image compression algorithm using an auto-encoder in a Generative Adversarial Network (GAN) setting. First described in, the implementation in this work focuses on human faces, more specifically profile pictures.
The network was trained using a subset of 40K images curated from the DEX project to produce faithful reconstruction of human faces with a factor of 20-30 in compression.
This package and associated requirements can be installed with pip, using the following:
pip install -r requirements.txt
python setup.py install
The data set used for training/validation/test can be downloaded with the following link The following lists the available trained models and associated configuration files:
- Model trained for 40 epochs, without noise sampling: Epoch40, configfuration
More trained models will be made available as future experiments are completed.
The scripts folder includes three python files that can be used to train the model, compress an image and expand a compressed image. You can view the arguments for any of the scripts by running with the -h option, for example:
python scripts/train.py -h
We can also run inference on one of the provided images (in the images folder) with the following example:
python scripts/compress.py -r checkpoints/gan-40 -i images/test3.jpg -o samples/test3
At present this will output 3 files to the samples directory, a jpg of the reconstructed image, a pdf comparing the input and reconstructed image and a txt file with the bitstring for the compressed file.