This repository contains a complete pipeline for training a UNet model for liver segmentation using the MONAI Task03_Liver dataset, orchestrated with Valohai.
This project demonstrates how to:
- Download and preprocess the Task03_Liver dataset
- Train a UNet model using MONAI
- Evaluate model performance using Dice Score
- Run inference on unseen data
preprocess.py
: Downloads and preprocesses the Task03_Liver datatrain.py
: Trains the UNet model using MONAIevaluate.py
: Evaluates model performance on the test setinference.py
: Performs segmentation inference on new imagesvalohai.yaml
: Defines the Valohai pipeline and execution stepsrequirements.txt
: Core Python dependencies
This pipeline automates the full workflow for medical image segmentation using a U-Net architecture on the Task03_Liver dataset from the Medical Segmentation Decathlon.
- Downloads the Task03_Liver dataset from the Medical Segmentation Decathlon.
- Applies preprocessing transforms such as resampling, cropping, and resizing.
- Splits the dataset into training, validation, and test sets, and generates manifest files.
- Saves the preprocessed volumes and labels as zip using Datasets (check: https://docs.valohai.com/hc/en-us/articles/18704302494481-Creating-datasets)
-
Trains a configurable U-Net model on the preprocessed dataset.
-
Supports custom settings for:
- Number of epochs
- Learning rate
- Batch size
- Input/output channels
- Number of residual units
- Channel depth at each stage
-
Evaluates model performance using metrics such as:
- Dice Similarity Coefficient (DSC)
- Intersection over Union (IoU)
-
Produces detailed logs and segmentation quality visualizations.
-
Performs sliding window inference on new or unseen volumetric data.
-
Input:
- Raw volume in NIfTI format (
.nii.gz
) Available test case: https://drive.google.com/drive/u/0/folders/1auCFCixQecS3rcBSbOf-KQXI1-tgDObx
- Raw volume in NIfTI format (
-
Outputs:
vh pipeline run train_and_evaluate
This project uses the Task03_Liver dataset from the Medical Segmentation Decathlon. The dataset contains CT volumes of the liver with manual segmentation masks.
The training pipeline uses the UNet architecture implemented in MONAI, optimized for medical image segmentation tasks.
This project leverages the MONAI framework and uses datasets from the Medical Segmentation Decathlon. It is distributed under the Apache License 2.0.
- Project MONAI
- Valohai for orchestrating the training workflow