yifeipet/AFP_GIC

Pytorch implementation of the paper “Adaptive Fused Prior Transfer for Controllable Generative Image Compression”.

Python

4

5 commits

updated Oct 5, 2026

See the code

See what people are saying

SourceMessageScoreDate

AFP-GIC: Controllable Generative Image Compression [R] (r/MachineLearning)

Hi ML Community, I am excited to share our latest framework, AFP-GIC, officially published in IEEE Access (2026). We have released the deployment codebase and hosted an interactive visual playground. * GitHub Repository: [https://github.com/yifeipet/AFP\_GIC](https://github.com/yifeipet/AFP_GIC) *…

4

Oct 6, 2026

README

🚀 AFP-GIC: Controllable Generative Image Compression

IEEE Access paper arXiv and supplementary material Hugging Face live demo Download pretrained checkpoint

AFP-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.

🤗 Live Interactive Demo on Hugging Face

AFP-GIC interactive demo: original and reconstructed image comparison, bitrate controls, and downloadable results.

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.

Try the live demo →

✨ Highlights

  • Multi-rate compression without a collection of models: one checkpoint covers all five reported operating points, simplifying model management.
  • Adaptive prior guidance without prior transmission: transfer image-adaptive knowledge from frozen AdaCode to guide encoding and predict the fused prior at the decoder.
  • 18.1% lower decoder latency: 80.47 ms versus 98.27 ms for DC-VIC.
  • 20.5% fewer inference parameters: 120.6M versus 151.7M, a reduction of 31.1M parameters.
  • From paper to hands-on evaluation: custom image uploads, downloadable bitstreams, standalone decompression, and per-image benchmark CSVs make the results accessible beyond the paper.

⚡ Efficiency

MethodInference parametersEncoder latencyDecoder latency
DC-VIC151.7M61.61 ms98.27 ms
AFP-GIC120.6M81.34 ms80.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.

🧩 Architecture

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.

AFP-GIC architecture: adaptive fused-prior guidance at the encoder and prior prediction at the decoder.

Figure 1. Overview of AFP-GIC. Blue and red indicate encoding and decoding, respectively; snowflakes and flames denote frozen and trainable modules.

🖼️ Visual Comparisons

Original images and low-bitrate reconstructions from VVC Intra, MS-ILLM, CRDR, DC-VIC, and AFP-GIC on Kodak, including enlarged details.

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.

📊 Paper Metrics

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.

📥 Reconstructed Images and Metrics

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.

🛠️ Installation

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.

📦 Pretrained Model

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.

🧪 Evaluation

📷 Kodak

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 index01234
Nominal target bpp0.0500.0750.1000.1250.150

Actual bitrates vary with image content. All five indices use the same checkpoint.

🗂️ Other Datasets

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

📁 Outputs

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.

📝 Citation

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}
}

🤝 Acknowledgments and License

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.

compressai
computer-vision
deep-learning
edge-ai
generative-compression
gradio
huggingface-spaces
image-compression
learned-image-compression
neural-codecs
pytorch
variable-rate
video-compression

yifeipet/AFP_GIC

Pytorch implementation of the paper “Adaptive Fused Prior Transfer for Controllable Generative Image Compression”.

Python

4

5 commits

updated Oct 5, 2026

See the code

See what people are saying

SourceMessageScoreDate

AFP-GIC: Controllable Generative Image Compression [R] (r/MachineLearning)

Hi ML Community, I am excited to share our latest framework, AFP-GIC, officially published in IEEE Access (2026). We have released the deployment codebase and hosted an interactive visual playground. * GitHub Repository: [https://github.com/yifeipet/AFP\_GIC](https://github.com/yifeipet/AFP_GIC) *…

4

Oct 6, 2026

README

🚀 AFP-GIC: Controllable Generative Image Compression

IEEE Access paper arXiv and supplementary material Hugging Face live demo Download pretrained checkpoint

AFP-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.

🤗 Live Interactive Demo on Hugging Face

AFP-GIC interactive demo: original and reconstructed image comparison, bitrate controls, and downloadable results.

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.

Try the live demo →

✨ Highlights

  • Multi-rate compression without a collection of models: one checkpoint covers all five reported operating points, simplifying model management.
  • Adaptive prior guidance without prior transmission: transfer image-adaptive knowledge from frozen AdaCode to guide encoding and predict the fused prior at the decoder.
  • 18.1% lower decoder latency: 80.47 ms versus 98.27 ms for DC-VIC.
  • 20.5% fewer inference parameters: 120.6M versus 151.7M, a reduction of 31.1M parameters.
  • From paper to hands-on evaluation: custom image uploads, downloadable bitstreams, standalone decompression, and per-image benchmark CSVs make the results accessible beyond the paper.

⚡ Efficiency

MethodInference parametersEncoder latencyDecoder latency
DC-VIC151.7M61.61 ms98.27 ms
AFP-GIC120.6M81.34 ms80.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.

🧩 Architecture

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.

AFP-GIC architecture: adaptive fused-prior guidance at the encoder and prior prediction at the decoder.

Figure 1. Overview of AFP-GIC. Blue and red indicate encoding and decoding, respectively; snowflakes and flames denote frozen and trainable modules.

🖼️ Visual Comparisons

Original images and low-bitrate reconstructions from VVC Intra, MS-ILLM, CRDR, DC-VIC, and AFP-GIC on Kodak, including enlarged details.

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.

📊 Paper Metrics

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.

📥 Reconstructed Images and Metrics

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.

🛠️ Installation

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.

📦 Pretrained Model

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.

🧪 Evaluation

📷 Kodak

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 index01234
Nominal target bpp0.0500.0750.1000.1250.150

Actual bitrates vary with image content. All five indices use the same checkpoint.

🗂️ Other Datasets

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

📁 Outputs

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.

📝 Citation

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}
}

🤝 Acknowledgments and License

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.

compressai
computer-vision
deep-learning
edge-ai
generative-compression
gradio
huggingface-spaces
image-compression
learned-image-compression
neural-codecs
pytorch
variable-rate
video-compression