From 191d1966d7937d6a363ed87a3a6db77548fd392b Mon Sep 17 00:00:00 2001 From: "marc.wieland@dlr.de" Date: Thu, 8 Dec 2022 16:44:10 +0100 Subject: [PATCH 1/4] added optional support for openvino provider --- CHANGELOG.rst | 6 ++++++ README.md | 14 ++++++++++---- requirements.txt | 1 - setup.py | 6 ++++++ ukis_csmask/__init__.py | 2 +- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e45719b..e9bdb6b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Changelog ========= +[0.1.7] (2022-12-09) +-------------------- +Added +******* +- added support for onnxruntime-openvino provider + [0.1.6] (2022-11-30) -------------------- Changed diff --git a/README.md b/README.md index 5a5250b..1ab61b5 100644 --- a/README.md +++ b/README.md @@ -65,19 +65,25 @@ csmask_valid.write_to_file("sentinel2_valid.tif", dtype="uint8", compress="PACKB ```` ## Installation -The easiest way to install ukis-csmask is through pip. The default installation supports CPU computation. +The easiest way to install ukis-csmask is through pip. To install ukis-csmask with [default CPU provider](https://onnxruntime.ai/docs/execution-providers/) run the following. ```shell -pip install ukis-csmask +pip install ukis-csmask[cpu] ``` -To install ukis-csmask with GPU support run the following instead. This requires that you have a GPU with CUDA runtime libraries installed on the system. +To install ukis-csmask with [OpenVino support](https://onnxruntime.ai/docs/execution-providers/OpenVINO-ExecutionProvider.html) for enhanced CPU inference run the following instead. + +```shell +pip install ukis-csmask[openvino] +``` + +To install ukis-csmask with [GPU support](https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html) run the following instead. This requires that you have a GPU with CUDA runtime libraries installed on the system. ```shell pip install ukis-csmask[gpu] ``` -For a list of dependencies check the [requirements](https://github.com/dlr-eoc/ukis-csmask/blob/main/requirements.txt). +ukis-csmask depends on [onnxruntime](https://onnxruntime.ai/). For a list of additional dependencies check the [requirements](https://github.com/dlr-eoc/ukis-csmask/blob/main/requirements.txt). ## Contributors The UKIS team creates and adapts libraries which simplify the usage of satellite data. Our team includes (in alphabetical order): diff --git a/requirements.txt b/requirements.txt index 372aba6..4d54b05 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ numpy -onnxruntime>=1.13 scipy diff --git a/setup.py b/setup.py index a4122a5..96deef7 100644 --- a/setup.py +++ b/setup.py @@ -36,9 +36,15 @@ def get_version(rel_path): packages=find_packages(), install_requires=open("requirements.txt").read().splitlines(), extras_require={ + "cpu": [ + "onnxruntime", + ], "gpu": [ "onnxruntime-gpu", ], + "openvino": [ + "onnxruntime-openvino", + ], "dev": [ "pytest", ], diff --git a/ukis_csmask/__init__.py b/ukis_csmask/__init__.py index 0815acf..0f75b69 100644 --- a/ukis_csmask/__init__.py +++ b/ukis_csmask/__init__.py @@ -1 +1 @@ -__version__ = "0.1.6" +__version__ = "0.1.7" From 7714b0959edafe537c109af84f0cbe01871c4726 Mon Sep 17 00:00:00 2001 From: "marc.wieland@dlr.de" Date: Mon, 12 Dec 2022 09:08:06 +0100 Subject: [PATCH 2/4] updated git ci test --- .github/workflows/pythonapp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 727d655..0d4c1c6 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -25,7 +25,7 @@ jobs: python -m pip install --upgrade pip python -m pip install pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install coverage + pip install coverage onnxruntime - name: Test with pytest run: | pytest From 6924e577506ed5884cd8884edf737feeceb3b479 Mon Sep 17 00:00:00 2001 From: "marc.wieland@dlr.de" Date: Mon, 12 Dec 2022 09:17:13 +0100 Subject: [PATCH 3/4] ImportError handling --- .github/workflows/pythonapp.yml | 2 +- ukis_csmask/mask.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 0d4c1c6..727d655 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -25,7 +25,7 @@ jobs: python -m pip install --upgrade pip python -m pip install pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install coverage onnxruntime + pip install coverage - name: Test with pytest run: | pytest diff --git a/ukis_csmask/mask.py b/ukis_csmask/mask.py index 53d2e81..2a5ef38 100644 --- a/ukis_csmask/mask.py +++ b/ukis_csmask/mask.py @@ -1,11 +1,20 @@ -from pathlib import Path - import numpy as np -import onnxruntime + +from pathlib import Path from scipy import ndimage from .utils import reclassify, tile_array, untile_array +try: + import onnxruntime +except ImportError as e: + msg = ( + "ukis-csmask dependencies are not installed.\n\n" + "Please pip install as follows and specify your desired runtime provider [cpu], [openvino] or [gpu]:\n\n" + " python -m pip install ukis-csmask[cpu] --upgrade" + ) + raise ImportError(str(e) + "\n\n" + msg) + class CSmask: """Segments clouds and cloud shadows in multi-spectral satellite images.""" From 1c88dd7f745bebcd7a8f9c211ca1103cbca6fbe1 Mon Sep 17 00:00:00 2001 From: "marc.wieland@dlr.de" Date: Mon, 12 Dec 2022 09:18:46 +0100 Subject: [PATCH 4/4] updated ci test --- .github/workflows/pythonapp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 727d655..0d4c1c6 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -25,7 +25,7 @@ jobs: python -m pip install --upgrade pip python -m pip install pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install coverage + pip install coverage onnxruntime - name: Test with pytest run: | pytest