Giter Club home page Giter Club logo

ca_entropy_model's Introduction

Context-adaptive Entropy Model for End-to-end Optimized Image Compression

Repository of the paper "Context-adaptive Entropy Model for End-to-end Optimized Image Compression"

Introduction

This repository includes evaluation results, reconstructed images, and test codes of our paper "Context-adaptive Entropy Model for End-to-end Optimized Image Compression". Please refer to the paper for the detailed information.

Reconstructed samples

Samples

Evaluation results

We optimized the networks with the two different types of distortion terms, one with MSE and the other with MS-SSIM. For each distortion type, the average bits per pixel (BPP) and the distortion, PSNR or MS-SSIM, over 24 PNG images of the Kodak PhotoCD image dataset are measured for each of the nine R-D configurations. Therefore, a total of 18 networks are trained and evaluated. To our best knowledge, this is the first test results of ANN-based image compression which outperform BPG, in terms of PSNR as well as MS-SSIM.

Followings are the rate-distortion curves of the proposed method and competitive methods. The top plot represents PSNR values in consequence of bpp changes, while the bottom plot shows MS-SSIM values in the same manner. Note that MS-SSIM values are converted to decibels for differentiating the quality levels.

RD-PSNR

RD-MS-SSIM

The compression gains in terms of BD-rate of PSNR over JPEG2000, Balle'18(MSE-optimized), BPG are 34.08%, 11.87%, 6.85%, respectively. In case of MS-SSIM, we found the wider gaps of 68.82%, 13.93%, 49.68%, respectively.

Test code

We provide test codes for evaluating a image compression model proposed in our work "Context-adaptive Entropy Model for End-to-end Optimized Image Compression". The model includes two types of models, base models for low bpp and hybrid models for high bpp.

Supported I/O formats

Python Imaging Library (PIL) is used in our test code. To file the supported formats, please refer to https://pillow.readthedocs.io/en/4.1.x/handbook/image-file-formats.html. PNG and BMP formats including RGB channels have been tested.

Encoding

  • usage: encode.py [-h] [--model_type {0,1}] [--input_path INPUT_PATH] [--compressed_file_path COMPRESSED_FILE_PATH] [--quality_level {1,2,3,4,5,6,7,8,9}]

  • optional arguments: --model_type {0,1} 0: MSE optimized 1: MS-SSIM optimized --input_path input image path --compressed_file_path target compressed file path --quality_level {1,2,3,4,5,6,7,8,9} quality level from 1 to 9. The higher, the better

  • Sample command for encoding: python encode.py --model_type 0 --input_path ./examples/input_example.png --compressed_file_path ./examples/output.cmp --quality_level 5

Decoding

  • usage: decode.py [-h] [--compressed_file_path COMPRESSED_FILE_PATH] [--recon_path RECON_PATH]

  • optional arguments: --compressed_file_path input compressed file path --recon_path target reconstructed image path

  • Sample command for decoding: python decode.py --compressed_file_path ./examples/output.cmp --recon_path ./examples/recon_example.png

Notes

  • When you excute test codes for the first time, it may take a few minutes to download models. Please be patient.
  • When HDF5 version error occurs during tests, please try to install HDF5 1.10.1. When you use anaconda environment, you can install it using the following command: conda install -c anaconda hdf5=1.10.1
  • Currently test codes spend most of time for arithmetic coding and decoding. We implemented the arithmetic coder that operates with the model parameter such as mu and sigma, based on Nayuki's work. We really appreciate for her great effort. Note that, however, current the model-based arithmetic coder is not fully optimized. If anybody has any idea on it, please let us know.
  • Note that the evaluation results in our papaer are not the first results that outperforms BPG. David Minnen et al showed that their model outperforms BPG, a bit earlier than us. We'll revise Our manuscript to correct it soon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.