This repository contains the official PyTorch implementation of:
A3-TTA: Adaptive Anchor Alignment Test-Time Adaptation for Image Segmentation
📘 IEEE Transactions on Image Processing (TIP), 2025
🔗 https://ieeexplore.ieee.org/document/11311445
A3-TTA is a source-free test-time adaptation (TTA) framework for robust image segmentation under domain shift.
It adapts a pretrained segmentation model online at test time, using only unlabeled target-domain data, without access to source images or retraining.
Unlike prior pseudo-label-based TTA methods that rely on perturbation ensembles (e.g., dropout, TTA, noise), A3-TTA introduces anchor-guided alignment, constructing stable and distribution-aware pseudo supervision for reliable adaptation.
A3-TTA is:
- 🔄 Online & continual (single-pass over test data)
- ❌ Source-free
- 🧩 Model-agnostic
- 🧠 Structure-aware (boundary-sensitive dense supervision)
We recommend using a conda environment:
conda create -n a3tta python=3.9
conda activate a3tta
pip install -r requirements.txt
We adopt the M&MS dataset for cardiac MRI segmentation.
Official website: https://www.ub.edu/mnms/
-
Apply for and obtain official permission to use the dataset.
-
Download the dataset through the official portal.
-
(Optional) Use our processed M&MS 2D version:
👉 Google Drive:
https://drive.google.com/file/d/1jaT2nsbF1-rPoWs6fnF9DsFxTuaYXqW2/view?usp=sharing -
Extract the processed data into: A3-TTA/data/mms2d/
-
Apply for and obtain official permission to use the dataset.
-
Download the dataset through the official portal.
-
(Optional) Use our processed Prostate data:
👉 Google Drive:
https://drive.google.com/file/d/1MdDJqxqiZ_0vYdPmcZMvVr-jcz8dxaYk/view?usp=drive_link -
Extract the processed data into: A3-TTA/data/prostate2d/
To train a UNet segmentation model on the source domain:
python train_source_2d.py --cfg cfgs/prostate/source.yaml
- Checkpoints are saved to:
save_model/
We provide evaluation scripts for A3-TTA and other methods. All experiments are configured via YAML files.
# A3-TTA (our method)
python test-time-adaptation.py --cfg cfgs/prostate/a3-tta_prostate.yaml
If you find A3-TTA useful, please consider citing:
@article{wu2025a3tta,
author={Wu, Jianghao and Luo, Xiangde and Zhou, Yubo and Wu, Lianming and Wang, Guotai and Zhang, Shaoting},
journal={IEEE Transactions on Image Processing},
title={A3-TTA: Adaptive Anchor Alignment Test-Time Adaptation for Image Segmentation},
year={2025},
volume={34},
pages={8511--8522},
doi={10.1109/TIP.2025.3644789}
}
This repo builds upon ideas from:
- TENT
- and others, re-implemented for medical segmentation tasks.
If you have questions, feel free to open an issue or reach out.
Happy Adapting! 🎯