Guides

Inference

Public package status: the Python distributions and desktop installers are not released yet. These pages document an evolving interface, not currently usable install artifacts. View release status.

MedOtter ships a curated zoo of segmentation models. load_model returns a Predictor — an object with a single predict(image, spacing=None) method that returns an integer label map matching the image’s spatial shape.

Listing what’s available

import medotter as mo

mo.list_models()          # registered model names you can pass to load_model
mo.list_architectures()   # architecture names valid for load_model(..., arch=)

Loading a model

load_model(source, **kwargs) accepts either a registered name (from list_models()) or a checkpoint path ending in .pth, .pt, or .ckpt:

model = mo.load_model("sam2_hiera_small")          # a registered model
model = mo.load_model("runs/best.pth", arch="CMUNeXt", num_classes=4)

sam2_hiera_small is one of the registered SAM2 baselines listed by list_models(); "CMUNeXt" is a real architecture name from list_architectures() (backed by models_train/model_id.json) — passing an unregistered arch= raises ValueError before any weights are touched.

Running a prediction

sample = mo.load_dataset("ACDC", split="test")[0]
labels = model.predict(sample.image)   # integer label map, same spatial shape

Note: import medotter is dependency-light (only numpy). Torch is imported the first time you call load_model. A missing torch install surfaces as a clear ImportError at that call, not at import.

Common errors