Inference repository for the 5th solution in the second edition of the MICCAI MBH-Seg25 Challenge on multi-class brain hemorrhage segmentation from non-contrast CT scans.
challenge website: https://www.mbhseg.com/
leaderboard: leaderboard
MBH-Seg25: contains the predict code, model, and weights for MBH-Seg25.mbh_seg.tar: Docker image for MBH-Seg25.
# Load the Docker image
docker load -i mbh_seg.tar
# Run the Docker container
docker run -itd --gpus all --name mbh_seg mbh_seg:latest
# Copy your data、code、weights to the container
docker cp /path/to/MBH-Seg25 mbh_seg:/workspace
# Access the container
docker exec -it mbh_seg -w /workspace /bin/bash
# Install the dependencies
cd /workspace/MBH-Seg25/selective_scan
pip install -e .MBH_Test_label_2025/
├── ID_90ae3af3_ID_8d77fcb5d2/
│ ├── image.nii.gz
│ ├── label_annot_1.nii.gz
│ └── label_annot_5.nii.gz
├── ID_066b1fc2_ID_f937d7bff0/
│ ├── image.nii.gz
│ ├── label_annot_1.nii.gz
│ └── label_annot_5.nii.gz
└── ID_0219ef88_ID_e5c1a31210/
├── image.nii.gz
├── label_annot_1.nii.gz
└── label_annot_5.nii.gz
folder name: ID of the patientimage.nii.gz: The input image for segmentation.label_annot_*.nii.gz: The ground truth label for the annotation.
# Copy test data to the container
docker cp /path/to/MBH_Test_label_2025 mbh_seg:/workspace/MBH-Seg25# Access the container
docker exec -it mbh_seg -w /workspace /bin/bash
cd /workspace/MBH-Seg25
python stroke_predict.py --input_dir /workspace/MBH-Seg25/MBH_Test_label_2025 --output_dir /workspace/MBH-Seg25/predictionsThe toolkit automatically detects your data structure and parameters.
project/
├── predictions/
│ ├── ID_90ae3af3_ID_8d77fcb5d2.nii.gz
│ ├── ID_066b1fc2_ID_f937d7bff0.nii.gz
│ └── ID_0219ef88_ID_e5c1a31210.nii.gz
└── MBH_Test_label_2025/
├── ID_90ae3af3_ID_8d77fcb5d2/
│ ├── image.nii.gz
│ ├── label_annot_1.nii.gz
│ └── label_annot_5.nii.gz
├── ID_066b1fc2_ID_f937d7bff0/
│ ├── image.nii.gz
│ ├── label_annot_1.nii.gz
│ └── label_annot_5.nii.gz
└── ID_0219ef88_ID_e5c1a31210/
├── image.nii.gz
├── label_annot_1.nii.gz
└── label_annot_5.nii.gz
Note: Prediction filenames must match the folder names in the labels directory for correct evaluation.
For most evaluation needs, simply use:
# Access the container
docker exec -it mbh_seg -w /workspace /bin/bash
cd /workspace/MBH-Seg25
python competition_evaluation.py --pred_path /workspace/MBH-Seg25/predictions --gt_path /workspace/MBH-Seg25/MBH_Test_label_2025This command automatically:
- Detects all prediction files in your predictions directory
- Matches them with corresponding annotation folders
- Evaluates using appropriate metrics
- Handles ID-based naming (like MBH dataset structure)
- GED (Generalized Energy Distance): Set-level similarity between prediction and annotation sets
- Dice_max: Maximum Dice score achievable through optimal matching
- Dice_match: Dice score using Hungarian algorithm optimal matching
- Dice_soft: Soft Dice coefficient accounting for all annotation variations
- Individual Dice Scores: Per-annotator Dice coefficients
- Statistical Summary: Mean, standard deviation, min/max across annotators
- File Format: NIfTI (
.nii.gz) - Segmentation Maps: Integer class indices (0, 1, 2, ...) or binary (0, 1)
- Spatial Consistency: All files must have matching dimensions
- Class Handling: Supports sparse class indices (e.g., [0, 2, 5])
- ID Matching: For MBH-style datasets, prediction filenames must exactly match the corresponding annotation folder names
Final evaluation results for all samples are saved in the competition_results/ folder:
competition_aggregate_results.json- Summary metrics across all samplescompetition_detailed_results.json- Detailed per-sample resultscompetition_report.txt- Human-readable evaluation report
