A pre-trained model for simultaneous segmentation and classification of nuclei within multi-tissue histology images based on CoNSeP data. The details of the model can be found in .
The model is trained to simultaneously segment and classify nuclei, and a two-stage training approach is utilized:
There are two training modes in total. If "original" mode is specified, [270, 270] and [80, 80] are used for
out_size respectively. If "fast" mode is specified, [256, 256] and [164, 164] are used for
out_size respectively. The results shown below are based on the "fast" mode.
In this bundle, the first stage is trained with pre-trained weights from some internal data. The original author's repo and torchvison also provide pre-trained weights but for non-commercial use. Each user is responsible for checking the content of models/datasets and the applicable licenses and determining if suitable for the intended use.
If you want to train the first stage with pre-trained weights, just specify
--network_def#pretrained_url <your pretrain weights URL> in the training command below, such as ImageNet.
The training data is from https://warwick.ac.uk/fac/cross_fac/tia/data/hovernet/.
The provided labelled data was partitioned, based on the original split, into training (27 tiles) and testing (14 tiles) datasets.
You can download the dataset by using this command:
wget https://warwick.ac.uk/fac/cross_fac/tia/data/hovernet/consep_dataset.zip unzip consep_dataset.zip
After download the datasets, please run
scripts/prepare_patches.py to prepare patches from tiles. Prepared patches are saved in
<your concep dataset path>/Prepared. The implementation is referring to https://github.com/vqdang/hover_net. The command is like:
python scripts/prepare_patches.py --root <your concep dataset path>
This model utilized a two-stage approach. The training was performed with the following:
If you face memory issues with CacheDataset, you can either switch to a regular Dataset class or lower the caching rate
cache_rate in the configurations within range [0, 1] to minimize the System RAM requirements.
Input: RGB images
Output: a dictionary with the following keys:
The achieved metrics on the validation data are:
In addition to the Pythonic APIs, a few command line interfaces (CLI) are provided to interact with the bundle. The CLI supports flexible use cases, such as overriding configs at runtime and predefining arguments in a file.
For more details usage instructions, visit the MONAI Bundle Configuration Page.
Please note that if the default dataset path is not modified with the actual path in the bundle config files, you can also override it by using
python -m monai.bundle run --config_file configs/train.json --stage 0 --dataset_dir <actual dataset path>
python -m monai.bundle run --config_file configs/train.json --network_def#freeze_encoder False --stage 1 --dataset_dir <actual dataset path>
trainconfig to execute multi-GPU training:
torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/multi_gpu_train.json']" --batch_size 8 --network_def#freeze_encoder True --stage 0
torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/multi_gpu_train.json']" --batch_size 4 --network_def#freeze_encoder False --stage 1
trainconfig to execute evaluation with the trained model, here we evaluated dice from the whole input instead of the patches:
python -m monai.bundle run --config_file "['configs/train.json','configs/evaluate.json']"
python -m monai.bundle run --config_file configs/inference.json
 Simon Graham, Quoc Dang Vu, Shan E Ahmed Raza, Ayesha Azam, Yee Wah Tsang, Jin Tae Kwak, Nasir Rajpoot, Hover-Net: Simultaneous segmentation and classification of nuclei in multi-tissue histology images, Medical Image Analysis, 2019 https://doi.org/10.1016/j.media.2019.101563
Copyright (c) MONAI Consortium
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
By pulling and using the MONAI Toolkit container and MONAI models, you accept the terms and conditions of the NVIDIA AI Product Agreement. Register for a free evaluation license to try NVIDIA AI Enterprise on your compatible, on-premises system or on the cloud!