Skip to content

Commit 75241ee

Browse files
authored
Move to newer OMZ (#163)
* Move to newer OMZ After this is merged It will be required to release model_api 0.2.0 only after openvino 2024.0 because model_api is going to import OMZ using a new namespace * Replace ssd300 * Remove mobilenet-v3-large-1.0-224-tf * Test mobilenet-v3-large-1.0-224-tf * Replace ssd300 * black * Update ref * Update ref * Align README.md
1 parent 0fabd7d commit 75241ee

File tree

8 files changed

+16
-30
lines changed

8 files changed

+16
-30
lines changed

.github/workflows/test_precommit.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,8 @@ jobs:
149149
fail-fast: false
150150
matrix:
151151
os: [ubuntu-20.04, ubuntu-22.04, macos-12]
152-
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
152+
python-version: [3.8, 3.9, '3.10', '3.11']
153153
exclude:
154-
- os: macos-12
155-
python-version: 3.7
156154
- os: macos-12
157155
python-version: 3.9
158156
- os: macos-12

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Model API searches for additional information required for model inference, data
4747
from openvino.model_api.models import DetectionModel
4848

4949
# Create a model (downloaded and cached automatically for OpenVINO Model Zoo models)
50-
# Use URL to work with served model, e.g. "localhost:9000/models/ssd300"
51-
ssd = DetectionModel.create_model("ssd300")
50+
# Use URL to work with served model, e.g. "localhost:9000/models/ssdlite_mobilenet_v2"
51+
ssd = DetectionModel.create_model("ssdlite_mobilenet_v2")
5252

5353
# Run synchronous inference locally
5454
detections = ssd(image) # image is numpy.ndarray
@@ -63,7 +63,7 @@ print(f"Detection results: {detections}")
6363
#include <models/results.h>
6464

6565
// Load the model fetched using Python API
66-
auto model = DetectionModel::create_model("~/.cache/omz/public/ssd300/FP16/ssd300.xml");
66+
auto model = DetectionModel::create_model("~/.cache/omz/public/ssdlite_mobilenet_v2/FP16/ssdlite_mobilenet_v2.xml");
6767

6868
// Run synchronous inference locally
6969
auto result = model->infer(image); // image is cv::Mat
@@ -81,13 +81,13 @@ Model's static method `create_model()` has two overloads. One constructs the mod
8181
There are usecases when it is not possible to modify an internal `ov::Model` and it is hidden behind `InferenceAdapter`. For example the model can be served using [OVMS](https://github.com/openvinotoolkit/model_server). `create_model()` can construct a model from a given `InferenceAdapter`. That approach assumes that the model in `InferenceAdapter` was already configured by `create_model()` called with a string (a path or a model name). It is possible to prepare such model using C++ or Python:
8282
C++
8383
```Cpp
84-
auto model = DetectionModel::create_model("~/.cache/omz/public/ssd300/FP16/ssd300.xml");
84+
auto model = DetectionModel::create_model("~/.cache/omz/public/ssdlite_mobilenet_v2/FP16/ssdlite_mobilenet_v2.xml");
8585
const std::shared_ptr<ov::Model>& ov_model = model->getModel();
8686
ov::serialize(ov_model, "serialized.xml");
8787
```
8888
Python
8989
```python
90-
model = DetectionModel.create_model("~/.cache/omz/public/ssd300/FP16/ssd300.xml")
90+
model = DetectionModel.create_model("~/.cache/omz/public/ssdlite_mobilenet_v2/FP16/ssdlite_mobilenet_v2.xml")
9191
model.save("serialized.xml")
9292
```
9393
After that the model can be constructed from `InferenceAdapter`:
@@ -107,7 +107,7 @@ For more details please refer to the [examples](https://github.com/openvinotoolk
107107
- [OpenVINO Model Zoo models](https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/index.md#classification-models)
108108
- Object Detection:
109109
- [OpenVINO Model Zoo models](https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/index.md#object-detection-models):
110-
- SSD-based models (e.g. "ssd300", "ssdlite_mobilenet_v2", etc.)
110+
- SSD-based models (e.g. "ssdlite_mobilenet_v2", etc.)
111111
- YOLO-based models (e.g. "yolov3", "yolov4", etc.)
112112
- CTPN: "ctpn"
113113
- DETR: "detr-resnet50"
@@ -127,7 +127,7 @@ For more details please refer to the [examples](https://github.com/openvinotoolk
127127
- Image Classification:
128128
- [OpenVINO Model Zoo models](https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/index.md#classification-models)
129129
- Object Detection:
130-
- SSD-based models (e.g. "ssd300", "ssdlite_mobilenet_v2", etc.)
130+
- SSD-based models (e.g. "ssdlite_mobilenet_v2", etc.)
131131
- YOLO-based models (e.g. "yolov3", "yolov4", etc.)
132132
- CenterNet: "ctdet_coco_dlav0_512"
133133
- FaceBoxes: "faceboxes-pytorch"

examples/python/synchronous_api/run.py

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import sys
1919

2020
import cv2
21-
import openvino.runtime as ov
2221
from openvino.model_api.models import (
2322
ClassificationModel,
2423
DetectionModel,

model_api/python/openvino/model_api/adapters/openvino_adapter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def __init__(
185185
self.model = core.read_model(self.model_path, weights_path)
186186
return
187187
if isinstance(model, str):
188-
from openvino.model_zoo.models import OMZModel, list_models
188+
from omz_tools.models import OMZModel, list_models
189189

190190
if model in list_models():
191191
omz_model = OMZModel.download(

model_api/python/requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
numpy>=1.16.6
22
opencv-python
33
scipy>=1.5.4
4-
openvino>=2023.0.0
4+
# TODO: set 2024.0 after the release
5+
openvino>=2023.3
56
openvino-dev>=2023.0.0
7+
omz_tools @ git+https://github.com/openvinotoolkit/open_model_zoo.git@master#egg=omz_tools&subdirectory=tools/model_tools

tests/cpp/precommit/public_scope.json

-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
[
2-
{
3-
"name": "ssd300",
4-
"type": "DetectionModel"
5-
},
62
{
73
"name": "ssd_mobilenet_v1_fpn_coco",
84
"type": "DetectionModel"

tests/python/accuracy/public_scope.json

+2-12
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,6 @@
7070
}
7171
]
7272
},
73-
{
74-
"name": "ssd300",
75-
"type": "DetectionModel",
76-
"test_data": [
77-
{
78-
"image": "coco128/images/train2017/000000000074.jpg",
79-
"reference": ["0, 13, 169, 338, 2 (bicycle): 0.870; 58, 275, 360, 384, 12 (dog): 0.998; 324, 98, 344, 148, 15 (person): 0.652; [0]; [0]"]
80-
}
81-
]
82-
},
8373
{
8474
"name": "ssd_mobilenet_v1_fpn_coco",
8575
"type": "DetectionModel",
@@ -142,12 +132,12 @@
142132
]
143133
},
144134
{
145-
"name": "se-resnext-50",
135+
"name": "mobilenet-v3-large-1.0-224-tf",
146136
"type": "ClassificationModel",
147137
"test_data": [
148138
{
149139
"image": "coco128/images/train2017/000000000074.jpg",
150-
"reference": ["175 (Labrador_retriever): 0.616, [0], [0], [0]"]
140+
"reference": ["208 (Labrador_retriever): 0.166, [0], [0], [0]"]
151141
}
152142
]
153143
},

tests/python/precommit/test_save.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
def test_detector_save(tmp_path):
55
downloaded = Model.create_model(
6-
"ssd300", configuration={"mean_values": [0, 0, 0], "confidence_threshold": 0.6}
6+
"ssd_mobilenet_v1_fpn_coco",
7+
configuration={"mean_values": [0, 0, 0], "confidence_threshold": 0.6},
78
)
89
assert True == downloaded.get_model().get_rt_info(
910
["model_info", "embedded_processing"]

0 commit comments

Comments
 (0)