nnunet-segmentation
Medical image segmentation with nnU-Net's self-configuring framework — auto-selects architecture, preprocessing, training for any modality. CT, MRI, microscopy, ultrasound in 2D, 3D full-res, 3D low-res, cascade. Pipeline: convert → plan/preprocess → train (5-fold CV) → best config → predict → ensemble. Use when classical segmentation fails and annotated data exists.
npx skills add BioTender-max/awesome-bio-agent-skills --skill nnunet-segmentation --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Automates medical image segmentation using nnU-Net's self-configuring framework. It selects architecture (2D, 3D full-res, or 3D cascade), preprocessing, and training schedule automatically based on the input data. It orchestrates a complete pipeline: convert → plan/preprocess → train (5-fold CV) → best config → predict → ensemble. It includes a Quick Start and step-by-step guidance for dataset preparation, planning, training, configuration selection, performing predictions, ensembling, post-processing, and evaluation. It also demonstrates Python API usage for inference and a CLI-based workflow for end-to-end segmentation on modalities like CT, MRI, microscopy, and ultrasound, with supported formats (NIfTI) and environment setup. It notes prerequisites such as Python packages, environment variables, and GPU requirements, and provides commands for dataset conversion, planning, training, predicting, and ensemble operations. It emphasizes use when annotated data exists and is intended to establish a baseline or production pipeline for segmentation tasks.
How it works
- The agent prepares a dataset in nnU-Net format (imagesTr, labelsTr, imagesTs) and, if needed, converts MSD datasets via nnUNetv2_convert_MSD_dataset.
- It runs nnUNetv2_plan_and_preprocess to automatically fingerprint the dataset and generate plans (nnUNetPlans.json) and preprocessed data directories.
- It trains models across configurations and folds (e.g., 3d_fullres, 2d; folds 0–4) using commands like nnUNetv2_train, optionally saving softmax outputs with --npz.
- It runs nnUNetv2_find_best_configuration to select the best single model or ensemble (e.g., 2d + 3d_fullres) based on validation metrics.
- It performs inference with nnUNetv2_predict (single fold or all folds) and supports Python API (nnUNetPredictor) for integration.
- It supports ensemble of predictions (nnUNetv2_ensemble) and optional post-processing (nnUNetv2_apply_postprocessing).
- It provides evaluation and visualization steps (e.g., computing Dice and Hausdorff metrics, overlay visualization).
When to use it
- For segmenting anatomical structures in CT or MRI with 20+ annotated training cases.
- When you need an automated baseline or production-grade segmentation pipeline without manual hyperparameter tuning.
- When you want to compare segmentation methods using nnU-Net’s auto-configured ensembles as a baseline.
- When inference should be repeated across many new cases with a trained model.
- If annotated data exists; alternatives are suggested for scenarios without training data.
What it can touch
- Uses tools and scripts like: nnUNetv2_convert_MSD_dataset, nnUNetv2_plan_and_preprocess, nnUNetv2_train, nnUNetv2_predict, nnUNetv2_find_best_configuration, nnUNetv2_ensemble, nnUNetv2_apply_postprocessing, and the Python API nnUNetPredictor. Environment variables nnUNet_raw, nnUNet_preprocessed, nnUNet_results must be set. It assumes Python 3.9+ and Linux/macOS environments. GPU usage is supported and recommended via CUDA.
Caveats
- Requires annotated training data (nnU-Net cannot train without labels).
- Assumes correct installation of nnunetv2 and compatible CUDA-enabled GPUs for training; CPU training is possible but slow.
- Uses specific directory structures and dataset formats; deviations may require adjustments.
- License: Apache-2.0 for the skill (per frontmatter).
# nnU-Net Automated Medical Image Segmentation ## Overview nnU-Net (no-new-Net) is a self-configuring deep learning framework for biomedical image segmentation. Given a labeled training dataset, nnU-Net automatically determines the optimal network architecture (2D, 3D full-resolution, or 3D cascade), preprocessing steps (resampling, normalization, patch size), training schedule, and post-processing. It consistently achieves state-of-the-art performance across diverse imaging modalities and anatomical structures without manual hyperparameter tuning. nnU-Net v2 (`nnunetv2`) is the current release with a Python API for inference alongside the standard CLI. ## When to Use - Segmenting anatomical structures in CT or MRI scans (organs, tumors, lesions) when you have 20+ annotated training cases - Automating cell or nucleus segmentation in 3D fluorescence or electron microscopy volumes - Establishing a strong baseline for any new segmentation challenge without manually tuning a U-Net - Running inference on new images using a pretrained nnU-Net model from a published challenge - Comparing segmentation methods: nnU-Net's auto-configured ensembles serve as a rigorous baseline - Building prod
- Overview
- When to Use
- Prerequisites
- Quick Start
- Workflow
- Step 1: Prepare Dataset in nnU-Net Format
- Step 2: Plan and Preprocess
- Step 3: Train (5-Fold Cross-Validation)
- Step 4: Find Best Configuration
- Step 5: Predict on New Images
- Step 6: Ensemble Predictions
- Step 7: Evaluate Segmentation Quality
- Step 8: Visualize Segmentation Results
- Key Parameters
pip install nnunetv2 Verify installation nnUNetv2_train --help Set required environment variables (add to ~/.bashrc or ~/.zshrc) export nnUNet_raw=/data/nnUNet_raw export nnUNet_preprocessed=/data/nnUNet_preprocessed export nnUNet_results=/data/nnUNet_results mkdir -p $nnUNet_raw $nnUNet_preprocessed $nnUNet_results Minimal end-to-end pipeline: convert dataset → preprocess → train → predict Assumes dataset is in Medical Segmentation Decathlon format
What does the nnunet-segmentation skill do?
Medical image segmentation with nnU-Net's self-configuring framework — auto-selects architecture, preprocessing, training for any modality. CT, MRI, microscopy, ultrasound in 2D, 3D full-res, 3D low-res, cascade. Pipeline: convert → plan/preprocess → train (5-fold CV) → best config → predict → ensemble. Use when classical segmentation fails and annotated data exists.
How do I install it?
Run `npx skills add BioTender-max/awesome-bio-agent-skills --skill nnunet-segmentation --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From BioTender-max/awesome-bio-agent-skills, a repository with 135 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
