Skip to content

Commit 715f645

Browse files
authored
Merge branch 'openvinotoolkit:master' into master
2 parents fb754b4 + ea4305d commit 715f645

File tree

530 files changed

+98958
-218795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

530 files changed

+98958
-218795
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ File | Destination
4646
configuration file | `models/public/<model_name>/model.yml`
4747
documentation file | `models/public/<model_name>/README.md`
4848
validation configuration file|`models/public/<model_name>/accuracy-check.yml`
49-
demo|`demos/<demo_name>`<br>or<br>`demos/python_demos/<demo_name>`
49+
demo|`demos/<demo_name>/<language>/`
5050

5151
### Tests
5252

@@ -185,22 +185,19 @@ Deep Learning Inference Engine (IE) supports models in the Intermediate Represen
185185
186186
## Demo
187187

188-
A demo shows the main idea of how to infer a model using IE. If your model solves one of the tasks supported by the Open Model Zoo, try to find an appropriate option from [demos](demos/README.md) or [samples](https://docs.openvino.ai/latest/_docs_IE_DG_Samples_Overview.html). Otherwise, you must provide your own demo (C++ or Python).
188+
A demo shows the main idea of how to infer a model using OpenVINO™. If your model solves one of the tasks supported by the Open Model Zoo, try to find an appropriate option from [demos](demos/README.md) or [samples](https://docs.openvino.ai/latest/_docs_IE_DG_Samples_Overview.html). Otherwise, you must provide your own demo (C++ or Python).
189189

190190
The demo's name should end with `_demo` suffix to follow the convention of the project.
191191

192-
Demos are required to support the following keys:
192+
Demos are required to support the following args:
193193

194-
- `-i "<input>"`: Required. An input to process. The input can usually be a single image, a folder of images or anything that OpenCV's `VideoCapture` can process.
195-
- `-m "<path>"`: Required. Path to an .xml file with a trained model. If the demo uses several models at the same time, use other keys prefixed with `-m_`.
196-
- `-d "<device>"`: Optional. Specifies a target device to infer on. CPU, GPU, HDDL or MYRIAD is acceptable. Default must be CPU. If the demo uses several models at the same time, use keys prefixed with `d_` (just like keys `m_*` above) to specify device for each model.
197-
- `-no_show`: Optional. Do not visualize inference results.
194+
* `-h, --help` show this help message and exit
195+
* `-m <MODEL FILE>` path to an .xml file with a trained model. If the demo uses several models an extended syntax can be used, like `--mdet`
196+
* `-i <INPUT>` input to process. For vision tasks the input might be a path to single image or video file, a path to folder of images, or numeric camera id. For vision tasks the default value must be `0`. For speech/audio tasks input is path to WAV file. For NLP tasks input might be a path to text file or just quoted sentence of text.
197+
* `-d <DEVICE>` specify a device to infer on (the list of available devices is shown below). Default is CPU
198+
* `-o <FILE PATTERN>` pattern for output file(s) to save
198199

199-
> **TIP**: For Python, it is preferable to use `--` instead of `-` for long keys.
200-
201-
You can also add any other necessary parameters.
202-
203-
Add `README.md` file, which describes demo usage. Update [demos' README.md](demos/README.md) adding your demo to the list.
200+
Add `README.md` file, which describes demo usage. Update [demos' README.md](demos/README.md) by adding your demo to the list.
204201

205202
## Accuracy Validation
206203

ci/dependencies.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
openvino_linux: '2022.1.0.518'
2-
openvino_windows: '2022.1.0.518'
3-
wheel_linux: '2022.1.0.dev20220117-6152'
4-
wheel_windows: '2022.1.0.dev20220117-6152'
1+
opencv_linux: '2022.1.0.dev20220131'
2+
opencv_windows: '2022.1.0.dev20220131'
3+
openvino_linux: '2022.1.0.dev20220131'
4+
openvino_windows: '2022.1.0.dev20220131'
5+
wheel_linux: '2022.1.0.dev20220131-6386'
6+
wheel_windows: '2022.1.0.dev20220131-6386'

ci/prepare-documentation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@ def main():
377377

378378
add_demos_pages(output_root, navindex_element)
379379

380+
ovms_adapter_element = add_page(output_root, navindex_element, id='omz_model_api_ovms_adapter',
381+
path='demos/common/python/openvino/model_zoo/model_api/adapters/ovms_adapter.md',
382+
title='OMZ Model API OVMS adapter')
383+
ovms_adapter_element.attrib[XML_ID_ATTRIBUTE] = 'omz_model_api_ovms_adapter'
384+
380385
for md_path in all_md_paths:
381386
if md_path not in documentation_md_paths:
382387
raise RuntimeError(f'{all_md_paths[md_path]}: '

ci/requirements-conversion.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ onnx==1.10.1
8787
# -r tools/model_tools/requirements-pytorch.in
8888
opt-einsum==3.3.0
8989
# via tensorflow
90-
paddlepaddle==2.1.3
90+
paddlepaddle==2.2.0
9191
# via
9292
# -r tools/model_tools/requirements-paddle.in
9393
pillow==8.3.2

ci/requirements-demos.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ xmltodict==0.12.0
154154
# via motmetrics
155155
zipp==3.5.0
156156
# via importlib-metadata
157+
inflect==5.3.0
157158

158159
# The following packages are considered to be unsafe in a requirements file:
159160
# setuptools

ci/requirements-downloader.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ idna==3.2
88
# via requests
99
openvino-telemetry==2022.1.0
1010
# via -r tools/model_tools/requirements.in
11-
pyrx==0.3.0
12-
# via -r tools/model_tools/requirements.in
1311
pyyaml==5.4.1
1412
# via -r tools/model_tools/requirements.in
1513
requests==2.26.0

data/dataset_definitions.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ datasets:
1212
- name: ms_coco_mask_rcnn_short_80_classes
1313
annotation_conversion:
1414
converter: mscoco_mask_rcnn
15-
annotation_file: annotations/instances_val2017_short.json
15+
annotation_file: annotations/instances_val2017.json
1616
has_background: True
1717
sort_annotations: True
18-
annotation: mscoco_mask_rcnn_short_80.pickle
19-
dataset_meta: mscoco_mask_rcnn_short_80.json
18+
annotation: mscoco_mask_rcnn_80.pickle
19+
dataset_meta: mscoco_mask_rcnn_80.json
2020
data_source: val2017
2121

2222
- name: ms_coco_mask_rcnn_short_80_classes_without_background
@@ -25,19 +25,19 @@ datasets:
2525
annotation_file: annotations/instances_val2017.json
2626
has_background: False
2727
sort_annotations: True
28-
annotation: mscoco_mask_rcnn_short_80_without_bkgr.pickle
29-
dataset_meta: mscoco_mask_rcnn_short_80_without_bkgr.json
28+
annotation: mscoco_mask_rcnn_80_without_bkgr.pickle
29+
dataset_meta: mscoco_mask_rcnn_80_without_bkgr.json
3030
data_source: val2017
3131

3232
- name: ms_coco_mask_rcnn_short_91_classes
3333
annotation_conversion:
3434
converter: mscoco_mask_rcnn
35-
annotation_file: annotations/instances_val2017_short.json
35+
annotation_file: annotations/instances_val2017.json
3636
has_background: True
3737
sort_annotations: True
3838
use_full_label_map: True
39-
annotation: mscoco_mask_rcnn_short_91.pickle
40-
dataset_meta: mscoco_mask_rcnn_short_91.json
39+
annotation: mscoco_mask_rcnn_91.pickle
40+
dataset_meta: mscoco_mask_rcnn_91.json
4141
data_source: val2017
4242
preprocessing:
4343
- type: resize
@@ -1437,3 +1437,12 @@ datasets:
14371437
data_dir: LIVE_1
14381438
input_suffix: .bmp
14391439
target_suffix: .bmp
1440+
1441+
- name: online_mstcn_plus_dataset
1442+
data_source: annotation
1443+
reader: numpy_dict_reader
1444+
annotation_conversion:
1445+
converter: multi_feature_regression
1446+
data_dir: annotation
1447+
input_suffix: in
1448+
reference_suffix: out

demos/3d_segmentation_demo/python/3d_segmentation_demo.py

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
"""
3-
Copyright (c) 2019 Intel Corporation
3+
Copyright (c) 2019-2022 Intel Corporation
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
2828
from fnmatch import fnmatch
2929
from scipy.ndimage import interpolation
3030

31-
from openvino.inference_engine import IECore, get_version
31+
from openvino.runtime import Core, get_version, PartialShape
3232

3333

3434
log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.DEBUG, stream=sys.stdout)
@@ -248,48 +248,41 @@ def main():
248248
# --------------------------------- 1. Load Plugin for inference engine ---------------------------------
249249
log.info('OpenVINO Inference Engine')
250250
log.info('\tbuild: {}'.format(get_version()))
251-
ie = IECore()
251+
core = Core()
252252

253253
if 'CPU' in args.target_device:
254254
if args.path_to_extension:
255-
ie.add_extension(args.path_to_extension, "CPU")
255+
core.add_extension(args.path_to_extension, "CPU")
256256
if args.number_threads is not None:
257-
ie.set_config({'CPU_THREADS_NUM': str(args.number_threads)}, "CPU")
257+
core.set_config({'CPU_THREADS_NUM': str(args.number_threads)}, "CPU")
258258
elif 'GPU' in args.target_device:
259259
if args.path_to_cldnn_config:
260-
ie.set_config({'CONFIG_FILE': args.path_to_cldnn_config}, "GPU")
260+
core.set_config({'CONFIG_FILE': args.path_to_cldnn_config}, "GPU")
261261
else:
262262
raise AttributeError("Device {} do not support of 3D convolution. "
263263
"Please use CPU, GPU or HETERO:*CPU*, HETERO:*GPU*")
264264

265265
# --------------------- 2. Read IR Generated by ModelOptimizer (.xml and .bin files) ---------------------
266266
log.info('Reading model {}'.format(args.path_to_model))
267-
ie_network = ie.read_network(args.path_to_model, os.path.splitext(args.path_to_model)[0] + '.bin')
267+
model = core.read_model(args.path_to_model)
268268

269-
input_info = ie_network.input_info
270-
if len(input_info) == 0:
271-
raise AttributeError('No inputs info is provided')
272-
elif len(input_info) != 1:
273-
raise AttributeError("only one input layer network is supported")
274-
275-
input_name = next(iter(input_info))
276-
out_name = next(iter(ie_network.outputs))
269+
if len(model.inputs) != 1:
270+
raise RuntimeError("only 1 input layer model is supported")
277271

272+
input_tensor_name = model.inputs[0].get_any_name()
278273
if args.shape:
279-
log.debug("Reshape model from {} to {}".format(input_info[input_name].input_data.shape, args.shape))
280-
ie_network.reshape({input_name: args.shape})
281-
input_info = ie_network.input_info
274+
log.debug("Reshape model from {} to {}".format(model.inputs[0].shape, args.shape))
275+
model.reshape({input_tensor_name: PartialShape(args.shape)})
282276

283-
if len(input_info[input_name].input_data.shape) != 5:
284-
raise AttributeError("Incorrect shape {} for 3d convolution network".format(args.shape))
277+
if len(model.inputs[0].shape) != 5:
278+
raise RuntimeError("Incorrect shape {} for 3d convolution network".format(args.shape))
285279

286-
n, c, d, h, w = input_info[input_name].input_data.shape
287-
ie_network.batch_size = n
280+
n, c, d, h, w = model.inputs[0].shape
288281

289282
# ------------------------------------ 3. Loading model to the plugin -------------------------------------
290-
executable_network = ie.load_network(network=ie_network, device_name=args.target_device)
283+
compiled_model = core.compile_model(model, args.target_device)
284+
infer_request = compiled_model.create_infer_request()
291285
log.info('The model {} is loaded to {}'.format(args.path_to_model, args.target_device))
292-
del ie_network
293286

294287
# --------------------------------------- 4. Preparing input data -----------------------------------------
295288
start_time = perf_counter()
@@ -319,12 +312,10 @@ def main():
319312
original_data = data_crop
320313
original_size = original_data.shape[-3:]
321314

322-
test_im = {input_name: data_crop}
323-
324315
# ---------------------------------------------- 5. Do inference --------------------------------------------
325-
res = executable_network.infer(test_im)
316+
result = infer_request.infer({input_tensor_name: data_crop})
326317
# ---------------------------- 6. Processing of the received inference results ------------------------------
327-
result = res[out_name]
318+
result = next(iter(result.values()))
328319
batch, channels, out_d, out_h, out_w = result.shape
329320

330321
list_img = []
@@ -397,4 +388,4 @@ def main():
397388
log.debug("Result nifti file was saved to {}".format(nii_filename))
398389

399390
if __name__ == "__main__":
400-
main()
391+
sys.exit(main() or 0)

demos/3d_segmentation_demo/python/requirements.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

demos/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The Open Model Zoo includes the following demos:
1212
- [3D Segmentation Python\* Demo](./3d_segmentation_demo/python/README.md) - Segmentation demo segments 3D images using 3D convolutional networks.
1313
- [Action Recognition Python\* Demo](./action_recognition_demo/python/README.md) - Demo application for Action Recognition algorithm, which classifies actions that are being performed on input video.
1414
- [Background Subtraction Python\* Demo](./background_subtraction_demo/python/README.md) - Background subtraction using instance segmentation based models.
15+
- [Background Subtraction C++ G-API\* Demo](./background_subtraction_demo/cpp_gapi/README.md) - Background subtraction G-API version.
1516
- [BERT Named Entity Recognition Python\* Demo](./bert_named_entity_recognition_demo/python/README.md) - NER Demo application that uses a CONLL2003-tuned BERT model for inference.
1617
- [BERT Question Answering Python\* Demo](./bert_question_answering_demo/python/README.md)
1718
- [BERT Question Answering Embedding Python\* Demo](./bert_question_answering_embedding_demo/python/README.md) - The demo demonstrates how to run BERT based models for question answering task.

0 commit comments

Comments
 (0)