KonfAI#

Scale · reproduce · ship and automate

From medical-image storage to a reusable application.

KonfAI is a declarative medical-imaging execution engine. It connects regional data access, patch execution, inspectable PyTorch graphs, training, prediction, evaluation, and medical-image outputs through one reproducible workflow — then packages it for people, services, or agents.

pip install "konfai[imaging]" Apache-2.0 Python 3.10+
Config.yml
Trainer:
  train_name: SEG_BASELINE
  Model:
    classpath: UNet.yml   # routed graph
  Dataset:
    dataset_filenames: [ ./Dataset:mha ]
    groups_src: { CT: {...}, SEG: {...} }
  epochs: 100
reflection builds the object graph
terminal
$ konfai TRAIN      -y --gpu 0 --config Config.yml
$ konfai PREDICTION --config Prediction.yml --models …/best.pt
$ konfai EVALUATION --config Evaluation.yml
Whole-body CT segmentation overlay Whole-body segmentationCT structures, from a packaged model MR-to-synthetic-CT result MR → synthetic CTcontinuous Hounsfield output Streaming patches from an OME-Zarr store Scale from storage, not RAMstream patches from OME-Zarr

The 20-second mental model

One config, built once, run three ways.

Three YAML files, one root key each, three commands. Each command reads its file, builds the object graph by reflection, and writes its outputs. That's the whole mapping to remember:

Your YAML · root key One command Writes to the workspace
Config.ymlTrainer:
$ konfai TRAIN
Checkpoints/<train_name>/ · Statistics/<train_name>/
Prediction.ymlPredictor:
$ konfai PREDICTION
Predictions/<train_name>/
Evaluation.ymlEvaluator:
$ konfai EVALUATION
Evaluations/<train_name>/Metric_TRAIN.json
Same engine underneath: reflection reads the root key and builds Model · Dataset · Losses · Optimizer. Every output folder is keyed by train_name — keep it consistent across the three files.
Reflection

Config by reflection

A callable's signature is read and its arguments are built from the YAML it owns — recursively. Reading a config resolves and rewrites it, so a run leaves a complete record.

Imaging

Lazy, patch-based

Compatible chains stream only the source region required by each patch; other chains use a bounded case buffer. Predictions are reassembled with overlap blending.

Models

Declarative graphs

Networks are routed add_module graphs — a Python class, or an entire model written as a .yml. Named outputs are addressable from YAML.

Where to go next

Pick the path that matches your goal.

Or browse the full documentation

Every page stays one click away — this landing is a map, not a wall.
Top-ranking at recent MICCAI challenges
SynthRAD TrackRAD CURVAS PANTHER
segmentation · registration · synthesis