An open API service indexing awesome lists of open source software.

https://github.com/dkurt/qupath-extension-openvino

Intel OpenVINO extension for QuPath, a digital pathology platform
https://github.com/dkurt/qupath-extension-openvino

deep-learning digital-pathology intel java openvino qupath stardist

Last synced: 9 months ago
JSON representation

Intel OpenVINO extension for QuPath, a digital pathology platform

Awesome Lists containing this project

README

          

# QuPath OpenVINO extension

[![GitHub all releases](https://img.shields.io/github/downloads/dkurt/qupath-extension-openvino/total?color=blue)](https://github.com/dkurt/qupath-extension-openvino/releases) [![Image.sc forum](https://img.shields.io/badge/ask-question-brightgreen/json.svg?&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAABPklEQVR42m3SyyqFURTA8Y2BER0TDyExZ+aSPIKUlPIITFzKeQWXwhBlQrmFgUzMMFLKZeguBu5y+//17dP3nc5vuPdee6299gohUYYaDGOyyACq4JmQVoFujOMR77hNfOAGM+hBOQqB9TjHD36xhAa04RCuuXeKOvwHVWIKL9jCK2bRiV284QgL8MwEjAneeo9VNOEaBhzALGtoRy02cIcWhE34jj5YxgW+E5Z4iTPkMYpPLCNY3hdOYEfNbKYdmNngZ1jyEzw7h7AIb3fRTQ95OAZ6yQpGYHMMtOTgouktYwxuXsHgWLLl+4x++Kx1FJrjLTagA77bTPvYgw1rRqY56e+w7GNYsqX6JfPwi7aR+Y5SA+BXtKIRfkfJAYgj14tpOF6+I46c4/cAM3UhM3JxyKsxiOIhH0IO6SH/A1Kb1WBeUjbkAAAAAElFTkSuQmCC)](https://forum.image.sc/u/dkurt) [![Awesome OpenVINO](https://img.shields.io/badge/Awesome-OpenVINO-FC60A8?logo=awesomelists)](https://github.com/dkurt/awesome-openvino)

Welcome to the Intel OpenVINO extension for [QuPath](http://qupath.github.io)!

This adds support for inference optimization using [Intel OpenVINO for Java](https://github.com/openvinotoolkit/openvino_contrib/tree/master/modules/java_api) into QuPath.

| Intel(R) Core(TM) i7-6700K | **Test image**: [OS-3.ndpi](https://cytomine.com/collection/os-3/os-3-ndpi)
**Model**: he_heavy_augment
**Tile size**: 1024x1024 |
|---|---|
| TensorFlow 2.4.1 with platform=mkl | 22:31 minutes |
| OpenVINO 2022.1 | 15:02 minutes (x1.48) |
| OpenVINO 2022.1 INT8 | 9:54 minutes (x2.33) |

## Building

You can always build this extension from source but you can also download pre-built package from [releases](https://github.com/dkurt/qupath-extension-openvino/releases) page. Choose one for your operating system.

### Extension + dependencies separately

You can build the extension with

```bash
gradlew clean build copyDependencies
```

The output will be under `build/libs`.

* `clean` removes anything old
* `build` builds the QuPath extension as a *.jar* file and adds it to `libs`
* `copyDependencies` copies the TensorFlow dependencies to the `libs` folder

### Extension + dependencies together

Alternatively, you can create a single *.jar* file that contains both the
extension and all its dependencies with

```bash
gradlew clean shadowjar
```

## Installing

The extension + its dependencies will all need to be available to QuPath inside
QuPath's extensions folder.

The easiest way to install the jars is to simply drag them on top of QuPath
when it's running.
You will then be prompted to ask whether you want to copy them to the
appropriate folder.

## Usage

### OpenVINO IR format

OpenVINO uses own format for the deep learning networks representation (IR). It is a pair of `.xml` and `.bin` files which generated from original model. Download ready to use models from [models](./models) directory. There are FP32 and INT8 (quantized) version of the models. INT8 is faster for most of CPUs.

Alternatively, you can convert model locally. For model conversion you can install `openvino-dev` Python package and use Model Optimizer by `mo` command.

Example conversion for [StarDist](https://github.com/qupath/qupath-extension-stardist) model (we recommend to use Python virtual environment to install required packages):

```bash
python3 -m venv venv3
source venv3/bin/activate
pip install --upgrade pip
pip install openvino-dev tensorflow

mo --input input --data_type FP16 --input_shape "[1,1024,1024,3]" --saved_model_dir=he_heavy_augment
```

Note that extension is able to reshape model to any input size in runtime so `"[1,1024,1024,3]"` is just a default input resolution. For `dsb2018_heavy_augment` number of channels equals `1` so use `--input_shape "[1,1024,1024,1]"`

:thinking: For questions and feature requests use [issues](https://github.com/dkurt/qupath-extension-openvino/issues) or [forum](https://forum.image.sc/u/dkurt).