Skip to content

A human in the loop solution to machine learning for pathologists (easy semantic segmentation of WSI)

License

Notifications You must be signed in to change notification settings

SarderLab/H-AI-L

Repository files navigation

H-AI-L (Human-A.I.-Loop) for semantic segmentation of WSI (whole slide images)

A solution for machine learning for pathologists (easy semantic segmentation of WSI) This is a library of codes for iterative training of the DeepLab v2 semantic segmentation network for WSIs. Currently this code supports annotation and viewing of WSI boundaries using Aperio ImageScope (https://www.leicabiosystems.com/digital-pathology/manage/aperio-imagescope/). This is currently limited to files formats which have openslide-python support (.tif support is provided via PIL).

The published paper is available here: https://www.nature.com/articles/s42256-019-0018-3

A preprint version of this work can be found here: https://arxiv.org/abs/1812.07509

NOTE: currently the only supported ImageScope annotation tools are the freehand select, and rectangle tools.

Created by Brendon Lutnick and Brandon Ginley at SUNY Buffalo.

This code runs using python3, and was tested using ubuntu 16.04

Dependencies (we think we got them all):

Before starting a new project, you must download a pretrained checkpoint file containing model parameters

Usage:

The code is run by using: segmentation_school.py
to run this code you must be in the H-AI-L directory where it is contained.

new project:
    - run segmentation school with the [--project] flag set to the desired name and the [--option] flag set to [new]
    - add new WSI and xml annotations to the 'TRAINING_data/0' folder located in the project folder created

training:
    - annotate the newly added data / correct the predicted xml files
    - run segmentation school with the [--project] flag set to the desired name and the [--option] flag set to [train]

prediction:
    - place new unannotated WSI in the newest subfolder of the 'TRAINING_data' folder located in the project folder  
    - run segmentation school with the [--project] flag set to the desired name and the [--option] flag set to [predict]

validation:
    - place holdout WSI and corresponding xml annotations in the 'HOLDOUT_data' folder located in the project folder
    - run segmentation school with the [--project] flag set to the desired name and the [--option] flag set to [validate]

The network hyperparameters can be adjusted using the flags provided in segmentation_school.py  

For non-sparse segmentation of WSI set the [--one_network] flag to 'True'
this will use only the high resolution (HR) network for training and prediction

Quick start guide

First, download the source codes and unzip them. Change the directory to the unzipped folder and run

python segmentation_school.py --option new --project project

Where 'project' is the desired name of the directory to contain the new HAIL project.

Next, place training WSIs and XML annotations OR prediction WSIs in the folder your_project_name/TRAINING_data/0/. Place your pre-trained model(s) into the your_project_name/MODELS/0/HR/ (for dense prediction) and/or your_project_name/MODELS/0/LR/ (for sparse prediction) folders. Then, run

python segmentation_school.py --option option --project project --encoder_name encoder_name --one_network one_network

Where 'option' is either train or predict,'project' is the directory name you specified before, 'encoder_name' is either res50, res101, or deeplab, and 'one_network' is either true (dense prediction with one network) or false (sparse prediction with cascaded low-high resolution networks). Please open and refer to the segmentation_school.py script for a full list of possible input parameters and their default values.

About

A human in the loop solution to machine learning for pathologists (easy semantic segmentation of WSI)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages