Skip to content

Commit

Permalink
Merge pull request #11 from dlr-eoc/10_support_openvino
Browse files Browse the repository at this point in the history
added optional support for openvino provider
  • Loading branch information
MWieland authored Dec 12, 2022
2 parents 64d9d05 + 1c88dd7 commit 0d46e7f
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
numpy
onnxruntime>=1.13
scipy
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
Expand Down
2 changes: 1 addition & 1 deletion ukis_csmask/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.6"
__version__ = "0.1.7"
15 changes: 12 additions & 3 deletions ukis_csmask/mask.py
Original file line number Diff line number Diff line change
@@ -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."""
Expand Down

0 comments on commit 0d46e7f

Please sign in to comment.