Pure Pass

October 11, 2025 · View on GitHub

This repository is an official implementation of the paper "Pure-Pass: Fine-Grained, Adaptive Masking for Dynamic Token-Mixing Routing in Lightweight Image Super-Resolution".

[ArXiv] https://arxiv.org/pdf/2510.01997

Environment

  • Python 3.9
  • PyTorch 2.0.1

Installation

conda create -n ATD python=3.9
conda activate ATD

pip install -r requirements.txt
python setup.py develop

Training

Data Preparation

  • Download the training dataset DF2K and put them in the folder ./datasets.

Training Commands

  • Refer to the training configuration files in ./options/train folder for detailed settings.

  • ATD-light

# batch size = 2 (GPUs) × 16 (per GPU)
# training dataset: DIV2K

# ×2 scratch, input size = 64×64, 500k iterations
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --use-env --nproc_per_node=2 --master_port=1145  basicsr/train.py -opt options/train/201_PP_ATD_light_SRx2_scratch.yml --launcher pytorch

# ×3 finetune, input size = 64×64, 250k iterations
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --use-env --nproc_per_node=2 --master_port=1145  basicsr/train.py -opt options/train/202_PP_ATD_light_SRx3_finetune.yml --launcher pytorch

# ×4 finetune, input size = 64×64, 250k iterations
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --use-env --nproc_per_node=2 --master_port=1145  basicsr/train.py -opt options/train/203_PP_ATD_light_SRx4_finetune.yml --launcher pytorch
  • CAMixer-ATD-light-5
# batch size = 2 (GPUs) × 16 (per GPU)
# training dataset: DIV2K

# ×2 scratch, input size = 64×64, 500k iterations
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --use-env --nproc_per_node=2 --master_port=1145  basicsr/train.py -opt options/train/301_CAMixer_ATD_light_5_SRx2_scratch.yml --launcher pytorch

# ×3 finetune, input size = 64×64, 250k iterations
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --use-env --nproc_per_node=2 --master_port=1145  basicsr/train.py -opt options/train/302_CAMixer_ATD_light_5_SRx3_finetune.yml --launcher pytorch

# ×4 finetune, input size = 64×64, 250k iterations
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --use-env --nproc_per_node=2 --master_port=1145  basicsr/train.py -opt options/train/303_CAMixer_ATD_light_5_SRx4_finetune.yml --launcher pytorch
  • CAMixer-ATD-light-8
# batch size = 2 (GPUs) × 16 (per GPU)
# training dataset: DIV2K

# ×2 scratch, input size = 64×64, 500k iterations
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --use-env --nproc_per_node=2 --master_port=1145  basicsr/train.py -opt options/train/401_CAMixer_ATD_light_8_SRx2_scratch.yml --launcher pytorch

# ×3 finetune, input size = 64×64, 250k iterations
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --use-env --nproc_per_node=2 --master_port=1145  basicsr/train.py -opt options/train/402_CAMixer_ATD_light_8_SRx3_finetune.yml --launcher pytorch

# ×4 finetune, input size = 64×64, 250k iterations
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --use-env --nproc_per_node=2 --master_port=1145  basicsr/train.py -opt options/train/403_CAMixer_ATD_light_8_SRx4_finetune.yml --launcher pytorch

Testing

Data Preparation

  • Download the testing data (Set5 + Set14 + BSD100 + Urban100 + Manga109) and put them in the folder ./datasets.

Testing Commands

  • Refer to the testing configuration files in ./options/test folder for detailed settings.
  • PP-ATD-light
python basicsr/test.py -opt options/test/201_PP_ATD_light_SRx2_scratch.yml
python basicsr/test.py -opt options/test/202_PP_ATD_light_SRx3_finetune.yml
python basicsr/test.py -opt options/test/203_PP_ATD_light_SRx4_finetune.yml
  • CAMixer-ATD-light-5
python basicsr/test.py -opt options/test/301_CAMixer_ATD_light_5_SRx2_scratch.yml
python basicsr/test.py -opt options/test/302_CAMixer_ATD_light_5_SRx3_finetune.yml
python basicsr/test.py -opt options/test/303_CAMixer_ATD_light_5_SRx4_finetune.yml
  • CAMixer-ATD-light-8
python basicsr/test.py -opt options/test/401_CAMixer_ATD_light_8_SRx2_scratch.yml
python basicsr/test.py -opt options/test/402_CAMixer_ATD_light_8_SRx3_finetune.yml
python basicsr/test.py -opt options/test/403_CAMixer_ATD_light_8_SRx4_finetune.yml

Citation

@misc{wu2025purepassfinegrainedadaptivemasking,
      title={Pure-Pass: Fine-Grained, Adaptive Masking for Dynamic Token-Mixing Routing in Lightweight Image Super-Resolution}, 
      author={Junyu Wu and Jie Tang and Jie Liu and Gangshan Wu},
      year={2025},
      eprint={2510.01997},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2510.01997}, 
}

Acknowledgements

This code is built on BasicSR.