✅We open-source the model HPCM_Phi_Context, which employs ψᵢ as progressive context in progressive context modeling. We release the model checkpoint optimized for MSE with λ = 0.013. See issue #3 for detailed discussion.
🎉Our new work based on HPCM, "Scaling Learned Image Compression Models up to 1 Billion", has been released on arXiv! [link]
This repository is the official PyTorch implementation of the paper "Learned Image Compression with Hierarchical Progressive Context Modeling".
Abstract: Context modeling is essential in learned image compression for accurately estimating the distribution of latents. While recent advanced methods have expanded context modeling capacity, they still struggle to efficiently exploit long-range dependency and diverse context information across different coding steps. In this paper, we introduce a novel Hierarchical Progressive Context Model (HPCM) for more efficient context information acquisition. Specifically, HPCM employs a hierarchical coding schedule to sequentially model the contextual dependencies among latents at multiple scales, which enables more efficient long-range context modeling. Furthermore, we propose a progressive context fusion mechanism that incorporates contextual information from previous coding steps into the current step, effectively exploiting diverse contextual information. Experimental results demonstrate that our method achieves state-of-the-art rate-distortion performance and strikes a better balance between compression performance and computational complexity.
Our Hierarchical Progressive Context Modeling (HPCM) entropy model significantly advances the performance of Learned Image Compression (LIC) models with the key insights:
- Efficient global-local context modeling with Hierarchical Coding Schedule.
- Exploring effective rich context information through Progressive Context Fusion.
Our method achieves state-of-the-art compression performance gains on Kodak (-19.19%), CLIC (-18.37%), and Tecnick (-22.20%) over VTM-22.0.
This implementation requires Python 3.8 and PyTorch 1.12.
-
Install the dependencies
pip install -r requirements.txt -
Compile the arithmetic coder
If you need real bitstream writing, please compile the arithmetic coder using the following commands. The compiled files are located in the directories
src/entropy_models/entropy_coders/unbounded_rans/build.cd src/entropy_models/entropy_coders/unbounded_rans sh setup.shWe provide the arithmetic coder for Linux, Python 3.8, specifically
_CXX.cpython-38-x86_64-linux-gnu.soandunbounded_ans.cpython-38-x86_64-linux-gnu.so.
Download Flickr2W for training; Kodak, CLIC and TESTIMAGES for evaluation.
python train.py --model_name [HPCM_Base/HPCM_Large] --train_dataset [path-to-train-dataset] --test_dataset [path-to-test-dataset] --lambda [lambda] -e [epoch-num] -lr [learning-rate] -bs [batch-size]
python test.py --model_name [HPCM_Base/HPCM_Large] --dataset [path-to-test-dataset] --checkpoint [path-to-checkpoint]
HPCM-Base models:
| Lambda | Metric | Link | Lambda | Metric | Link |
|---|---|---|---|---|---|
| 0.0018 | MSE | Link | 2.4 | MS-SSIM | Link |
| 0.0035 | MSE | Link | 4.58 | MS-SSIM | Link |
| 0.0067 | MSE | Link | 8.73 | MS-SSIM | Link |
| 0.013 | MSE | Link | 16.64 | MS-SSIM | Link |
| 0.025 | MSE | Link | 31.73 | MS-SSIM | Link |
| 0.0483 | MSE | Link | 60.5 | MS-SSIM | Link |
HPCM-Large models:
| Lambda | Metric | Link | Lambda | Metric | Link |
|---|---|---|---|---|---|
| 0.0018 | MSE | Link | 2.4 | MS-SSIM | Link |
| 0.0035 | MSE | Link | 4.58 | MS-SSIM | Link |
| 0.0067 | MSE | Link | 8.73 | MS-SSIM | Link |
| 0.013 | MSE | Link | 16.64 | MS-SSIM | Link |
| 0.025 | MSE | Link | 31.73 | MS-SSIM | Link |
| 0.0483 | MSE | Link | 60.5 | MS-SSIM | Link |
R-D data on CLIC Pro Valid and Tecnick datasets is in R-D_Data.md.
bpp = [0.1211, 0.1757, 0.2729, 0.4125, 0.5898, 0.8209]
psnr = [29.4022, 30.7547, 32.4012, 34.2063, 36.0145, 37.7525]
bpp = [0.0974, 0.1447, 0.2124, 0.2958, 0.4082, 0.5724]
db_msssim = [13.2883, 14.8748, 16.5800, 18.1826, 19.7679, 21.4763]
bpp = [0.0951, 0.1537, 0.2438, 0.3778, 0.5516, 0.7843]
psnr = [28.9135, 30.4490, 32.1219, 33.9923, 35.8511, 37.7480]
bpp = [0.0943, 0.1429, 0.2090, 0.2935, 0.4016, 0.5577]
db_msssim = [13.2098, 14.7740, 16.6119, 18.2272, 19.7947, 21.4393]
Part of our code is implemented based on CompressAI and DCVC-DC. Thank for the excellent jobs!
We thank Yingzhen Zhai and Zixu Chen for their valuable suggestions to this repository.
@article{li2025hpcm,
title={Learned Image Compression with Hierarchical Progressive Context Modeling},
author={Li, Yuqi and Zhang, Haotian and Li, Li and Liu, Dong},
journal={arXiv preprint arXiv:2507.19125},
year={2025}
}
If you have any questions, please feel free to contact lyq010303@mail.ustc.edu.cn.
