image_compression
所属分类:人工智能/神经网络/深度学习
开发工具:Python
文件大小:2355KB
下载次数:1
上传日期:2020-03-31 14:57:33
上 传 者:
Tad晓
说明: 图像压缩算法,实现论文:
Full Resolution Image Compression with Recurrent Neural Networks
(image compression algorithm)
文件列表:
bpp-0.125-0.133-ssim-0.865-0.827.png (483555, 2018-04-19)
bpp-0.250-0.249-ssim-0.937-0.918.png (587332, 2018-04-19)
bpp-0.375-0.381-ssim-0.963-0.951.png (680933, 2018-04-19)
dataset.py (1394, 2018-04-19)
decoder.py (2764, 2018-04-19)
encoder.py (4197, 2018-04-19)
functions (0, 2018-04-19)
functions\__init__.py (23, 2018-04-19)
functions\sign.py (725, 2018-04-19)
kodim10.png (593463, 2018-04-19)
metric.py (8237, 2018-04-19)
modules (0, 2018-04-19)
modules\__init__.py (71, 2018-04-19)
modules\conv_rnn.py (2599, 2018-04-19)
modules\sign.py (234, 2018-04-19)
network.py (3201, 2018-04-19)
rd.png (50961, 2018-04-19)
test (0, 2018-04-19)
test\calc_ssim.sh (559, 2018-04-19)
test\draw_rd.py (1237, 2018-04-19)
test\enc_dec.sh (460, 2018-04-19)
test\get_kodak.sh (162, 2018-04-19)
test\jpeg.sh (269, 2018-04-19)
test\jpeg_ssim.csv (7664, 2018-04-19)
test\lstm_ssim.csv (6124, 2018-04-19)
train.py (5517, 2018-04-19)
# Full Resolution Image Compression with Recurrent Neural Networks
https://arxiv.org/abs/1608.05148v2
## Requirements
- PyTorch 0.2.0
## Train
`
python train.py -f /path/to/your/images/folder/like/mscoco
`
## Encode and Decode
### Encode
`
python encoder.py --model checkpoint/encoder_epoch_00000005.pth --input /path/to/your/example.png --cuda --output ex --iterations 16
`
This will output binary codes saved in `.npz` format.
### Decode
`
python decoder.py --model checkpoint/encoder_epoch_00000005.pth --input /path/to/your/example.npz --cuda --output /path/to/output/folder
`
This will output images of different quality levels.
## Test
### Get Kodak dataset
```bash
bash test/get_kodak.sh
```
### Encode and decode with RNN model
```bash
bash test/enc_dec.sh
```
### Encode and decode with JPEG (use `convert` from ImageMagick)
```bash
bash test/jpeg.sh
```
### Calculate SSIM
```bash
bash test/calc_ssim.sh
```
### Draw rate-distortion curve
```bash
python test/draw_rd.py
```
## Result
LSTM (Additive Reconstruction), before entropy coding
### Rate-distortion
![Rate-distortion](rd.png)
### `kodim10.png`
Original Image
![Original Image](kodim10.png)
Below Left: LSTM, SSIM=0.865, bpp=0.125
Below Right: JPEG, SSIM=0.827, bpp=0.133
![bpp-0.125-0.133-ssim-0.865-0.827](bpp-0.125-0.133-ssim-0.865-0.827.png)
Below Left: LSTM, SSIM=0.937, bpp=0.250
Below Right: JPEG, SSIM=0.918, bpp=0.249
![bpp-0.250-0.249-ssim-0.937-0.918](bpp-0.250-0.249-ssim-0.937-0.918.png)
Below Left: LSTM, SSIM=0.963, bpp=0.375
Below Right: JPEG, SSIM=0.951, bpp=0.381
![bpp-0.375-0.381-ssim-0.963-0.951](bpp-0.375-0.381-ssim-0.963-0.951.png)
## What's inside
- `train.py`: Main program for training.
- `encoder.py` and `decoder.py`: Encoder and decoder.
- `dataset.py`: Utils for reading images.
- `metric.py`: Functions for Calculatnig MS-SSIM and PSNR.
- `network.py`: Modules of encoder and decoder.
- `modules/conv_rnn.py`: ConvLSTM module.
- `functions/sign.py`: Forward and backward for binary quantization.
## Official Repo
https://github.com/tensorflow/models/tree/master/compression
近期下载者:
相关文件:
收藏者: