Practical overview
When it fits
Use the repository when you need a research implementation and documented Synapse training and testing workflow, or want to examine its transformer–CNN feature-fusion design.
Who it is for
- Medical-imaging researchers studying segmentation methods.
- Developers seeking a Python and PyTorch implementation to adapt for segmentation research.
- Researchers examining transformer and CNN feature fusion.
Documented uses
- Train a HiFormer variant on the Synapse multi-organ segmentation dataset.
- Test a trained variant and save inference results.
- Study or adapt a hierarchical transformer–CNN fusion approach for medical-image segmentation.
Requirements & limits
The public GitHub repository specifies an MIT license.
- The repository’s complete preparation, training and testing instructions target the Synapse dataset.
- The documented software requirements are Python 3 and PyTorch.
- Three model choices are documented: HiFormer-S, HiFormer-B and HiFormer-L.
- The method’s distinguishing design is Double-Level Fusion of transformer and CNN feature representations.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Train HiFormer on the Synapse dataset
Prepare the Synapse data and train a selected HiFormer model variant.
Before you start
- Python 3 and PyTorch.
- The Synapse dataset, downloaded from the README-linked dataset location.
Steps
Download the Synapse dataset and prepare its training and test data paths.
Install the repository requirements with the command below.
pip install -r requirements.txtRun the command below, adjusting the paths and choosing
hiformer-s,hiformer-b, orhiformer-las needed.python train.py --root_path ./data/Synapse/train_npz --test_path ./data/Synapse/test_vol_h5 --model_name hiformer-b --batch_size 10 --eval_interval 20 --max_epochs 400
Expected outcome
The training procedure runs for the Synapse dataset with the selected model variant and configured paths and parameters.
Guide limitations
- The repository points to Instructions.ipynb for complete dataset-preparation and train/test details.
- The README lists Python 3 and PyTorch but does not specify versions.
Test a trained HiFormer model on Synapse
Run Synapse test inference using an existing trained HiFormer weights file.
Before you start
- A trained HiFormer model weights file.
- The Synapse test data at the path supplied to the test script.
- Python 3 and PyTorch.
Steps
Prepare the Synapse test data and identify the trained model weights file.
Run the command below, updating the data path, model variant, and weights path as appropriate.
python test.py --test_path ./data/Synapse/test_vol_h5 --model_name hiformer-b --is_savenii --model_weight './hiformer-b_best.pth'
Expected outcome
The test script runs inference on the Synapse test data; `--is_savenii` controls whether results are saved during inference.
Guide limitations
- The README directs users to Instructions.ipynb for complete dataset preparation and train/test details.
- The README does not describe the saved output format or provide a test script result guarantee.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 16 October 2026
- Original website title
- amirhossein-kz/HiFormer · Official homepage title · retained in its source language

