Git Product home page Git Product logo

lossy-vae's Introduction

Lossy Image Compression using Hierarchical VAEs

This repository contains authors' implementation of several deep hierarchical VAE-based methods related to lossy image compression.
Code is under active development, and the API is subject to change.

Features

Progressive coding: our models learn a deep hierarchy of latent variables and compress/decompress images in a coarse-to-fine fashion. This feature comes from the hierarchical nature of ResNet VAEs.

Compression efficiency: our models are powerful in terms of both rate-distortion (bpp-PSNR) and decoding speed.

Model Name CPU* Enc. CPU* Dec. 1080 ti Enc. 1080 ti Dec. BD-rate*
qres34m 0.899s 0.441s 0.213s 0.120s -3.95
qarv_base 0.880s 0.295s 0.211s 0.096s -6.54

*Time is the latency to encode/decode a 512x768 image, averaged over 24 Kodak images. Tested in plain PyTorch (v1.13 + CUDA 11.7) code, ie, no mixed-precision, torchscript, ONNX/TensorRT, etc.
*CPU is Intel 10700k.
*BD-rate is w.r.t. VTM 18.0, averaged on three common test sets (Kodak, Tecnick TESTIMAGES, and CLIC 2022 test set).

Implemented Methods - Pre-Trained Models Available

  • Lossy Image Compression with Quantized Hierarchical VAEs [arXiv]
  • QARV: Quantization-Aware ResNet VAE for Lossy Image Compression [arXiv]
    • Technical report
    • [Abstract]: improved version of QRes-VAE. Variable-rate, faster decoding, better performance.
    • [Code]: lossy-vae/lvae/models/qarv
  • An Improved Upper Bound on the Rate-Distortion Function of Images
    • [Abstract]: a 15-layer VAE model used to estimate the information R(D) function. Shows that -30% BD-rate w.r.t. VTM is theoretically achievable.
    • [Code]: lossy-vae/lvae/models/rd

Install

Requirements:

Download and Install:

  1. Download the repository;
  2. Modify the dataset paths in lossy-vae/lvae/paths.py.
  3. [Optional] pip install the repository in development mode:
cd /pasth/to/lossy-vae
python -m pip install -e .

Usage

Detailed usage is provided in each model's folder

Prepare Datasets for Training and Evaluation

COCO

  1. Download the COCO dataset "2017 Train images [118K/18GB]" from https://cocodataset.org/#download
  2. Unzip the images anywhere, e.g., at /path/to/datasets/coco/train2017
  3. Edit lossy-vae/lvae/paths.py such that
known_datasets['coco-train2017'] = '/path/to/datasets/coco/train2017'

Kodak (link), Tecnick TESTIMAGES (link), and CLIC (link)

python scripts/download-dataset.py --name kodak         --datasets_root /path/to/datasets
                                          clic2022-test
                                          tecnick

Then, edit lossy-vae/lvae/paths.py such that known_datasets['kodak'] = '/path/to/datasets/kodak', and similarly for other datasets.

License

TBD

lossy-vae's People

Contributors

duanzhiihao avatar

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.