Official implementation of TaxoMIL: Taxonomy-Constrained Learning for Hierarchical Whole Slide Image Analysis.
TaxoMIL consists of three main components:
- A MIL backbone that aggregates patch-level WSI features into a slide-level representation.
- A dual-branch conditioning module for coarse-level and fine-level diagnosis.
- A dual-head text decoder that generates hierarchical diagnostic labels.
The framework is trained with text generation loss and taxonomy-guided auxiliary objectives.
git clone https://github.com/chaey0/TaxoMIL.git
cd TaxoMIL
conda create -n taxomil python=3.10 -y
conda activate taxomil
pip install -r requirements.txtTaxoMIL uses pre-extracted WSI feature bags as input.
Each CSV file should contain the following fields:
split,coarse_label,fine_label,feature_path
Example:
train,Benign,Usual Ductal Hyperplasia,/path/to/features/sample_001.pt
test,Malignant,Invasive Carcinoma,/path/to/features/sample_002.pt
Label definitions and taxonomy mappings are provided in:
config/
The expected feature format is a .pt file containing patch-level embeddings for each WSI.
Train the base model:
python main.py \
--mode train \
--data BRACS \
--decoder_type GPT2Train TaxoMIL with all taxonomy-guided objectives:
python main.py \
--mode train \
--data BRACS \
--decoder_type GPT2 \
--use_all_losspython main.py \
--mode test \
--data BRACS \
--ckpt_path checkpoints/BRACS/model.pthIf you find this repository useful, please consider citing our paper:
@inproceedings{taxomil2026,
title = {TaxoMIL: Taxonomy-Constrained Learning for Hierarchical Whole Slide Image Analysis},
author = {Lee, Chaeyeon and Nguyen Quoc, Khang and Song, Jinsol and Chong, Yosep and Yim, Kwangil and Kwak, Jin Tae},
booktitle = {European Conference on Computer Vision},
year = {2026}
}