Spatiotemporal-Enhanced SAMed for Echocardiography Video Segmentation
STE-SAMed is a SAM-based spatiotemporal segmentation method designed for echocardiographic (cardiac ultrasound) video segmentation. It introduces a Deformable Spatiotemporal Feature Separator (DSFS) and a Spatiotemporal Interaction and Fusion Module (STIFM) on top of the Segment Anything Model (SAM) to jointly handle speckle noise, apical signal dropout, and cardiac motion across frames.
Please make sure the following dependencies are installed before running the code:
pip install -r requirements.txtDownload the pretrained SAM ViT-B checkpoint used to initialize STE-SAMed:
wget https://huggingface.co/Wky1218/STE-SAMed/resolve/main/sam_vit_b_01ec64.pth -P checkpoints/Or download it manually from the Hugging Face repository and place it under a checkpoints/ directory in the project root.
This project uses two public echocardiography datasets:
- CAMUS: available at https://www.creatis.insa-lyon.fr/Challenge/camus/
- EchoNet-Dynamic: available at https://echonet.github.io/dynamic/
Please follow each dataset's official instructions to request access and download the data.
After downloading, organize the datasets as follows:
datasets
├── CAMUS
│ ├── train
│ ├── test
│ └── val
└── EchoNet_Dynamic
├── train
├── test
└── val
- Training data should be in
.npzformat. - Testing data should be in
.h5format.
If your test data is not already in .h5 format, run the conversion script first:
python test_h5.pyThis will convert the raw test data into the .h5 format required by test.py.
Once the checkpoint and datasets are in place, start training with:
python train.pyAfter converting the test data to .h5 format (see Data Format), run:
python test.py