Medical-imaging workflows, executable end to end
From images on disk to reproducible experiments, production inference, and reusable clinical applications.
Quickstart · See it on real data · Large images · Bring PyTorch or MONAI · Ship an App · Automate with MCP
KonfAI is a declarative medical-imaging execution engine. It turns a reproducible research workflow into patch-native training, complete medical-image inference, and a reusable application—without giving up the PyTorch and MONAI components you already trust.
One configuration model connects storage, transforms, model graphs, losses, training, prediction, evaluation, and output geometry. The resolved YAML is the experiment record: inspectable, diffable, and runnable by a researcher or an agent.
Trainer:
Model:
classpath: UNet.yml # a model, referenced by name
Dataset:
groups_src: { CT: {...}, SEG: {...} } # channel-first, lazy, patch-based
epochs: 100
konfai TRAIN -c Config.yml --gpu 0 # then PREDICTION, then EVALUATION
KonfAI has powered top-ranking MICCAI-challenge results across segmentation, registration, and synthesis: SynthRAD2025 T1 · SynthRAD2025 T2 · CURVAS PDACVI · TrackRAD2025 · Panther · CURVAS
📄 Paper: KonfAI: A Modular and Fully Configurable Framework for Deep Learning in Medical Imaging (Boussot & Dillenseger, 2025)
🤖 Agent-operable. KonfAI ships an MCP server so an LLM agent can drive the entire experiment loop — inspect a dataset, author & validate YAML, launch train / predict / evaluate, monitor jobs, and compare runs — always grounded in the same reproducible configs a human would run. → Agents & MCP
Why KonfAI?
- Scale. Dataset patches can be read regionally from ITK, HDF5, DICOM, and OME-Zarr when preprocessing is stream-compatible; a bounded buffer preserves correctness when it is not. Prediction owns batching, TTA, ensembles, reductions, overlap reconstruction, geometry, and output writing.
- Reproduce. Training, prediction, and evaluation share named datasets and inspectable model graphs. Defaults are materialised into the YAML and configs travel with run artifacts.
- Ship and automate. Package the stable workflow as a local, Hugging Face, or remote App, use it from 3D Slicer, or let an MCP client operate the same validated builders and workspaces.
Already use another stack? Keep it. KonfAI can instantiate regular PyTorch and MONAI components, and its catalog includes documented compatibility paths for selected MONAI, nnU-Net, torchvision, and segmentation-models-pytorch models. See when to use KonfAI—or another tool.
One engine owns the complete medical workflow
| Layer | What KonfAI makes executable |
|---|---|
| Storage and data | Cases, modality groups, geometry, regional reads, transforms, cache/buffer policy, dataset patches |
| Learning | Named model graph, intermediate supervision, losses, metrics, optimizer, schedules, dataset- and model-level patching |
| Inference | Checkpoints, patch batches, TTA, ensembles, reductions, overlap blending, inverse transforms, medical-image outputs |
| Evidence | Resolved configs, checkpoints, statistics, predictions, per-case and aggregate evaluation JSON |
| Delivery | Local/Hugging Face Apps, HTTP jobs, external 3D Slicer client, uncertainty, evaluation, fine-tuning |
| Automation | Dataset inspection, config validation, smoke tests, jobs, metrics, run comparison through MCP |
That vertical integration is the product. YAML is its durable, inspectable interface—not the value proposition by itself.
Real workloads, one App contract
The same App interface already ships full segmentation, synthesis and registration systems—not reduced demonstration networks:
| App | Workload | Published RTX PRO 5000 benchmark |
|---|---|---|
| TotalSegmentator-KonfAI | CT: 117 labels / 5 models · MRI: 50 labels / 2 models | CT total: ≈42 s / ≈20 GB VRAM / ≈19 GB RAM vs ≈76 s for the original |
| MRSegmentator-KonfAI | MRI: 40 labels, 5-fold ensemble | ≈27 s / ≈22 GB VRAM / ≈2 GB RAM vs ≈35 s / ≈11 GB RAM for the original |
| ImpactSynth | four MR/CBCT→sCT variants, 2.5D UNet++, 5 models each | ≈24 s / ≈16 GB VRAM for the benchmark inference; ≈82 s full ensemble; ≈2 GB RAM |
| ImpactSeg | one model segments 11 structures from CT, MRI, or CBCT | ≈7 s / ≈10 GB VRAM / ≈1.6 GB RAM |
| IMPACT-Reg | 13 multimodal presets across elastix+IMPACT, ConvexAdam, and FireANTs | ConvexAdam_Composite: ≈5.1 s / ≈2.1 GB VRAM |
These figures retain each bundle's stated case, ensemble and hardware conditions; they are evidence of executable scale, not a cross-task leaderboard. The bundles share the same App contract across local directories, Hugging Face and HTTP, with SlicerKonfAI for general Apps and SlicerImpactReg for dedicated registration.
Consuming a published workflow does not require authoring YAML. Install its
task-specific CLI and run one command, or address the same bundle through
konfai-apps; the complete configuration remains available when you need to
inspect, evaluate, fine-tune, or automate it.
pip install impact_synth_konfai
impact-synth-konfai synthesize MR -i input_mr.nii.gz -o output/
# The same packaged workflow through the generic App runtime
konfai-apps infer VBoussot/ImpactSynth:MR -i input_mr.nii.gz -o output/
Install
pip install "konfai[imaging]" # core + all imaging backends (recommended)
pip install konfai # core only (bring your own data reader)
[imaging] pulls SimpleITK / h5py / pydicom / zarr — needed to read .mha,
.nii.gz, DICOM, and OME-Zarr. For the full extras matrix (ssim, fid,
lpips, export, cluster, …) and a reproducible Pixi setup, see the
installation guide.
Three workflows, three configs
KonfAI is command-driven; each CLI state maps to one YAML file:
| Command | Config | Does |
|---|---|---|
konfai TRAIN / RESUME |
Config.yml (Trainer:) |
fit a model |
konfai PREDICTION |
Prediction.yml (Predictor:) |
patch/TTA/ensemble inference → datasets |
konfai EVALUATION |
Evaluation.yml (Evaluator:) |
metrics on saved predictions |
Full CLI reference (flags, konfai-cluster, konfai-apps):
docs/reference/cli.
Quickstart (first smoke run)
git clone https://github.com/vboussot/KonfAI.git && cd KonfAI
pip install -e ".[imaging]"
cd examples/Segmentation
# download the small public demo dataset
pip install -U "huggingface_hub[cli]"
hf download VBoussot/konfai-demo --repo-type dataset --include "Segmentation/**" --local-dir Dataset
mv Dataset/Segmentation/* Dataset/ && rmdir Dataset/Segmentation && rm -rf Dataset/.cache
# For a short smoke run, first set `epochs: 1` in Config.yml.
konfai TRAIN -y --gpu 0 --config Config.yml # use --cpu 1 if you have no GPU
💡 After a run,
Config.ymlwill contain the resolved defaults KonfAI materialised — that's expected, and it's what makes runs reproducible.
Runtime depends on dataset size, hardware, and whether you keep the shipped 100-epoch setting. The one-epoch edit checks the complete path quickly; it is not intended to produce a useful checkpoint.
The full walkthrough (predict, evaluate, what to inspect, common first issues, notebook entry points) lives in the Quickstart.
🩻 How volumes are read
Volumes are read as patches. Whether the volume is also held in RAM depends on
use_cache and on whether your preprocessing chain can be streamed — KonfAI
derives streamability from the transforms you declared:
| Regime | When | Memory held |
|---|---|---|
| Cache | use_cache: true (training default) |
every case, resident for the whole run |
| Stream | use_cache: false, chain is streamable |
one patch |
| Buffer | use_cache: false, chain is not streamable |
a FIFO of max(batch_size + 1, shuffle_window) cases |
A chain streams when every step declares the region it needs: the exact patch
(OneHot), a halo (Dilate), a remap (Flip), a resample (ResampleToShape),
or a whole-volume statistic read once from disk (Normalize). On the stream
path, a 16 GiB uncompressed .mha trains at patch 64³ under an 8 GiB memory cap
with a peak resident set of 0.46 GiB.
→ Patch streaming — what streams, what does not, and why.
What's in the box
Everything below is referenceable by name in YAML. See the built-in component catalogue for classpaths and constructor arguments.
| Kind | Examples | Catalogue |
|---|---|---|
| Models | UNet, NestedUNet, ResNet, VAE, VoxelMorph, GAN/diffusion families |
models |
| Losses & metrics | Dice, MAE, PSNR, SSIM, LPIPS, FID, CrossEntropyLoss, TRE, IMPACTReg, IMPACTSynth |
losses-metrics |
| Transforms | Standardize, Normalize, Clip, Resample*, OneHot, Crop (~40) |
transforms |
| Augmentations | Flip, Rotate, Elastix, Noise, CutOUT (~15) |
augmentations |
| Schedulers | weight (Constant, CosineAnnealing) + LR (PolyLRScheduler, Warmup, any torch) |
schedulers |
| Storage backends | ITK, HDF5, DICOM series, OME-Zarr | storage-backends |
Not limited to these: any importable class (monai.losses:DiceLoss,
torch:nn:L1Loss, or a local Model:MyNet) works via the module:Class form.
🤖 Agent-ready by design
KonfAI is built to serve as a deterministic backend for LLM-driven experimentation. Through the KonfAI-MCP server, an agent can:
- 🔎 inspect datasets and infer their structure
- 📝 generate and validate YAML configurations
- 🚀 launch training / prediction / evaluation runs
- 📈 read live metrics, compare runs, and iterate
Every execution stays reproducible, structured, and grounded in the same YAML workflows a human would run — bridging LLM reasoning and real experimental execution. See the ecosystem map for the current status.
Ecosystem
| Package | What it is |
|---|---|
konfai |
the core framework (this repo) |
konfai-apps |
package a workflow as an app — CLI, HTTP server, Python API |
App bundles (apps/) |
ready-to-run: impact-synth, impact-seg, mrsegmentator, totalsegmentator, impact-reg |
| SlicerKonfAI | run segmentation, synthesis, evaluation, and uncertainty Apps from 3D Slicer |
| SlicerImpactReg | run IMPACT-Reg presets and inspect registration results in 3D Slicer |
| KonfAI-MCP | expose KonfAI to LLM agents — inspect data, author configs, launch and monitor runs |
See the ecosystem map for what is shipped vs. in-progress.
Documentation
📚 Full docs: https://konfai.readthedocs.io/en/latest/
- Quickstart — first end-to-end run
- Core concepts — how YAML becomes Python objects
- Large images — regional reads, fallback, and tuning
- Adopt from PyTorch/MONAI — reuse and tool choice
- Component catalogue — everything you can configure
- Examples — runnable Segmentation & Synthesis workflows
🐳 Docker: vboussot/konfai —
guide.
Development & contributing
git clone https://github.com/vboussot/KonfAI.git && cd KonfAI
pixi install
pixi run test # run the test suite
pixi run check # lint + format-check + test (run before pushing)
Contributions are welcome — improve examples, clarify docs, add tests, or extend models / transforms / apps. See the developer guide.
AI coding agents: start with AGENTS.md — the canonical
reference for conventions, commands, and repository rules.
Citation
@article{boussot2025konfai,
title = {KonfAI: A Modular and Fully Configurable Framework for Deep Learning in Medical Imaging},
author = {Boussot, Valentin and Dillenseger, Jean-Louis},
journal = {arXiv preprint arXiv:2508.09823},
year = {2025}
}
Licensed under Apache-2.0.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file konfai-1.6.0.tar.gz.
File metadata
- Download URL: konfai-1.6.0.tar.gz
- Upload date:
- Size: 13.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
285406b5b59506eef4e08a37bcc5bf1a0fe97fea8336d57542ccfdfea15140a0
|
|
| MD5 |
506409bb69271cf0eb24c7b1cd6b443b
|
|
| BLAKE2b-256 |
2aab2d03ff3c61e614655fed337d786fe17f92a1029329ef0ae47c3e203341a5
|
Provenance
The following attestation bundles were made for konfai-1.6.0.tar.gz:
Publisher:
publish.yml on fideus-labs/KonfAI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
konfai-1.6.0.tar.gz -
Subject digest:
285406b5b59506eef4e08a37bcc5bf1a0fe97fea8336d57542ccfdfea15140a0 - Sigstore transparency entry: 2184576165
- Sigstore integration time:
-
Permalink:
fideus-labs/KonfAI@4d452cff3351c9e2507034cf9513ad7ee99e942e -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/fideus-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4d452cff3351c9e2507034cf9513ad7ee99e942e -
Trigger Event:
push
-
Statement type:
File details
Details for the file konfai-1.6.0-py3-none-any.whl.
File metadata
- Download URL: konfai-1.6.0-py3-none-any.whl
- Upload date:
- Size: 313.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f8abd6d846cfd3f0996a164f263f610162fc9fabac0351904c88a03f5dd877c
|
|
| MD5 |
b0199b8a7173456d00655a19ad274061
|
|
| BLAKE2b-256 |
a67b42f5125456a76529c68d8b3ba70836042113882a7d76b75a4f96d4dccdad
|
Provenance
The following attestation bundles were made for konfai-1.6.0-py3-none-any.whl:
Publisher:
publish.yml on fideus-labs/KonfAI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
konfai-1.6.0-py3-none-any.whl -
Subject digest:
1f8abd6d846cfd3f0996a164f263f610162fc9fabac0351904c88a03f5dd877c - Sigstore transparency entry: 2184577663
- Sigstore integration time:
-
Permalink:
fideus-labs/KonfAI@4d452cff3351c9e2507034cf9513ad7ee99e942e -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/fideus-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4d452cff3351c9e2507034cf9513ad7ee99e942e -
Trigger Event:
push
-
Statement type: