GithubHelp home page GithubHelp logo

kepengxu / fidelity_controllable_compression Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iwa-shi/fidelity_controllable_compression

0.0 0.0 0.0 2.79 MB

Implemention of Fidelity Controllable Extreme Image Compression with GAN

License: MIT License

Python 100.00%

fidelity_controllable_compression's Introduction

Fidelity-Controllable Extreme Image Compression with Generative Adversarial Networks

This repository is a PyTorch implemention of following paper:
Fidelity-Controllable Extreme Image Compression with Generative Adversarial Networks
arxiv url (https://arxiv.org/abs/2008.10314)
Shoma Iwai, Tomo Miyazaki, Yoshihiro Sugaya, and Shinichiro Omachi

Our Environment

    Python==3.6.9
    pytorch==1.0.0
    scipy==1.3.2
    numpy==1.17.4
    opencv-python==4.1.1.26
    tqdm==4.38.0

Pretrained Model

Download our pretrained model and unzip it.
ckpt_model*_mse.pth is trained in the first stage, and ckpt_model*_gan.pth is fine-tuned in the second stage. These two models share the same encoder.

model name Average bitrate (Kodak)
ckpt_model1_*.pth 0.0299 bpp
ckpt_model2_*.pth 0.0623 bpp

Test

    python compress.py MODEL_PATH IMAGE_PATH

Compressed files will be stored at outputs/binary.

    python decompress.py MODEL_PATH BINARY_PATH

For example,

    python compress.py checkpoints/ckpt_model1_gan.pth images/
    python decompress.py checkpoints/ckpt_model1_gan.pth outputs/binary

Network Interpolation

If you want to use network interpolation, run decompress_netinterp.py.

    python decompress_netinterp.py MODEL_PATH MODEL_PATH2 ALPHA BINARY_PATH

For example,

    python compress.py checkpoints/ckpt_model2_gan.pth images/
    python decompress_netinterp.py checkpoints/ckpt_model2_gan.pth checkpoints/ckpt_model2_mse.pth 0.8 outputs/binary

You can balance the trade-off between distortion and perception by changing alpha.

Acknowledgments

We thank nayuki and Jorge Pessoa for the code of atirhmetic coding and GDN, respectively.

fidelity_controllable_compression's People

Contributors

iwa-shi 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.