Skip to content

LuizScarlet/FSDALIC

Repository files navigation

Few-Shot Domain Adaptation for Learned Image Compression

Tianyu Zhang, Haotian Zhang, Yuqi Li, Li Li, Dong Liu

arXivPaper

Abstract

Learned image compression (LIC) has achieved state-of-the-art rate-distortion performance, deemed promising for next generation image compression techniques. However, pretrained LIC models usually suffer from significant performance degradation when applied to out-of-domain images. To tackle this problem, we develop a few-shot domain adaptation method for LIC by integrating plug-and-play adapters into pretrained models.


Figure 1. BD-rate (↓) of four advanced LIC models with or without our method on different domains.

Motivation

We examine domain gaps in LIC and observe that out-of-domain images disrupt pre-trained channel-wise decomposition. For in-domain images, the energy allocation on channels is more compact, with little information of the source images found in low-energy (LE) channels. However, for out-of-domain images, more contours of source images can be observed.


Figure 2. Channel-wise decomposition of pretrained LIC models on in-domain and out-of-domain images.

Method

To refine the channel-wise decomposition in the transform, we insert Conv-Adapters after non-linear blocks. For entropy estimation, LoRA-Adapters are applied to the entropy parameters network. Only adapters are trainable.


Figure 3. Deployment of our method on ELIC.

Requirements

pip install -r requirements.txt

Dataset and Pretrained Weights

Our datasets, pretrained LIC models (Cheng2020, ELIC, MLIC++) and adapters (using 20 training samples) are available at google drive.

Inference

To perform a quick glance at the adaptation performance, please modify inference.sh:

python3 -W ignore inference.py \
    --test_dataset <YOUR PATH>/datasets/Pixel/test/ \
    --lmbda 0.0018 \
    --model_name ELIC \
    --pretrained_weight <YOUR PATH>/ELIC/pretrained/ELIC_00018.pth \
    --adapters_weight <YOUR PATH>/ELIC/adapters/ELIC_00018_Pixel.pth

To conduct practical entropy coding with bitstreams, please modify compress.sh. Note that Cheng2020 can be very slow due to its spatial autoregression:

python3 -W ignore compress.py \
    --test_dataset <YOUR PATH>/datasets/Pixel/test/ \
    --lmbda 0.0018 \
    --model_name ELIC \
    --pretrained_weight <YOUR PATH>/ELIC/pretrained/ELIC_00018.pth \
    --adapters_weight <YOUR PATH>/ELIC/adapters/ELIC_00018_Pixel.pth \
    --save_dir <YOUR PATH>

Training

Try adapt.sh and train your own adapters on more domains!

python3 -W ignore adapt.py \
    --train_dataset <YOUR PATH>/datasets/Pixel/train/ \
    --test_dataset <YOUR PATH>/datasets/Pixel/test/ \
    --lmbda 0.0018 \
    --model_name ELIC \
    --pretrained_weight <YOUR PATH>/ELIC/pretrained/ELIC_00018.pth \
    --save_dir <YOUR PATH>

Acknowledgement

This repository is based on CompressAI, ELIC-Unofficial, MLIC and DUIC.

Citation

If you find this project useful for your research, please kindly cite our paper:

@inproceedings{zhang2025few,
  title={Few-Shot Domain Adaptation for Learned Image Compression},
  author={Zhang, Tianyu and Zhang, Haotian and Li, Yuqi and Li, Li and Liu, Dong},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  volume={39},
  number={10},
  pages={10139--10147},
  year={2025}
}

About

[AAAI 2025] Few-Shot Domain Adaptation for Learned Image Compression

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published