Prediction configuration#
Prediction configuration lives under the Predictor root object.
Predictor:
Model:
classpath: UNet.yml
UNet:
...
Dataset:
...
outputs_dataset:
...
train_name: SEG_BASELINE
Running it#
From the directory that contains Prediction.yml and the Checkpoints/
folder written by training:
konfai PREDICTION -y --gpu 0 --config Prediction.yml \
--models Checkpoints/SEG_BASELINE/<checkpoint>.pt
You can also pass multiple checkpoints:
konfai PREDICTION -y --gpu 0 --config Prediction.yml \
--models ckpt_a.pt ckpt_b.pt ckpt_c.pt
When multiple checkpoints are provided, the predictor combines them using the
combine strategy from the YAML, usually Mean or Median.
Top-level fields#
Field |
Type |
Default in code |
Required |
Effect |
|---|---|---|---|---|
|
mapping |
|
Yes |
Selects the model class used for prediction. |
|
mapping |
|
Yes |
Defines inference data loading and test-time augmentation. |
|
mapping |
default output dataset |
Yes in practice |
Controls which outputs are written to disk and how. |
|
string |
|
No |
Reduces outputs across multiple checkpoints. |
|
string |
|
Yes in practice |
Names the prediction run and output folder. |
|
int or null |
|
No |
Optional seed. |
|
list or null |
|
No |
Module placement optimization. |
|
bool |
|
No |
Enables AMP during inference. |
|
list or null |
|
No |
Optional TensorBoard logging. |
Predictor.Model#
Prediction uses the same classpath convention as training:
Model:
classpath: Model:UNetpp5
outputs_criterions: {}
In most prediction configs:
you select the architecture
you keep only the inference-relevant parameters
you disable or simplify training-only criteria
Checkpoint loading is controlled by the CLI argument --models, not by the YAML
file itself.
Predictor.Dataset#
Prediction datasets are instantiated through DataPrediction.
Key fields:
Field |
Type |
Effect |
|---|---|---|
|
list[str] |
Input dataset sources. |
|
mapping |
Input groups and preprocessing transforms. |
|
mapping |
Test-time augmentation definitions. |
|
mapping |
Sliding-window or slice-wise inference setup. |
|
object |
Restricts evaluated cases. |
|
int |
Number of patches per inference batch. |
Use Dataset.Patch when:
the full input does not fit in memory
you want slice-wise or sliding-window inference
you need the same spatial strategy as training
outputs_dataset#
outputs_dataset defines how selected model outputs become files on disk.
outputs_dataset:
Head:Tanh:
OutputDataset:
name_class: OutSameAsGroupDataset
group: sCT
same_as_group: MR:MR
reduction: Mean
Important nested fields:
Field |
Effect |
|---|---|
output key |
Selects the model output to export. |
|
Selects the output dataset implementation. |
|
Output group name written to disk. |
|
Destination dataset path and format. |
|
Geometry reference group for exported volumes. |
|
Applied before combining ensemble or TTA outputs. |
|
Applied after reduction. |
|
Final transforms applied before writing. |
|
Combines multiple predictions, usually |
|
Optional patch reassembly strategy. |
Note
One Prediction.yml can be shared between different checkpoints as long as
the exported output name stays consistent.
Examples#
See:
examples/Segmentation/Prediction.ymlexamples/Synthesis/Prediction.yml
Troubleshooting#
If geometry or intensity range is wrong, review the final transforms in
outputs_dataset.
Next steps#
Evaluation configuration — to score the written predictions against ground truth.
Datasets and groups — the shared
dataset_filenames,groups_src, andsubsetconventions.Model graph and output naming — how the model output paths referenced by
outputs_datasetare named.