copick training nnunet
torch
Plan, preprocess, and train nnUNet on a CoPick dataset.
Plugin command — copick-torch
This command is provided by the copick-torch plugin, not copick core. Install it to make this command available:
See the plugin system guide for details.
Usage
Description
Runs nnUNet planning and preprocessing followed by training on a dataset that
already exists in nnunet_raw (produced by copick convert nnunet). The command
first invokes nnUNetv2_plan_and_preprocess to fingerprint the dataset and plan
patch sizes, then runs nnUNetv2_train once per requested fold. Pass
--skip-preprocess to reuse an existing plan.
The --model flag selects the architecture and the matching trainer class:
nnunet (standard nnUNet), resnecl (Residual Encoder Large), and the MedNeXt
variants (mednext_s, mednext_b, mednext_m, mednext_l). MedNeXt trainers
require the MedNeXt package to be installed. If a fold checkpoint already exists in
the results directory, training resumes from it automatically.
Options
| Option | Type | Default | Description |
|---|---|---|---|
-id, --dataset-id |
integer | 1 |
nnUNet dataset ID (must match the one used in prepare) |
-n, --dataset-name |
text | required | nnUNet dataset name (must match the one used in prepare) |
-r, --raw |
path | required | Path to nnunet_raw directory |
-pre, --preprocessed |
path | required | Path to nnunet_preprocessed directory |
-o, --output |
path | required | Path to nnunet_results directory |
-cfg, --configuration |
choice (3d_fullres | 3d_lowres | 3d_cascade_fullres) | 3d_fullres |
nnUNet configuration to train |
-f, --folds |
text | 0 |
Folds to train, e.g. 0 or 0,1,2,3,4 |
-m, --model |
choice (nnunet | resnecl | mednext_s | mednext_b | mednext_m | mednext_l) | nnunet |
Model architecture to train. |
-skip, --skip-preprocess |
boolean flag | False |
Skip nnUNetv2_plan_and_preprocess (useful if already done). |
Examples
# Plan, preprocess, and train the default nnUNet on fold 0
copick training nnunet -n my_dataset -id 1 \
-r ./nnUNet_raw -pre ./nnUNet_preprocessed -o ./nnUNet_results
# Train a MedNeXt Medium model across all five folds
copick training nnunet -n my_dataset -id 1 \
-r ./nnUNet_raw -pre ./nnUNet_preprocessed -o ./nnUNet_results \
--model mednext_m --folds 0,1,2,3,4
# Reuse an existing plan and resume training, skipping preprocessing
copick training nnunet -n my_dataset -id 1 \
-r ./nnUNet_raw -pre ./nnUNet_preprocessed -o ./nnUNet_results \
--skip-preprocess
See also
copick convert nnunet— convert a CoPick project into an nnUNet raw datasetcopick inference nnunet— run inference with a trained nnUNet model