Instructions to use AlfredQin/sonobase with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use AlfredQin/sonobase with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained(AlfredQin/sonobase) with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): predictor.set_image(<your_image>) masks, _, _ = predictor.predict(<input_prompts>)# Use SAM2 with videos import torch from sam2.sam2_video_predictor import SAM2VideoPredictor predictor = SAM2VideoPredictor.from_pretrained(AlfredQin/sonobase) with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): state = predictor.init_state(<your_video>) # add new prompts and instantly get the output on the same frame frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>): # propagate the prompts to get masklets throughout the video for frame_idx, object_ids, masks in predictor.propagate_in_video(state): ... - Notebooks
- Google Colab
- Kaggle
SonoBase
Paper: arXiv:2609.19230 · Code: github.com/AlfredQin/sonobase · Data manifest: 10.5281/zenodo.22770825 · Demo: Hugging Face Space · Website: alfredqin.github.io/sonobase-web
SonoBase is an interactive ultrasound segmentation foundation model. It adapts SAM2 with an image-pyramid hybrid encoder (a Hiera-B transformer branch at 256 px and two ConvNeXt branches at 512 / 1024 px, joined by cross-branch attention) and is pretrained on SonoCorpus, a corpus of 53 public ultrasound datasets (456,963 images/frames, 1,626,085 masks, 24 clinical applications).
Files
| File | What it is |
|---|---|
sonobase_hiera_b_conv_s_conv_t.pt |
Model weights (state dict under model, plus _provenance), 706 MB. Load with the sonobase recipe in the code release. |
checkpoint_dcp/epoch_19_step_27539/ |
Full PyTorch distributed checkpoint of the production run: model/, optim/ (AdamW optimizer states), rng/, scaler.pt, step_scheduler.pt, config.yaml, losses.json. Resume or fine-tune from here. |
config.yaml |
Resolved training configuration of the production run. |
training.jsonl, validation.jsonl |
Per-step training log and per-epoch validation log. |
Production run: hiera_b_conv_s_conv_t, 20 epochs on the 38 pretraining + 8 benchmark-train
datasets of SonoCorpus with the leak-free 38_pt_8_bm_7_ext_v2 splits, global batch 16, cosine LR
5e-5 to 5e-6 (3e-5 to 3e-6 for the encoder), AdamW, weight decay 0.1, layer decay 0.9, resolution
1024, bf16, 2 nodes x 8 H200. Checkpoint epoch_19_step_27539 is both the last and the
lowest-validation-loss epoch (val mIoU 0.8385).
Usage
See https://github.com/AlfredQin/sonobase (Phase 3/4 scripts: src/scripts/pretrain/,
src/scripts/benchmarks/). The .pt file is the DCP checkpoint converted with the repository's
DCP-to-PT utility; the benchmark, few-shot and analysis recipes consume it directly.
Interactive demo
Point and box prompts on images, and prompt-once propagation on short clips, with this checkpoint: https://huggingface.co/spaces/AlfredQin/sonobase-demo (research use only, not a medical device).
Data
The SonoCorpus manifest (dataset sources and licences, split lists, per-file checksums, per-unit metadata and evaluation records) is published on Zenodo: https://doi.org/10.5281/zenodo.22770825 (CC BY 4.0). No images or masks are re-hosted; datasets are obtained from their sources under their own terms. Several constituent datasets are non-commercial, which constrains downstream use of these weights accordingly.
Citation
@article{sonobase2026,
title = {Open ultrasound foundation model for robust segmentation and clinical measurement across heterogeneous settings},
author = {Qin, Chao and Khan, Fahad Shahbaz and Khan, Salman and Ather, Sarim and
Anwar, Siddiq and Anwer, Rao Muhammad and Khan, Shadab},
journal = {arXiv preprint arXiv:2609.19230},
year = {2026},
eprint = {2609.19230},
archivePrefix = {arXiv},
primaryClass = {cs.CV},
doi = {10.48550/arXiv.2609.19230}
}
Please also cite the original publication of every constituent dataset you use.
Licence
The SonoBase model weights and optimizer states in this repository are released under the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) licence: several constituent datasets of SonoCorpus are non-commercial, so the weights are non-commercial too. The code is MIT-licensed (https://github.com/AlfredQin/sonobase) and the SonoCorpus manifest is CC BY 4.0 (Zenodo). SonoBase is a research tool and not a medical device.
- Downloads last month
- 491