This repository packages the publisher-provided UltraBones100k
epoch_100.pth model as a mask-only provider for UniEM. It accepts one cropped
uint8 BGR ultrasound frame and returns a same-size binary uint8 bone-surface
mask. UniEM remains responsible for tracker pairing, calibration, 3D point
projection, retention, rendering, and session logging.
Research software only. This model was trained on ex-vivo lower-limb data and has not been validated as a medical device or as the sole basis for a clinical decision.
The pinned checkpoint is:
UltraBones100k/AI_ultrasound_segmentation/models/
train_on_1_3_4_5_6_9_10_11_12_13_14/epoch_100.pth
It contains a full PyTorch segmentation_models_pytorch.FPN object with a
ResNet-34 encoder, one grayscale input channel, and one output class. The
publisher saved it with torch.save(model), so loading the original file uses
Python pickle. Only use the checkpoint pinned by models/release-manifest.json
and verified by SHA-256. Do not load an untrusted replacement.
Use the same Python 3.10 environment that runs UniEM. The UniEM 4080 environment already has a compatible PyTorch 2.4 runtime.
python -m pip install -r requirements.txtDownload and verify the publisher checkpoint:
.\scripts\download_model.ps1If you downloaded epoch_100.pth manually, place it at
models/epoch_100.pth and verify it without loading torch:
.\scripts\download_model.ps1 -VerifyOnly
# or
python scripts\verify_checkpoint.pyExpected asset identity:
size: 92782783 bytes
sha256: a0e82a14605e6100b344baf4841ef011680ceb2218ebe1f017f55b299027be12
Run one image or every supported image in a directory:
python scripts\validate_images.py path\to\image.png
python scripts\validate_images.py path\to\images --output outputs\validationThe command writes source-size binary masks, green overlays, per-image timing,
and report.json. Warmup occurs before timing the requested images.
The runtime reproduces the publisher preprocessing:
- convert the source frame to grayscale;
- resize to 256 x 256 with bilinear interpolation and antialiasing;
- scale pixels to
[0, 1]; - normalize with mean
0.17475835978984833and standard deviation0.16475939750671387; - run the resident FPN and apply sigmoid plus a strict
> 0.5threshold; - restore the binary label map to the source size with nearest-neighbour interpolation.
Nearest-neighbour restoration intentionally differs from the publisher's visualization script, which uses OpenCV's default interpolation when writing a display PNG. A UniEM provider must return discrete label values, not interpolated grayscale values.
The evaluator understands the publisher dataset layout and defaults to the publisher's held-out specimens 2, 7, and 8:
python scripts\evaluate_dataset.py D:\data\UltraBones100kFor a small smoke evaluation:
python scripts\evaluate_dataset.py D:\data\UltraBones100k --specimens 2 --limit 100It reads UltrasoundImages, visible-surface Labels, and space_factor from
tracking.csv, then writes per-frame CSV and summary JSON containing Dice,
precision, recall, average symmetric surface distance, and 95th-percentile
surface distance. Distances are reported in millimetres when a valid
space_factor is available and pixels otherwise.
UniEM discovers one manifest per immediate child of
%LOCALAPPDATA%\UniEM\extensions. During development, create a directory
junction so the checkout remains the source of truth:
$extensionRoot = Join-Path $env:LOCALAPPDATA "UniEM\extensions"
New-Item -ItemType Directory -Force -Path $extensionRoot | Out-Null
New-Item -ItemType Junction `
-Path (Join-Path $extensionRoot "bone-surface-segmentation") `
-Target (Get-Location)Restart UniEM or press the reconstruction model refresh button, then select Bone Surface Segmentation (UltraBones100k).
This provider declares the open_surface_point_cloud reconstruction profile.
Compatible UniEM hosts preserve the full binary mask for 2D display, then
skeletonize every detected component and project the skeleton pixels into the
tracked 3D point cloud. They do not use closed Delaunay meshing or report a
bone volume. This follows the UltraBones100k reference point-cloud workflow
while retaining UniEM's real-time pose pairing and bounded point retention.
Older UniEM hosts that do not recognize the profile fall back to their closed-region mesh path; do not interpret that output as a geometric bone surface. A final open-surface mesh remains a separate, offline refinement task.
Fast tests do not import torch or load the real checkpoint:
python -m pip install -r requirements-ci.txt
python -m pytest
python -m ruff check .
python -m ruff format --check .See docs/ARCHITECTURE.md, docs/MODEL_CARD.md, and docs/VALIDATION.md for
the responsibility boundary, model provenance, and evaluation guidance.