Official PyTorch implementation for the paper:
Scale-Arbitrary Invertible Image Downscaling
IEEE Transactions on Image Processing (TIP) 2023
Jinbo Xing*, Wenbo Hu*, Menghan Xia, Tien-Tsin Wong (*joint first authors)
We present a scale-arbitrary invertible image downscaling network (AIDN) to natively downscale HR images with arbitrary scale factors. Meanwhile, the HR images could be restored with AIDN whenever necessary.
Usecase of our AIDN. (a) shows the conventional pipeline of distributing HR images over social media platforms. (b) shows the distribution pipeline with our proposed AIDN. H and W denote the height and width of images; s1, ..., sn are scale factors; and N stands for the upper-limit resolution of various social media platforms. AIDN allows users to bypass the resolution upper-limit of social media platforms by preventing from auto-downscaling, thus receivers can obtain HR images with more details.
Changelog
- 2023.09.07 Fix a bug which potentially caused inconsistent quantitative results between the released code and the paper
- 2023.07.30 Release an interactive inspection demo.
- 2023.07.17 Release code and model weights!
Environment
conda create -n AIDN python=3.6.2
conda activate AIDN
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=10.0 -c pytorch
pip install -r requirements.txt
Dataset Preparation
The training and testing datasets can be downloaded here.
For training, download & unzip DIV2K dataset, and put DIV2K_train_HR/ and DIV2K_valid_HR/ into Data/. Fill the path in dataset/prepare_div2k.py and execute this script to split the images into patches.
The processed datasets should be as below:
Data/
└── DIV2K/
├── DIV2K_valid_HR
├── DIV2K_train_HR_patch/
├── DIV2K_valid_HR_patch/
├── 0801_001.png
├── ...
└── 0900_021.png
└── list/
├── train.txt
├── val.txt
└── test.txt
We crop the images in testing datasets to make sure their height and width are divisible by 12. The datasets should be as below:
Data/
├── Set5/
└──GTmod12/
├── xxx.png
├── ...
└── xxx.png
├── Set14/
├── urban100/
├── BSDS100/
├── DIV2K/
└── list/
├── DIV2K_val.txt
├── ...
├── BSDS100_val.txt
└── DIV2K_val.txt
where *.txt are data lists, whose rows will be <dataset_name>/GTmod12/<img_filename>, e.g. in BSDS100_val.txt:
BSDS100/GTmod12/101085.png
...
BSDS100/GTmod12/97033.png
Train
sh scripts/train.sh <exp_name> <config_path>
e.g.: sh scripts/train.sh AIDN_exp01 config/DIV2K/AIDN.yaml
Note that, we firstly train the model with a fixed

