Imgcomp
Conditional Probability Models for Deep Image Compression
key words: Image Compression, Conditional Probability Model, Context Compression
The model utilizes the context probability with 3DCNN to get obtain the context to code the latent representation. Also, it utilizes the “mask” mind, namely importance map, for spatial bit-allocation. The paper is published in the CVPR 2018.
Our Contributions
- Translate from Tensorflow to mindspore
- Successfully run forward, backward and parameter update
- Test the mindspore version, and compare the version with the tensorflow one.
File Structure
The translated model file is in imgcomp/demo/model_baseline.py.
demo
├── ckpt
│ └── latest.ckpt # test model file
├── model_baseline.py # reproduce model
├── arithmetic_coding.py # arithmetic coding
├── test.py # test
└── train.py # train
Environment
- mindspore-dev==2.0.0dev20230116
- It is recommended to install through the link.
- cuda 11.1
- python 3.7
Command
Please intall compressai via
pip install -e .
under dictionary CompressAI_MindSpore.
Train
Train the model via:
python train.py -d your/own/dataset/address
Test
We code and decode via:
python test.py -d your/own/dataset/address --real
We give our trained model in the imgcomp/demo/ckpt, which is trained on the dataset of imagenet. The model can be tested via the before-amentioned. Besides, the test process is so slow that a Kodak image will spend about 1.5h. So we provide the virtual coding version by:
python test.py -d your/own/dataset/address
The instruction will pass the actual encoding-decoding process, which is very close to the real bitrate (<0.1 % difference for any image).
Comparison
Reconstructed image
Mindspore version
bpp:0.630
Official version
Quality measurements on Kodak
MindSpore version, models trained on imagenet
imgname |
bpp |
PSNR |
MSSSIM |
run_time |
14.png |
0.721 |
21.072 |
0.958 |
1.929 |
11.png |
0.63 |
21.997 |
0.955 |
1.232 |
1.png |
0.704 |
19.157 |
0.956 |
1.193 |
18.png |
0.712 |
20.643 |
0.955 |
0.506 |
6.png |
0.655 |
20.307 |
0.954 |
0.313 |
17.png |
0.606 |
24.307 |
0.97 |
1.095 |
24.png |
0.685 |
19.468 |
0.963 |
0.591 |
20.png |
0.538 |
23.462 |
0.968 |
0.66 |
9.png |
0.526 |
24.839 |
0.963 |
1.066 |
2.png |
0.637 |
24.026 |
0.939 |
1.216 |
13.png |
0.791 |
16.89 |
0.948 |
1.173 |
23.png |
0.517 |
25.718 |
0.968 |
0.663 |
16.png |
0.595 |
23.526 |
0.959 |
1.125 |
7.png |
0.548 |
24.676 |
0.972 |
1.07 |
22.png |
0.668 |
22.753 |
0.948 |
0.978 |
4.png |
0.62 |
24.49 |
0.955 |
0.48 |
8.png |
0.707 |
16.838 |
0.961 |
0.876 |
12.png |
0.59 |
24.8 |
0.956 |
0.387 |
21.png |
0.599 |
21.192 |
0.959 |
0.5 |
10.png |
0.564 |
24.715 |
0.963 |
0.714 |
19.png |
0.619 |
21.539 |
0.958 |
0.704 |
5.png |
0.754 |
19.234 |
0.965 |
1.496 |
15.png |
0.6 |
23.458 |
0.96 |
1.149 |
3.png |
0.534 |
25.244 |
0.967 |
1.904 |
average |
0.63 |
22.265 |
0.959 |
0.959 |
|
MSSSIM |
bpp |
Official TF version |
0.987 |
0.677 |
Official version can be referred from the link.
Citation
@inproceedings{mentzer2018conditional1,
Author = {Mentzer, Fabian and Agustsson, Eirikur and Tschannen, Michael and Timofte, Radu and Van Gool, Luc},
Booktitle = {Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
Title = {Conditional Probability Models for Deep Image Compression},
Year = {2018}}
Contributors
Name:
Zhuozhen Yu:
email: yuzhuozhen@stu.pku.edu.cn
Please keep free to contact us.
Hua Ye