Skip to content

Commit 230547e

Browse files
committed
Merge branch 'master' into rhecker/py-bindings-tests
2 parents cd9bf79 + 0817fbe commit 230547e

File tree

9 files changed

+69
-95
lines changed

9 files changed

+69
-95
lines changed

.github/workflows/docs.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
Build-Docs:
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
1313
permissions:
1414
contents: write
1515
steps:
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install dependencies
2323
run: pip install 'src/python/.[docs]'
2424
- name: Install and Generate Doxygen
25-
uses: mattnotmitt/doxygen-action@v1.9.8
25+
uses: mattnotmitt/doxygen-action@v1.12.0
2626
- name: Build Docs
2727
run: |
2828
cd docs
@@ -46,6 +46,8 @@ jobs:
4646
git config --local user.name "GitHub Action"
4747
git checkout --orphan gh-pages
4848
git reset --hard
49+
echo '<html><head><meta http-equiv="refresh" content="0; url=latest/" /></head></html>' > index.html
50+
git add index.html
4951
touch .nojekyll
5052
git add .nojekyll
5153
git commit -m "Initializing gh-pages branch"
@@ -62,7 +64,7 @@ jobs:
6264
mkdir -p /tmp/docs_build
6365
cp -r docs/build/html/* /tmp/docs_build/
6466
rm -rf ${{ env.RELEASE_VERSION }}/*
65-
echo '<html><head><meta http-equiv="refresh" content="0; url=stable/" /></head></html>' > index.html
67+
echo '<html><head><meta http-equiv="refresh" content="0; url=latest/" /></head></html>' > index.html
6668
mkdir -p ${{ env.RELEASE_VERSION }}
6769
cp -r /tmp/docs_build/* ./${{ env.RELEASE_VERSION }}
6870
rm -rf /tmp/docs_build
@@ -72,6 +74,7 @@ jobs:
7274
ln -sfn ${{ env.RELEASE_VERSION }} latest
7375
fi
7476
git add ./latest ${{ env.RELEASE_VERSION }}
77+
git add index.html
7578
git commit -m "Update documentation" -a || true
7679
- name: Push changes
7780
uses: ad-m/github-push-action@master

.github/workflows/publish.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ jobs:
2424
python -m pip install --upgrade build
2525
- name: Build sdist
2626
run: |
27-
sed -i '/omz_tools/d' src/python/pyproject.toml
2827
python -m build --sdist src/python/
2928
- uses: actions/upload-artifact@v4
3029
with:
3130
name: artifact-sdist
3231
path: src/python/dist/*.tar.gz
3332
- name: Build wheel
3433
run: |
35-
sed -i '/omz_tools/d' src/python/pyproject.toml
3634
python -m build --wheel src/python/
3735
- uses: actions/upload-artifact@v4
3836
with:

README.md

Lines changed: 49 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,38 @@
11
# OpenVINO Model API
22

3-
Model API is a set of wrapper classes for particular tasks and model architectures, simplifying data preprocess and postprocess as well as routine procedures (model loading, asynchronous execution, etc.). It is aimed at simplifying end-to-end model inference for different deployment scenarious, including local execution and serving. The Model API is based on the OpenVINO inference API.
3+
[![PyPI](https://img.shields.io/pypi/v/otx)](https://pypi.org/project/openvino-model-api)
4+
[![Downloads](https://static.pepy.tech/personalized-badge/otx?period=total&units=international_system&left_color=grey&right_color=green&left_text=PyPI%20Downloads)](https://pepy.tech/project/openvino-model-api)
5+
6+
<!-- markdownlint-disable MD042 -->
7+
8+
[![openvino](https://img.shields.io/badge/openvino-2025.0-purple)]()
9+
10+
<!-- markdownlint-enable MD042 -->
11+
12+
[![Pre-Merge Test](https://github.com/open-edge-platform/model_api/actions/workflows/pre_commit.yml/badge.svg)](https://github.com/open-edge-platform/model_api/actions/workflows/pre_commit.yml)
13+
[![Build Docs](https://github.com/open-edge-platform/model_api/actions/workflows/docs.yml/badge.svg)](https://github.com/open-edge-platform/model_api/actions/workflows/docs.yml)
14+
15+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
16+
17+
## Introduction
18+
19+
Model API is a set of wrapper classes for particular tasks and model architectures, simplifying data preprocess and postprocess as well as routine procedures (model loading, asynchronous execution, etc.). It is aimed at simplifying end-to-end model inference for different deployment scenarios, including local execution and serving. The Model API is based on the OpenVINO inference API.
420

521
## How it works
622

723
Model API searches for additional information required for model inference, data, pre/postprocessing, label names, etc. directly in OpenVINO Intermediate Representation. This information is used to prepare the inference data, process and output the inference results in a human-readable format.
824

25+
Currently, ModelAPI supports models trained in [OpenVINO Training Extensions](https://github.com/openvinotoolkit/training_extensions) framework.
26+
Training Extensions embed all the metadata required for inference into model file. For models coming from other than Training Extensions frameworks metadata generation step is required before using ModelAPI.
27+
28+
## Supported model formats
29+
30+
- [OpenVINO IR](https://docs.openvino.ai/2025/documentation/openvino-ir-format.html)
31+
- [ONNX](https://onnx.ai)
32+
933
## Features
1034

1135
- Python and C++ API
12-
- Automatic prefetch of public models from [OpenVINO Model Zoo](https://github.com/openvinotoolkit/open_model_zoo) (Python only)
1336
- Synchronous and asynchronous inference
1437
- Local inference and serving through the rest API (Python only)
1538
- Model preprocessing embedding for faster inference
@@ -18,17 +41,15 @@ Model API searches for additional information required for model inference, data
1841

1942
### Python
2043

21-
- Clone this repository
22-
- Navigate to `model_api/python` folder
23-
- Run `pip install .`
44+
`pip install openvino-model-api`
2445

2546
### C++
2647

2748
- Install dependencies. For installation on Ubuntu, you can use the following script:
2849

2950
```bash
30-
chmod +x model_api/cpp/install_dependencies.sh
31-
sudo model_api/cpp/install_dependencies.sh
51+
chmod +x src/cpp/install_dependencies.sh
52+
sudo src/cpp/install_dependencies.sh
3253
```
3354

3455
- Build library:
@@ -45,44 +66,48 @@ Model API searches for additional information required for model inference, data
4566
cmake ../model_api/cpp -DOpenCV_DIR=<OpenCV cmake dir> -DOpenVINO_DIR=<OpenVINO cmake dir>
4667
```
4768

48-
- Build:
69+
`OpenCV` and `OpenVINO` locations are optional. In most cases, these dependencies are discovered by cmake without extra guidance.
4970

50-
```bash
51-
cmake --build . -j
52-
```
71+
- Build:
72+
73+
```bash
74+
cmake --build . -j
75+
```
5376

54-
- To build a `.tar.gz` package with the library, run:
77+
- To build a `.tar.gz` package with the library, run:
5578

56-
```bash
57-
cmake --build . --target package -j
58-
```
79+
```bash
80+
cmake --build . --target package -j
81+
```
5982

6083
## Usage
6184

6285
### Python
6386

6487
```python
65-
from model_api.models import DetectionModel
88+
from model_api.models import Model
6689

67-
# Create a model (downloaded and cached automatically for OpenVINO Model Zoo models)
68-
# Use URL to work with served model, e.g. "localhost:9000/models/ssdlite_mobilenet_v2"
69-
ssd = DetectionModel.create_model("ssdlite_mobilenet_v2")
90+
# Create a model wrapper from a compatible model generated by OpenVINO Training Extensions
91+
# Use URL to work with OVMS-served model, e.g. "localhost:9000/models/ssdlite_mobilenet_v2"
92+
model = Model.create_model("model.xml")
7093

7194
# Run synchronous inference locally
72-
detections = ssd(image) # image is numpy.ndarray
95+
result = model(image) # image is numpy.ndarray
7396

74-
# Print the list of Detection objects with box coordinates, confidence and label string
75-
print(f"Detection results: {detections}")
97+
# Print results in model-specific format
98+
print(f"Inference result: {result}")
7699
```
77100

78101
### C++
79102

103+
In C++ we have to specify model type in advance, let's set it to detection model.
104+
80105
```cpp
81106
#include <models/detection_model.h>
82107
#include <models/results.h>
83108

84-
// Load the model fetched using Python API
85-
auto model = DetectionModel::create_model("~/.cache/omz/public/ssdlite_mobilenet_v2/FP16/ssdlite_mobilenet_v2.xml");
109+
// Load the model
110+
auto model = Model::create_model("model.xml");
86111

87112
// Run synchronous inference locally
88113
auto result = model->infer(image); // image is cv::Mat
@@ -125,41 +150,3 @@ auto model = DetectionModel::create_model(adapter);
125150
```
126151
127152
For more details please refer to the [examples](https://github.com/openvinotoolkit/model_api/tree/master/examples) of this project.
128-
129-
## Supported models
130-
131-
### Python
132-
133-
- Image Classification:
134-
- [OpenVINO Model Zoo models](https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/index.md#classification-models)
135-
- Object Detection:
136-
- [OpenVINO Model Zoo models](https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/index.md#object-detection-models):
137-
- SSD-based models (e.g. "ssdlite_mobilenet_v2", etc.)
138-
- YOLO-based models (e.g. "yolov3", "yolov4", etc.)
139-
- CTPN: "ctpn"
140-
- DETR: "detr-resnet50"
141-
- CenterNet: "ctdet_coco_dlav0_512"
142-
- FaceBoxes: "faceboxes-pytorch"
143-
- RetinaFace: "retinaface-resnet50-pytorch"
144-
- Ultra Lightweight Face Detection: "ultra-lightweight-face-detection-rfb-320" and "ultra-lightweight-face-detection-slim-320"
145-
- NanoDet with ShuffleNetV2: "nanodet-m-1.5x-416"
146-
- NanoDet Plus with ShuffleNetV2: "nanodet-plus-m-1.5x-416"
147-
- Semantic Segmentation:
148-
- [OpenVINO Model Zoo models](https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/index.md#semantic-segmentation-models)
149-
- Instance Segmentation:
150-
- [OpenVINO Model Zoo models](https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/index.md#instance-segmentation-models)
151-
152-
### C++
153-
154-
- Image Classification:
155-
- [OpenVINO Model Zoo models](https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/index.md#classification-models)
156-
- Object Detection:
157-
- SSD-based models (e.g. "ssdlite_mobilenet_v2", etc.)
158-
- YOLO-based models (e.g. "yolov3", "yolov4", etc.)
159-
- CenterNet: "ctdet_coco_dlav0_512"
160-
- FaceBoxes: "faceboxes-pytorch"
161-
- RetinaFace: "retinaface-resnet50-pytorch"
162-
- Semantic Segmentation:
163-
- [OpenVINO Model Zoo models](https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/index.md#semantic-segmentation-models)
164-
165-
[Model configuration](https://github.com/openvinotoolkit/model_api/blob/master/docs/model-configuration.md) discusses possible configurations.

docs/source/conf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
from pathlib import Path
1111

1212
# Define the path to your module using Path
13-
module_path = Path(__file__).parent.parent / "model_api" / "python"
13+
module_path = Path(__file__).parent.parent / "src" / "python"
1414

1515
# Insert the path to sys.path
1616
sys.path.insert(0, str(module_path.resolve()))
1717

18-
project = "InferenceSDK"
19-
copyright = "2024, Intel OpenVINO"
20-
author = "Intel OpenVINO"
21-
release = "2024"
18+
project = "ModelAPI"
19+
copyright = "2025, Intel"
20+
author = "Intel"
21+
release = "2025"
2222

2323
# -- General configuration ---------------------------------------------------
2424
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

docs/source/cpp/models/anomaly_model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Anomaly Model
22

3-
The `AnomalyModel` is a generic OpenVINO model that aims to provide a single interface for all the exported models based on [Anomalib](https://github.com/openvinotoolkit/anomalib).
3+
The `AnomalyModel` is a generic OpenVINO model that aims to provide a single interface for all the exported models based on [Anomalib](https://github.com/open-edge-platform/anomalib).
44

55
Currently, the `AnomalyModel` supports the following models:
66

docs/source/python/models/anomaly.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Anomaly
22

3-
The `AnomalyModel` is a generic OpenVINO model that aims to provide a single interface for all the exported models based on [Anomalib](https://github.com/openvinotoolkit/anomalib).
3+
The `AnomalyModel` is a generic OpenVINO model that aims to provide a single interface for all the exported models based on [Anomalib](https://github.com/open-edge-platform/anomalib).
44

55
Currently, the `AnomalyModel` supports the following models:
66

src/python/docs/visual_prompting.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ Decoder OV model should have the following named inputs:
5858

5959
## How to use
6060

61-
See demos: [VPT](https://github.com/openvinotoolkit/model_api/tree/master/examples/python/visual_prompting)
62-
and [ZSL-VPT](https://github.com/openvinotoolkit/model_api/tree/master/examples/python/zsl_visual_prompting)
61+
See demos: [VPT](https://github.com/open-edge-platform/model_api/tree/master/examples/python/visual_prompting)
62+
and [ZSL-VPT](https://github.com/open-edge-platform/model_api/tree/master/examples/python/zsl_visual_prompting)

src/python/model_api/adapters/openvino_adapter.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -171,21 +171,8 @@ def __init__(
171171
)
172172
self.model = core.read_model(self.model_path, weights_path)
173173
return
174-
if isinstance(model, str):
175-
from omz_tools.models import OMZModel, list_models
176-
177-
if model in list_models():
178-
omz_model = OMZModel.download(
179-
model,
180-
precision=precision,
181-
download_dir=download_dir,
182-
cache_dir=cache_dir,
183-
)
184-
self.model_path = omz_model.model_path
185-
log.info(f"Reading model {self.model_path}")
186-
self.model = core.read_model(self.model_path)
187-
return
188-
msg = "Model must be bytes, a file or existing OMZ model name"
174+
175+
msg = "Model must be bytes or a file"
189176
raise RuntimeError(msg)
190177

191178
def load_model(self) -> None:

src/python/pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ dependencies = [
2828
"opencv-python-headless",
2929
"scipy>=1.5.4",
3030
"openvino>=2025.0",
31-
"omz_tools @ git+https://github.com/openvinotoolkit/open_model_zoo.git@master#egg=omz_tools&subdirectory=tools/model_tools",
3231
"pillow",
3332
]
3433

@@ -63,9 +62,9 @@ build = [
6362
full = ["openvino_model_api[dependencies, ovms, tests, docs, build]"]
6463

6564
[project.urls]
66-
Homepage = "https://github.com/openvinotoolkit/model_api"
67-
Documentation = "https://github.com/openvinotoolkit/model_api/blob/master/README.md"
68-
Repository = "https://github.com/openvinotoolkit/model_api.git"
65+
Homepage = "https://github.com/open-edge-platform/model_api"
66+
Documentation = "https://github.com/open-edge-platform/model_api/blob/master/README.md"
67+
Repository = "https://github.com/open-edge-platform/model_api.git"
6968

7069
[tool.setuptools.packages.find]
7170
include = ["model_api*"]

0 commit comments

Comments
 (0)