Official implementation of Anatomy-Guided Spatiotemporal Affinity Learning for Unsupervised Domain Adaptation in Echocardiography Segmentation.
The paper is published in IEEE Journal of Biomedical and Health Informatics.
- IEEE Xplore: https://ieeexplore.ieee.org/document/11531132
- DOI: https://doi.org/10.1109/JBHI.2026.3694986
.
|-- train.py # Training entry point
|-- context_cluster.py # Anatomical context mapping strategy determination
|-- infer_geometrics.py # Inference for geometric metrics
|-- infer_clinical_metrics.py # Inference for clinical metrics
|-- geom_stats_wilcoxon.py # Statistical significance analysis for geometric metrics
|-- clinical_stats_bootstrap_ci.py # Statistical significance analysis for clinical metrics
|-- geom_aggregate_metrics.py # Aggregation of geometric metrics from multiple runs
|-- clinical_aggregate_metrics.py # Aggregation of clinical metrics from multiple runs
|-- config/
| |-- STAffEcho/ # STAffEcho experiment settings
| | |-- cm2cd.json # CAMUS -> CardiacUDA
| | |-- cd2cm.json # CardiacUDA -> CAMUS
| | `-- cd2echo.json # CardiacUDA -> EchoNet-Dynamic
| |-- UpperBound/ # Supervised upper-bound settings
| `-- woDA/ # Source-only settings without domain adaptation
|-- datasets/ # Dataset loaders
|-- models/ # Network and affinity modules
|-- utils/ # Losses, schedulers, logging, and helpers
`-- requirements.txt
Create a Python environment and install the dependencies:
conda create -n STAffEcho python=3.8
conda activate STAffEcho
pip install -r requirements.txtThe listed PyTorch package targets CUDA 11.8. If your CUDA version differs, install the matching PyTorch build from the official PyTorch instructions, then install the remaining dependencies.
The code supports the following datasets:
Before running experiments, update dataset roots and output directories in the JSON files under config/.
Example:
"source": {
"dataset": "Camus",
"config": {
"root": "/path/to/CAMUS"
}
}Recommended practice is to replace all local absolute paths with your own dataset, checkpoint, log, and result directories.
Training is implemented in train.py. Experiment settings are defined by JSON files under config/.
Before running training, update the basedir variable in train.py to the configuration folder you want to use, for example:
basedir = "config/STAffEcho"Then run:
python train.pyBy default, train.py iterates over all configuration files in basedir and trains with the seeds defined in the script.
Update checkpoint, dataset, and output paths before running evaluation or analysis scripts.
python infer_geometrics.py
python infer_clinical_metrics.py
python geom_aggregate_metrics.py
python clinical_aggregate_metrics.py
python geom_stats_wilcoxon.py
python clinical_stats_bootstrap_ci.pyThis codebase was developed with reference to GraphEcho and Pixel-Embedded-Affinity.
We thank the authors for making their code and ideas publicly available.
If you find this repository useful, please cite:
@ARTICLE{11531132,
author={Fang, Xinyan and Ma, Xinghua and Liu, Yang and Zhang, Jiahao and Wang, Xiaodi and Li, Xiangyu and Kow, Alfred Wei Chieh and Luo, Gongning and Wang, Guohua},
journal={IEEE Journal of Biomedical and Health Informatics},
title={Anatomy-Guided Spatiotemporal Affinity Learning for Unsupervised Domain Adaptation in Echocardiography Segmentation},
year={2026},
volume={},
number={},
pages={1-13},
keywords={Echocardiography;Modeling;Videos;Context;Labeling;Computers;Conferences;Pixel;Training;Modules (abstract algebra);Echocardiography;Unsupervised domain adaptation;Affinity;Segmentation},
doi={10.1109/JBHI.2026.3694986}
}Please replace volume, number, and pages with the final IEEE Xplore metadata if IEEE has assigned them.