Downloads · 30 days
17
10% of all-time downloads
chrisvoncsefalvay/sonichu
sonichu is a keypoint detection model from chrisvoncsefalvay. Use it for the keypoint detection task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as apache-2.0.
SONICHU-124M (Single One-shot Neural Inference of Coordinates in Human Ultrasound) is a foundation model for 9-task B-mode ultrasound biometry. Achieves 7.30 px weighted mean radial error on the FMUIA tasks — in a sin…
Downloads · 30 days
17
10% of all-time downloads
All-time downloads
164
Public
Parameters
124M
495 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors495 MB · 100%
From the Hugging Face model README
SONICHU-124M (Single One-shot Neural Inference of Coordinates in Human Ultrasound) is a foundation model for 9-task B-mode ultrasound biometry. Achieves 7.30 px weighted mean radial error on the FM_UIA tasks — in a single forward pass (2 passes with TTA). And it's tiny!
Given a 2D B-mode ultrasound image, SONICHU predicts anatomical keypoints for nine biometric measurements. Users specify which task they want at inference time, and the model returns normalised xy coordinates in [0, 1] which can be scaled back to pixel coordinates.
| task | keypoints | anatomy | fair MRE (px, TTA) |
|---|---|---|---|
| AOP | 4 | angle of progression (intrapartum) | 4.8 |
| FUGC | 2 | foetal umbilical cord | 3.9 |
| FA | 4 | foetal abdomen biometry | 7.6 |
| HC | 4 | foetal head circumference | 8.0 |
| IVC | 2 | inferior vena cava | 29.0 |
| PLAX | 22 | cardiac parasternal long-axis | 15.7 |
| PSAX | 4 | cardiac parasternal short-axis | 22.8 |
| A4C | 16 | apical four-chamber view | 63.7 |
| fetal_femur | 2 | foetal femur length | 7.1 |
Cardiac tasks (PLAX, PSAX, A4C, IVC) and fetal_femur have limited real-labelled training data (under 100 samples for the first three); treat those numbers as indicative rather than clinical-grade. The FUGC result (3.9 px) is the best across all models we evaluated.
<img src='demo_prediction.png' width='700'>Not for clinical use. This model has not been clinically validated. It must not be used for patient diagnosis or treatment decisions.
import cv2
import torch
import numpy as np
from modeling_sonichu import SonichuModel, SonichuPreprocessor
model = SonichuModel.from_pretrained(".")
prep = SonichuPreprocessor.from_pretrained(".")
device = "cuda" if torch.cuda.is_available() else "cpu"
model = model.to(device)
img_bgr = cv2.imread("my_ultrasound.png")
img_rgb = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB)
inputs = prep(img_rgb)
kps_norm = model.predict(inputs["pixel_values"].to(device),
task="fetal_femur", tta=True)
# kps_norm: (1, n_kp, 2) in [0, 1]
kps_pixel = kps_norm[0].cpu().numpy() * np.array([inputs["orig_w"], inputs["orig_h"]])
print(kps_pixel)
A complete inference script with overlay rendering is provided in inference.py:
python inference.py my_ultrasound.png fetal_femur
| component | spec |
|---|---|
| backbone | ViT-B/16, 86M params, 768-dim, 12 layers, 12 heads |
| head | ViTPose: 16×16 patch tokens → 2 deconv layers × 256 filters → soft-argmax per keypoint |
| input | 256×256 RGB, ImageNet normalisation, replicate single-channel inputs |
| output | Normalised xy coordinates in [0, 1] per keypoint |
| total params | 128M |
| weights | model.safetensors (511 MB, fp32) |
The ViT-B/16 backbone was pretrained using the I-JEPA objective on 160,486 unlabelled ultrasound frames (A4C, HC, FA, AOP views). Representation-space prediction is more robust to speckle noise than pixel-space methods such as MAE, as US-JEPA demonstrates.
Five ViTPose models were trained separately from the IJEPA backbone, each with a different pseudo-label regime (R1, R2, R3, Selective/FUGC-capped, r3capped/balanced). The ensemble of their coordinate-wise medians achieved 6.30 px weighted MRE on fair validation.
This published model is the distilled student:
loss_real + 0.5 * loss_teacherWhy distillation? A single model is 5× cheaper to run than the ensemble at inference time. Naive weight averaging (model soup) was destructive at 87 px — the teachers had diverged too far during supervised training with different pseudo-label distributions. Distillation was required.
Fair validation = original labelled samples only (no pseudo-labels), 15% random split with seed 42.
| model | weighted MRE | unweighted mean | inference cost |
|---|---|---|---|
| Competition baseline (EfficientNet-B4 + FPN) | 67.43 | — | 1 forward pass |
| Sonichu distilled (this model) | 7.30 | 18.07 | 2 passes (with TTA) |
| Best single teacher (R3) | 7.63 | 19.54 | 2 passes |
| 4-model median ensemble | 6.81 | 17.29 | 8 passes |
| 5-model median ensemble | 6.30 | 16.40 | 10 passes |
The distilled model trades approximately 1 px of weighted MRE for a 5× inference speedup versus the full ensemble, making it the practical choice for deployment.
Note that the weighted MRE is dominated by AOP (60.7% of fair val samples), so for applications where per-task balance matters, the unweighted mean is more informative.
If you use this model, please cite:
@misc{sonichu-2026,
title = {Sonichu: a distilled IJEPA-based model for multi-task ultrasound biometry},
author = {von Csefalvay, Chris},
year = {2026},
note = {ISBI 2026 FM\_UIA challenge submission}
}
Key underlying references:
| file | description |
|---|---|
README.md | this model card |
config.json | model hyperparameters and task metadata |
preprocessor_config.json | image preprocessing parameters |
model.safetensors | model weights (128M params, 511 MB) |
modeling_sonichu.py | self-contained PyTorch model class and preprocessor |
inference.py | end-to-end inference example with overlay rendering |
Apache 2.0. See LICENSE in the repository.
Training used the FM_UIA 2026 challenge dataset (competition terms of use) and the Multi-centre Fetal Biometry Benchmark Dataset (DOI 10.5522/04/30819911, CC BY-NC-SA 4.0). Downstream users should respect those licenses.