NGC | Catalog
CatalogModelsMONAI Pathology Tumor Detection

MONAI Pathology Tumor Detection

For downloads and more information, please view on a desktop device.
Logo for MONAI Pathology Tumor Detection

Description

A pre-trained model for automated detection of metastases in whole-slide histopathology images.

Publisher

NVIDIA

Use Case

Detection

Framework

MONAI

Latest Version

0.4.5

Modified

December 15, 2022

Size

64.44 MB

Model Overview

A pre-trained model for automated detection of metastases in whole-slide histopathology images.

The model is trained based on ResNet18 [1] with the last fully connected layer replaced by a 1x1 convolution layer. Diagram showing the flow from model input, through the model architecture, and to model output

Data

All the data used to train, validate, and test this model is from Camelyon-16 Challenge. You can download all the images for "CAMELYON16" data set from various sources listed here.

Location information for training/validation patches (the location on the whole slide image where patches are extracted) are adopted from NCRF/coords.

Annotation information are adopted from NCRF/jsons.

  • Target: Tumor
  • Task: Detection
  • Modality: Histopathology
  • Size: 270 WSIs for training/validation, 48 WSIs for testing

Preprocessing

This bundle expects the training/validation data (whole slide images) reside in a {data_root}/training/images. By default data_root is pointing to /workspace/data/medical/pathology/ You can modify data_root in the bundle config files to point to a different directory.

To reduce the computation burden during the inference, patches are extracted only where there is tissue and ignoring the background according to a tissue mask. Please also create a directory for prediction output. By default output_dir is set to eval folder under the bundle root.

Please refer to "Annotation" section of Camelyon challenge to prepare ground truth images, which are needed for FROC computation. By default, this data set is expected to be at /workspace/data/medical/pathology/ground_truths. But it can be modified in evaluate_froc.sh.

Training configuration

The training was performed with the following:

  • Config file: train.config
  • GPU: at least 16 GB of GPU memory.
  • Actual Model Input: 224 x 224 x 3
  • AMP: True
  • Optimizer: Novograd
  • Learning Rate: 1e-3
  • Loss: BCEWithLogitsLoss
  • Whole slide image reader: cuCIM (if running on Windows or Mac, please install OpenSlide on your system and change wsi_reader to "OpenSlide")

Input

The training pipeline is a json file (dataset.json) which includes path to each WSI, the location and the label information for each training patch.

Output

A probability number of the input patch being tumor or normal.

Inference on a WSI

Inference is performed on WSI in a sliding window manner with specified stride. A foreground mask is needed to specify the region where the inference will be performed on, given that background region which contains no tissue at all can occupy a significant portion of a WSI. Output of the inference pipeline is a probability map of size 1/stride of original WSI size.

Performance

FROC score is used for evaluating the performance of the model. After inference is done, evaluate_froc.sh needs to be run to evaluate FROC score based on predicted probability map (output of inference) and the ground truth tumor masks. This model achieve the 0.91 accuracy on validation patches, and FROC of 0.72 on the 48 Camelyon testing data that have ground truth annotations available.

A Graph showing Train Acc, Train Loss, and Validation Acc

MONAI Bundle Commands

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.

Execute training
python -m monai.bundle run training --meta_file configs/metadata.json --config_file configs/train.json --logging_file configs/logging.conf
Override the train config to execute multi-GPU training
torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run training --meta_file configs/metadata.json --config_file "['configs/train.json','configs/multi_gpu_train.json']" --logging_file configs/logging.conf

Please note that the distributed training-related options depend on the actual running environment; thus, users may need to remove --standalone, modify --nnodes, or do some other necessary changes according to the machine used. For more details, please refer to pytorch's official tutorial.

Execute inference
CUDA_LAUNCH_BLOCKING=1 python -m monai.bundle run evaluating --meta_file configs/metadata.json --config_file configs/inference.json --logging_file configs/logging.conf
Evaluate FROC metric
cd scripts && source evaluate_froc.sh
Export checkpoint to TorchScript file

TorchScript conversion is currently not supported.

References

[1] He, Kaiming, et al, "Deep Residual Learning for Image Recognition." In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778. 2016. https://arxiv.org/pdf/1512.03385.pdf

Disclaimer

This training and inference pipeline was developed by NVIDIA. It is based on a model developed by NVIDIA researchers. This software has not been cleared or approved by FDA or any regulatory agency. MONAI pre-trained models are for developmental purposes only and cannot be used directly for clinical procedures.

License

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

http://www.apache.org/licenses/LICENSE-2.0

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.