Lossless Image Compression Through Super-Resolution

栏目: IT技术 · 发布时间: 4年前

内容简介:If you use our codebase, please consider also

Lossless Image Compression through Super-Resolution

Sheng Cao , Chao-Yuan Wu , Philipp Krähenbühl .

[Paper]

Lossless Image Compression Through Super-Resolution

Citation

@article{cao2020lossless,
  title={Lossless Image Compression through Super-Resolution},
  author={Cao, Sheng and Wu, Chao-Yuan and and Kr{\"a}henb{\"u}hl, Philipp},
  year={2020},
  journal={arXiv preprint arXiv:2004.02872},
}

If you use our codebase, please consider also citing L3C

Overview

This is the official implementation of SReC in PyTorch . SReC frames lossless compression as a super-resolution problem and applies neural networks to compress images. SReC can achieve state-of-the-art compression rates on large datasets with practical runtimes. Training, compression, and decompression are fully supported and open-sourced.

Getting Started

We recommend the following steps for getting started.

  1. Install the necessary dependencies
  2. Download the Open Images validation set
  3. Run compression on Open Images validation setwithtrained model weights

Installation

See here for installation instructions.

Model Weights

We've released trained models for both ImageNet64 and Open Images (PNG) . All compression results are measured in bits per subpixel (bpsp).

Dataset Bpsp Model Weights
ImageNet64 4.29 models/imagenet64.pth
Open Images 2.70 models/openimages.pth

Training

To run code, you need to be in top level directory.

python3 -um src.train \
  --train-path "path to directory of training images" \
  --train-file "list of filenames of training images, one filename per line" \
  --eval-path "path to directory of eval images" \
  --eval-file "list of filenames of eval images, one filename per line" \
  --plot "directory to store model output" \
  --batch "batch size"

The training images must be organized in form of train-path/filename from filename in train-file. Same thing applies to eval images.

We've included our training and eval files used for ImageNet64 and Open Images (PNG) in datasets directory.

For ImageNet64, we use a slightly different set of hyperparameters than Open Images hyperparameters, which are the default. To train ImageNet64 based on settings from our paper, run

python3 -um src.train \
  --train-path "path to directory of training images" \
  --train-file "list of filenames of training images, one filename per line" \
  --eval-path "path to directory of eval images" \
  --eval-file "list of filenames of eval images, one filename per line" \
  --plot "directory to store model output" \
  --batch "batch size" \
  --epochs 10 \
  --lr-epochs 1 \
  --crop 64

Run python3 -um src.train --help for a list of tunable hyperparameters.

Evaluation

Given a model checkpoint, this evaluates theoretical bits/subpixel (bpsp) based on log-likelihood. The log-likelihood bpsp lower-bounds the actual compression bpsp.

python3 -um src.eval \
  --path "path to directory of images" \
  --file "list of filenames of images, one filename per line" \
  --load "path to model weights"

Compression/Decompression

With torchac installed, you can run compression/decompression to convert any image into .srec files. The following compresses a directory of images.

python3 -um src.encode \
  --path "path to directory of images" \ 
  --file "list of filenames of images, one filename per line" \
  --save-path "directory to save new .srec files" \
  --load "path to model weights"

If you want an accurate runtime, we recommend running python with -O flag to disable asserts. We also include an optional --decode flag so that you can check if decompressing the .srec file gives the original image, as well as provide runtime for decoding.

To convert .srec files into PNG, you can run

python3 -um src.decode \
  --path "path to directory of .srec images" \ 
  --file "list of filenames of .srec images, one filename per line" \
  --save-path "directory to save png files" \
  --load "path to model weights"

Downloading ImageNet64

You can download ImageNet64 training and validation sets here .

Preparing Open Images Dataset (PNG)

We use the same set of training and validation images of Open Images as L3C .

For validation images , you can download them here .

For training images , please clone the L3C repo and run script from here

See this issue for differences between Open Images JPEG and Open Images PNG.

Acknowledgment

Thanks to L3C for implementations of EDSR, logistic mixtures, and arithmetic coding. Special thanks to Fabian Mentzer for letting us know about issues with the preprocessing script for Open Images JPEG and resolving them quickly.


以上所述就是小编给大家介绍的《Lossless Image Compression Through Super-Resolution》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

CLR via C#

CLR via C#

Jeffrey Richter / 周靖 / 清华大学出版社 / 2015-1-1 / CNY 109.00

《CLR via C#(第4版)》针对CLR和.NET Framework 4.5进行深入、全面的探讨,并结合实例介绍了如何利用它们进行设计、开发和调试。全书5部分共29章。第Ⅰ部分介绍CLR基础,第Ⅱ部分解释如何设计类型,第Ⅲ部分介绍基本类型,第Ⅳ部分以核心机制为主题,第Ⅴ部分重点介绍线程处理。 通过本书的阅读,读者可以掌握CLR和.NET Framework的精髓,轻松、高效地创建高性能......一起来看看 《CLR via C#》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

随机密码生成器
随机密码生成器

多种字符组合密码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具