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.
Trainer: train_name: SEG_BASELINE Model: classpath: UNet.yml # routed graph Dataset: dataset_filenames: [ ./Dataset:mha ] groups_src: { CT: {...}, SEG: {...} } epochs: 100
$ konfai TRAIN -y --gpu 0 --config Config.yml $ konfai PREDICTION --config Prediction.yml --models …/best.pt $ konfai EVALUATION --config Evaluation.yml
Whole-body segmentationCT structures, from a packaged model
MR → synthetic CTcontinuous Hounsfield output
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:
Model · Dataset · Losses · Optimizer.
Every output folder is keyed by train_name — keep it consistent
across the three files.
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.
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.
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.
Your first run
Install, download the demo dataset, then train, predict and evaluate the shipped segmentation baseline — step by step.
Quickstart → UnderstandThe config model
How YAML becomes Python objects, classpaths, named module outputs, and the rewrite-on-read behaviour.
Core concepts → ScaleProcess large images
Choose cache, bounded buffering, or direct regional reads and understand exactly when streaming falls back.
Large-image guide → ReuseBring PyTorch or MONAI
Adopt gradually, reuse existing components and weights, and choose fairly between KonfAI and neighbouring tools.
Adoption guide → ShipAs an app
Package a stable workflow behind konfai-apps — local, HuggingFace,
or an HTTP server.
Drive it with an agent
An MCP server lets an LLM inspect data, write & validate configs, run train/predict/evaluate — and use, fine-tune, or package apps.
Agents & MCP →