Pytorch implementation of the paper “Adaptive Fused Prior Transfer for Controllable Generative Image Compression”.
See the codeAFP-GIC is designed to make generative image compression content-adaptive and reduce hallucinations: invented details that do not match the original image. It adapts the visual knowledge transferred from a pretrained model to each image, guiding compression and reconstruction toward more realistic textures and better preservation of the original content, even at very low bitrates.
Our paper, Adaptive Fused Prior Transfer for Controllable Generative Image Compression, published in IEEE Access (2026), presents this content-adaptive design with five bitrate operating points in a single deployable pretrained model, without transmitting the fused prior or reloading model weights between operating points. System-level benchmarks on an NVIDIA RTX 4090 demonstrate 18.1% lower decoder latency and 31.1M fewer inference parameters than DC-VIC. Explore the released code and checkpoint, or upload your own images to experience compression and reconstruction in the live demo below.
Try it with your own images: choose an operating point, compress, and compare the reconstruction side by side. Download the actual compressed bitstream and decode it in the demo. The demo runs on CPU by default.
| Method | Inference parameters | Encoder latency | Decoder latency |
|---|---|---|---|
| DC-VIC | 151.7M | 61.61 ms | 98.27 ms |
| AFP-GIC | 120.6M | 81.34 ms | 80.47 ms |
Benchmark: NVIDIA RTX 4090, 100 DIV2K patches of 256 x 256 pixels (paper, Table 5). Parameter counts include frozen components. These system-level measurements are separate from the CPU-hosted demo's response time.
Continuing our research on learned image compression, AFP-GIC combines adaptive fused-prior transfer and single-model bitrate control in an asymmetric architecture. A frozen AdaCode model supplies image-adaptive guidance to the encoder; the decoder predicts the fused prior from the compressed representation instead of receiving it as side information.
Figure 1. Overview of AFP-GIC. Blue and red indicate encoding and decoding, respectively; snowflakes and flames denote frozen and trainable modules.
Figure 5. Low-bitrate visual comparisons on Kodak. Baselines are shown at their closest available released bitrates; each image is labeled with its actual bpp. Images and annotations are reproduced from the paper.
The metrics directory provides CSV results for all five AFP-GIC operating points on Kodak, CLIC2020, and DIV2K: dataset summaries, paper-rounded values, and 2,760 per-image records including PSNR, SSIM, MS-SSIM, SNR, LPIPS, DISTS, and NIQE. See the data description for the evaluation records and aggregation checks. FID is provided as a dataset-level metric.
To make research comparisons easier, we provide all 2,760 reconstructed images, per-image metrics, and dataset-average metrics in our GitHub Releases, covering 24 Kodak, 428 CLIC2020, and 100 DIV2K images at five bitrate operating points. Download the datasets and operating points you need to include AFP-GIC as a baseline under matched evaluation protocols, without rerunning the pretrained model.
This repository provides the Core Inference and Deployment Release, including pretrained model inference, evaluation tools, and an interactive demo. Training infrastructure is maintained separately.
The release was tested with Python 3.9, PyTorch 2.1.0, and torchvision 0.16.0. Create a separate environment and install the pinned dependencies:
git clone https://github.com/yifeipet/AFP_GIC.git
cd AFP_GIC
conda create -n afp-gic python=3.9 -y
conda activate afp-gic
python -m pip install -r public_release/requirements.txt
For GPU evaluation, use a PyTorch build compatible with your GPU and driver. Follow the official PyTorch installation instructions for the pinned version if a platform-specific build is needed. Do not replace the pinned versions with the latest releases when reproducing the paper.
Download the released checkpoint from Google Drive and place it at:
checkpoint/afp_gic_release/model/afp_gic_release.pth.tar
The checkpoint already includes the frozen prior component; no separate AdaCode weight download is required.
Obtain the Kodak dataset and place its 24 original PNG images directly in datasets/kodak/.
From the repository root, evaluate one operating point:
python public_release/test.py -d cuda:0 --dataset kodak --qualities 0
Evaluate all five operating points:
python public_release/test.py -d cuda:0 --dataset kodak --qualities 0 1 2 3 4
| Quality index | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| Nominal target bpp | 0.050 | 0.075 | 0.100 | 0.125 | 0.150 |
Actual bitrates vary with image content. All five indices use the same checkpoint.
The entry point also accepts clic2020_test and div2k_valid_hr. Place the original PNG images in the corresponding directories:
datasets/
|-- kodak/ # Kodak PNG images
|-- CLIC/
| `-- clic_test_images/ # CLIC2020 test PNG images
`-- DIV2K_valid_HR/
`-- DIV2K_valid_HR/ # DIV2K validation PNG images
python public_release/test.py -d cuda:0 --dataset clic2020_test --qualities 0 1 2 3 4
python public_release/test.py -d cuda:0 --dataset div2k_valid_hr --qualities 0 1 2 3 4
The runner saves reconstructed images, actual bitrates, per-image metrics, and summary files. To choose an output directory:
python public_release/test.py -d cuda:0 --dataset kodak --qualities 0 --results-root results/kodak_demo
For this command, outputs include:
results/kodak_demo/
|-- summary_all.csv
|-- comparison_pivot.csv
`-- kodak/afp_gic_release/q0/
|-- <image_name>.png
|-- _bitrates.csv
|-- per_image_metrics.csv
|-- _metrics.json
`-- summary.json
Metric protocols: per_image_metrics.csv records in-loop PSNR, MS-SSIM, and LPIPS; _metrics.json records metrics computed on saved reconstructions. These evaluation paths can produce different values. See the paper and Supplementary Material for the reporting protocols, and Paper Metrics for the released benchmark CSVs.
Run python public_release/test.py --help for the available options. Metric libraries may download their pretrained weights on first use.
If you find our work useful in your research, please cite our official IEEE Access paper:
@article{pei2026adaptive,
title = {Adaptive Fused Prior Transfer for Controllable Generative Image Compression},
author = {Pei, Yifei and Liu, Ying and Ling, Nam},
journal = {IEEE Access},
year = {2026},
doi = {10.1109/ACCESS.2026.3737467},
url = {https://ieeexplore.ieee.org/document/11712133}
}
AFP-GIC builds on DC-VIC and AdaCode, with supporting components from BasicSR and CompressAI. We thank their authors for making these resources available.
Original AFP-GIC additions are provided for research and evaluation use. Third-party components retain their respective licenses; no single permissive license applies uniformly to this repository. Please consult LICENSE and THIRD_PARTY_NOTICES.md before reuse or redistribution.
For questions about this release, please open a GitHub issue.
Pytorch implementation of the paper “Adaptive Fused Prior Transfer for Controllable Generative Image Compression”.
See the codeAFP-GIC is designed to make generative image compression content-adaptive and reduce hallucinations: invented details that do not match the original image. It adapts the visual knowledge transferred from a pretrained model to each image, guiding compression and reconstruction toward more realistic textures and better preservation of the original content, even at very low bitrates.
Our paper, Adaptive Fused Prior Transfer for Controllable Generative Image Compression, published in IEEE Access (2026), presents this content-adaptive design with five bitrate operating points in a single deployable pretrained model, without transmitting the fused prior or reloading model weights between operating points. System-level benchmarks on an NVIDIA RTX 4090 demonstrate 18.1% lower decoder latency and 31.1M fewer inference parameters than DC-VIC. Explore the released code and checkpoint, or upload your own images to experience compression and reconstruction in the live demo below.
Try it with your own images: choose an operating point, compress, and compare the reconstruction side by side. Download the actual compressed bitstream and decode it in the demo. The demo runs on CPU by default.
| Method | Inference parameters | Encoder latency | Decoder latency |
|---|---|---|---|
| DC-VIC | 151.7M | 61.61 ms | 98.27 ms |
| AFP-GIC | 120.6M | 81.34 ms | 80.47 ms |
Benchmark: NVIDIA RTX 4090, 100 DIV2K patches of 256 x 256 pixels (paper, Table 5). Parameter counts include frozen components. These system-level measurements are separate from the CPU-hosted demo's response time.
Continuing our research on learned image compression, AFP-GIC combines adaptive fused-prior transfer and single-model bitrate control in an asymmetric architecture. A frozen AdaCode model supplies image-adaptive guidance to the encoder; the decoder predicts the fused prior from the compressed representation instead of receiving it as side information.
Figure 1. Overview of AFP-GIC. Blue and red indicate encoding and decoding, respectively; snowflakes and flames denote frozen and trainable modules.
Figure 5. Low-bitrate visual comparisons on Kodak. Baselines are shown at their closest available released bitrates; each image is labeled with its actual bpp. Images and annotations are reproduced from the paper.
The metrics directory provides CSV results for all five AFP-GIC operating points on Kodak, CLIC2020, and DIV2K: dataset summaries, paper-rounded values, and 2,760 per-image records including PSNR, SSIM, MS-SSIM, SNR, LPIPS, DISTS, and NIQE. See the data description for the evaluation records and aggregation checks. FID is provided as a dataset-level metric.
To make research comparisons easier, we provide all 2,760 reconstructed images, per-image metrics, and dataset-average metrics in our GitHub Releases, covering 24 Kodak, 428 CLIC2020, and 100 DIV2K images at five bitrate operating points. Download the datasets and operating points you need to include AFP-GIC as a baseline under matched evaluation protocols, without rerunning the pretrained model.
This repository provides the Core Inference and Deployment Release, including pretrained model inference, evaluation tools, and an interactive demo. Training infrastructure is maintained separately.
The release was tested with Python 3.9, PyTorch 2.1.0, and torchvision 0.16.0. Create a separate environment and install the pinned dependencies:
git clone https://github.com/yifeipet/AFP_GIC.git
cd AFP_GIC
conda create -n afp-gic python=3.9 -y
conda activate afp-gic
python -m pip install -r public_release/requirements.txt
For GPU evaluation, use a PyTorch build compatible with your GPU and driver. Follow the official PyTorch installation instructions for the pinned version if a platform-specific build is needed. Do not replace the pinned versions with the latest releases when reproducing the paper.
Download the released checkpoint from Google Drive and place it at:
checkpoint/afp_gic_release/model/afp_gic_release.pth.tar
The checkpoint already includes the frozen prior component; no separate AdaCode weight download is required.
Obtain the Kodak dataset and place its 24 original PNG images directly in datasets/kodak/.
From the repository root, evaluate one operating point:
python public_release/test.py -d cuda:0 --dataset kodak --qualities 0
Evaluate all five operating points:
python public_release/test.py -d cuda:0 --dataset kodak --qualities 0 1 2 3 4
| Quality index | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| Nominal target bpp | 0.050 | 0.075 | 0.100 | 0.125 | 0.150 |
Actual bitrates vary with image content. All five indices use the same checkpoint.
The entry point also accepts clic2020_test and div2k_valid_hr. Place the original PNG images in the corresponding directories:
datasets/
|-- kodak/ # Kodak PNG images
|-- CLIC/
| `-- clic_test_images/ # CLIC2020 test PNG images
`-- DIV2K_valid_HR/
`-- DIV2K_valid_HR/ # DIV2K validation PNG images
python public_release/test.py -d cuda:0 --dataset clic2020_test --qualities 0 1 2 3 4
python public_release/test.py -d cuda:0 --dataset div2k_valid_hr --qualities 0 1 2 3 4
The runner saves reconstructed images, actual bitrates, per-image metrics, and summary files. To choose an output directory:
python public_release/test.py -d cuda:0 --dataset kodak --qualities 0 --results-root results/kodak_demo
For this command, outputs include:
results/kodak_demo/
|-- summary_all.csv
|-- comparison_pivot.csv
`-- kodak/afp_gic_release/q0/
|-- <image_name>.png
|-- _bitrates.csv
|-- per_image_metrics.csv
|-- _metrics.json
`-- summary.json
Metric protocols: per_image_metrics.csv records in-loop PSNR, MS-SSIM, and LPIPS; _metrics.json records metrics computed on saved reconstructions. These evaluation paths can produce different values. See the paper and Supplementary Material for the reporting protocols, and Paper Metrics for the released benchmark CSVs.
Run python public_release/test.py --help for the available options. Metric libraries may download their pretrained weights on first use.
If you find our work useful in your research, please cite our official IEEE Access paper:
@article{pei2026adaptive,
title = {Adaptive Fused Prior Transfer for Controllable Generative Image Compression},
author = {Pei, Yifei and Liu, Ying and Ling, Nam},
journal = {IEEE Access},
year = {2026},
doi = {10.1109/ACCESS.2026.3737467},
url = {https://ieeexplore.ieee.org/document/11712133}
}
AFP-GIC builds on DC-VIC and AdaCode, with supporting components from BasicSR and CompressAI. We thank their authors for making these resources available.
Original AFP-GIC additions are provided for research and evaluation use. Third-party components retain their respective licenses; no single permissive license applies uniformly to this repository. Please consult LICENSE and THIRD_PARTY_NOTICES.md before reuse or redistribution.
For questions about this release, please open a GitHub issue.