Skip to content

tongdaxu/Idempotence-and-Perceptual-Image-Compression

Repository files navigation

Code Appendix of Idempotence and Perceptual Image Compression

Prerequisites

Dataset Samples

Fast Run

  • After downloading the pre-trained, the prepared dataset sample can be played with
    python -u run_codec.py --model_config=configs/ffhq_model_config.yaml --diffusion_config=configs/diffusion_config.yaml --task_config=configs/elic_config.yaml --save_dir=results
  • The result is put in save_dir, with 4 sub-dir
    • label: the source image
    • mse_recon: the reconstruction of MSE codec
    • per_recon: the perceptual reconstruction of our proposed codec
    • re_recon: the recompressed perceptual reconstruction
  • The correct behaviour is:
    • mse_recon looks very blurry
    • per_recon looks sharp
    • re_recon looks very similar with mse_recon
  • we provide an example of run results on 5 images of FFHQ, using elic bitrate 1, in results_example_ffhq_elic_q1
    • label: alt text
    • mse_recon: alt text
    • per_recon: alt text
    • re_recon: alt text
    • This example run should be able to be reproduced almost exactly by the above command

Run Codec

  • To run a codec with DDPM trained on FFHQ and ELIC base codec
python -u run_codec.py --model_config=configs/ffhq_model_config.yaml --diffusion_config=configs/diffusion_config.yaml \
--task_config=configs/elic_config.yaml --save_dir=results
  • To run a codec with DDPM trained on Imagenet and ELIC base codec
python -u run_codec.py --model_config=configs/imagenet_model_config.yaml --diffusion_config=configs/diffusion_config.yaml \
--task_config=configs/elic_config.yaml --save_dir=results
  • To run a codec with DDPM trained on FFHQ and Hyperprior base codec
python -u run_codec.py --model_config=configs/ffhq_model_config.yaml --diffusion_config=configs/diffusion_config.yaml \
--task_config=configs/hyper_config.yaml --save_dir=results
  • To run a codec with DDPM trained on Imagenet and Hyperprior base codec
python -u run_codec.py --model_config=configs/imagenet_model_config.yaml --diffusion_config=configs/diffusion_config.yaml \
--task_config=configs/hyper_config.yaml --save_dir=results
  • The dataset root and bitrate is in task_config.yaml.
  • Evaluation:
    • to evaluate bpp, run the base codec test code:
    python test_elic.py
    python test_gg18.py
    • to evaluate mse, psnr and FID, run
    python test_codec.py
    

Notes

About

Official Implementation for (ICLR 2024) Idempotence and Perceptual Image Compression

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages