|

HistoCRF

Conditional Random Fields for Interactive Refinement of Histopathological Predictions [Submitted to ICASSP 2026]

Assisting pathologists in the analysis of histopathological images has high clinical value, as it supports cancer detection and staging. In this context, histology foundation models have recently emerged. Among them, Vision-Language Models (VLMs) provide strong yet imperfect zero-shot predictions. We propose to refine these predictions by adapting Conditional Random Fields (CRFs) to histopathological applications, requiring no additional model training.
We present HistoCRF, a CRF-based framework, with a novel definition of the pairwise potential that promotes label diversity and leverages expert annotations. We consider three experiments: without annotations, with expert annotations, and with iterative human-in-the-loop annotations that progressively correct misclassified patches.
Experiments on five patch-level classification datasets covering different organs and diseases demonstrate average accuracy gains of 14.3\% without annotations and 27.1\% with only 100 annotations, compared to zero-shot predictions.
Moreover, integrating a human in the loop reaches a further gain of 32.7\% with the same number of annotations. An example of a single iterative message passing step is shown on the right.

Authors: T. Godelaine, M. Zanella, K. El Khoury, S. Mahmoudi, B. Macq, C. De Vleeschouwer

Contents

Installation

📌 NB: The Python version used is 3.10.4.

  1. Create a virtual environment
   python3 -m venv histocrf_venv
   source histocrf_venv/bin/activate

Clone the GitHub repository

   pip3 install torch==2.5.1 torchaudio==2.5.1 torchvision==0.20.1
   git clone https://github.com/tgodelaine/HistoCRF.git

Install the required packages

   cd HistoCRF
   pip install -r requirements.txt
  1. Models downloads:
Model🔗 Download LinkFolder name
CONCH📥 Link./root/HistoCRF/CONCH
UNI2h📥 LinkNo download is needed but you do need to request access.

Important: For the model CONCH, do not forget to download the checkpoints.

  1. Datasets downloads:
Dataset🔗 Download LinkFolder name
BACH📥 Link./data/thunder/datasets/BACH
BRACS📥 Link./data/BRACS
ESCA📥 Link./data/thunder/datasets/ESCA
NCT📥 Link./data/NCT-CRC-HE-100K
SICAP📥 Link./data/SICAP_MIL

Important: Each dataset must be placed in the directory ./data/.

Usage

  1. Once the datasets are downloaded, you must extract the features of each patch in the dataset. By using the following command line, a .npz file will be created at ./root/data_processed.
   cd HistoCRF
   python3 extraction.py --root_dir ./root/ --data_dir ./data/ --model {model} --dataset {dataset}
  1. Once the features are extracted, you can run the experiments using the following command lines. The results will be saved into a JSON file for further analysis at ./root/results.
ExperimentCommand line
LPpython3 inference_iteration_split_split.py --root_dir ./root/ --model {model} --dataset {dataset} --uni_pot softmax --weight 0.1 0.01 --pair_pot minus_model_features model_features_ann --compat indicator potts --sparse_method cossim --n_affinity 0 16 --n_annotations {n_annotations} --annotation_method error -ann_iterations {ann_iterations} --N_UP -100 --N_PROP 1 --seed {seed}
HistoCRFpython3 inference_iteration_split_split.py --root_dir ./root/ --model {model} --dataset {dataset} --uni_pot softmax --weight 0.1 0.01 --pair_pot minus_model_features model_features_ann --compat indicator potts --sparse_method cossim --n_affinity 0 16 --n_annotations {n_annotations} --annotation_method error -ann_iterations 1 --N_UP -1 --N_PROP 50 --seed {seed}
HistoCRF-HITLpython3 inference_iteration_split_split.py --root_dir ./root/ --model {model} --dataset {dataset} --uni_pot softmax --weight 0.1 0.01 --pair_pot minus_model_features model_features_ann --compat indicator potts --sparse_method cossim --n_affinity 0 16 --n_annotations {n_annotations} --annotation_method error -ann_iterations {ann_iterations} --N_UP -1 --N_PROP 50 --seed {seed}

Contact

If you have any questions, you can contact us by email: tiffanie.godelaine@uclouvain.be

User Avatar

Similar Posts

  • | | | | |

    Parrot

    PARROT, which stands for Platform for ARtificial intelligence guided Radiation Oncology Treatment, is a user-friendly, free, and open-source web platform. It allows users to visualize DICOM files, run AI models, display and evaluate predictions easily. The platform includes several trained state-of-the-art dose prediction and contour segmentation models. Users can also add their own models using…

  • | | | | |

    OpenTPS

    OpenTPS is an open-source treatment planning system (TPS) for research in radiation therapy and proton therapy. It was developed in Python with a special focus on simplifying contribution to the core functions to let the user develop their own features. It contains a variety of treatment planification and evaluation methods, as well as image processing and…

  • | | | |

    FreeMediSpring

    FreeMedispring : un outil de facturation et de prescription électronique entièrement gratuit. La coopérative Medispring a décidé de faciliter l’accès de tous les soignants belges aux outils désormais incontournables dans leur profession, et de mettre gratuitement à leur disposition une partie de son dossier médical.   FreeMedispring permet à tout professionnel de la santé sans…

  • | | |

    Orthanc

    Orthanc est un écosystème libre et open-source destiné à la gestion et au partage d’images médicales. Orthanc implémente le standard international DICOM qui régule l’imagerie médicale numérique dans tout établissement de santé. Cela permet à Orthanc de recevoir, de stocker et de transmettre des images en provenance de n’importe quel équipement de radiologie (scanners, IRM,…

  • | | |

    BIDS Managing and Analysis Tool

    > Github repository
    The BMAT software is a complete and easy-to-use local open-source neuroimaging analysis tool with a graphical user interface (GUI) that uses the BIDS format to organize and process brain MRI data for MS imaging research studies. BMAT provides the possibility to translate data from MRI scanners to the BIDS structure, create and manage BIDS datasets as well as develop and run automated processing pipelines.

    BMAT is now compatible to work with remote server using shared samba folder and a slurm scheduler to process data on remote server. It has to be noted that this feature has been implemented for users based in the Institute of NeuroSciences (IoNS) from UCLouvain. Therefore, it may not work easily with every servers, but feel free to fork the code and adapt it for your institue.

  • | |

    Comunicare Analytics

    COMUNICARE Analytics est une plateforme d’analyse de données médicales et d’aide à la décision médicale développée par Comunicare Solutions. Conçue pour répondre aux besoins des professionnels de la santé, cette solution repose sur le framework de calcul distribué open-source Apache Spark, offrant des capacités d’analyse à grande échelle et des prédictions précises pour une prise…

Laisser un commentaire