xiaoyuetang / hover-net

PyTorch implementation of HoverNet as described in https://arxiv.org/abs/1812.06499

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hover-Net

Open In Colab

This project attempts to reproduce the architecture specified in the paper
Graham, Simon, et al. "Hover-Net: Simultaneous segmentation and classification of nuclei in multi-tissue histology images." Medical Image Analysis 58 (2019): 101563
in PyTorch and is currently a work in progress.

The most up-to-date version is currently in the Colab notebook.

Use the steps below to get the code on your local machine.

Installation

Start by cloning the repository

git clone https://github.com/rshwndsz/hover-net.git

If you don't already have an environment with PyTorch 1.x, it's better to create a new conda environment with Python 3.6+.

Install conda-env if you haven't already.

conda install -c conda conda-env

To create a new environment and install required packages available on conda, run

$ conda env create --file environment.yml 
Fetching package metadata: ...
Solving package specifications: .Linking packages ...
[      COMPLETE      ] |#################################################| 100%
#
# To activate this environment, use:
# $ source activate hovernet-env
#
# To deactivate this environment, use:
# $ source deactivate
#

Move into your new environment

$ source activate hovernet-env
(hovernet-env) $

Install PyTorch and the CUDA Toolkit based on your local configuration. Get the command for the installation from the official website.

The command for a Linux system with a GPU and CUDA 10.1 installed is given below.

(hovernet-env) $ conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

Install packages not available through conda using pip

(hovernet-env) $ pip install -r requirements.txt

Setup

Get the "Multi-organ dataset by Neeraj Kumar et.al" from https://monuseg.grand-challenge.org/Data/ or download a cropped (to 256x256) version using

(hovernet-env) $ ./install.sh

or download your own dataset into dataset/raw/.

Edit the dataset APIs in hovernet/data.py and test.py as required.

Training

To train the model defined in hovernet/model.py using default parameters run

(hovernet-env) $ python train.py

This trains the model for 10 epochs and saves the best model (based on validation loss) in checkpoints/model-saved.pth

You can specify a lot of parameters as command line arguments. To find out which parameters can be provided run

(hovernet-env) $ python train.py --help

Testing

To test the model run

(hovernet-env) $ python test.py

About

PyTorch implementation of HoverNet as described in https://arxiv.org/abs/1812.06499


Languages

Language:Python 99.9%Language:Shell 0.1%