Skip to content

Latest commit

 

History

History
 
 

110-ct-segmentation-quantize

Quantize a Segmentation Model and Show Live Inference

Binder

Notebook Contents

This folder contains five notebooks that show how to train, optimize, quantize and show live inference on a MONAI segmentation model with PyTorch Lightning and OpenVINO:

1. Data Preparation for 2D Segmentation of 3D Medical Data

2. Train a 2D-UNet Medical Imaging Model with PyTorch Lightning

3. Convert and Quantize a UNet Model and Show Live Inference using NNCF

4. Live Inference and Benchmark CT-scan Data with OpenVINO

NNCF performs quantization within the PyTorch framework. There is a pre-trained model and a subset of the dataset provided for the quantization notebook, so it is not required to run the data preparation and training notebooks before running the quantization tutorial.

This quantization tutorial consists of the following steps:

  • Use model conversion Python API to convert the model to OpenVINO IR. For more information about model conversion Python API, see this page.
  • Quantizing the model with NNCF with the Post-training Quantization with NNCF Tool API in OpenVINO.
  • Evaluating the F1 score metric of the original model and the quantized model.
  • Benchmarking performance of the original model and the quantized model.
  • Showing live inference with async API and MULTI plugin in OpenVINO.

You will also see real-time segmentation of kidney CT scans running on a CPU, iGPU, or combining both devices for higher throughput. The processed frames are 3D scans that are shown as individual slices. The visualization slides through the slices with detected kidneys overlayed in red. A pre-trained and quantized model is provided, so running the previous notebooks (1-3) in the series is not required.

Installation Instructions

If you have not installed all required dependencies, follow the Installation Guide.