Skip to content

Commit a4aa781

Browse files
OVEP documentation changes for python and C# samples (#268)
1 parent 7b7ffe3 commit a4aa781

File tree

7 files changed

+17
-37
lines changed

7 files changed

+17
-37
lines changed

c_sharp/OpenVINO_EP/yolov3_object_detection/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The source code for this sample is available [here](https://github.com/microsoft
99
# How to build
1010

1111
## Prerequisites
12-
1. Install [.NET 5.0](https://dotnet.microsoft.com/download/dotnet/5.0) or higher and download nuget for your OS (Mac, Windows or Linux). Refer [here](https://onnxruntime.ai/docs/build/inferencing.html#prerequisites-1).
12+
1. Install [.NET 7.0](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) or higher and download nuget for your OS (Mac, Windows or Linux). Refer [here](https://onnxruntime.ai/docs/build/inferencing.html#prerequisites-1).
1313
2. [The Intel<sup>®</sup> Distribution of OpenVINO toolkit](https://docs.openvinotoolkit.org/latest/index.html)
1414
3. Use any sample Image as input to the sample.
1515
4. Download the latest YOLOv3 model from the ONNX Model Zoo.

python/OpenVINO_EP/tiny_yolo_v2_object_detection/README.md

+3-12
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ The source code for this sample is available [here](https://github.com/microsoft
99
# How to build
1010

1111
## Prerequisites
12-
1. For Windows, [download OpenVINO package](https://storage.openvinotoolkit.org/repositories/openvino/packages) select appropriate OpenVINO version, windows os and extract it. Run setupvars.bat file which is in the root directory of the extracted OpenVINO package to add OpenVINO libraries to PATH.
13-
2. Download the latest tinyYOLOv2 model from the ONNX Model Zoo.
12+
1. Download the latest tinyYOLOv2 model from the ONNX Model Zoo.
1413
This model was adapted from [ONNX Model Zoo](https://github.com/onnx/models).Download the latest version of the [tinyYOLOv2](https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/tiny-yolov2) model from here.
1514

1615
## Install ONNX Runtime for OpenVINO™ Execution Provider
17-
Please install the onnxruntime-openvino python package from [here](https://pypi.org/project/onnxruntime-openvino/1.11.0/). The package for Linux contains prebuilt OpenVINO Libs with ABI 0.
16+
Please install the onnxruntime-openvino python package from [here](https://pypi.org/project/onnxruntime-openvino). The package for Linux contains prebuilt OpenVINO Libs with ABI 0.
1817
```
19-
pip3 install onnxruntime-openvino
18+
pip3 install onnxruntime-openvino openvino
2019
```
2120

2221
## Optional Build steps for ONNX Runtime
@@ -48,14 +47,6 @@ python3 tiny_yolov2_obj_detection_sample.py --h
4847
```bash
4948
python3 tiny_yolov2_obj_detection_sample.py --video face-demographics-walking-and-pause.mp4 --model tinyyolov2.onnx --device CPU_FP32
5049
```
51-
Note: Make sure the sample is having below lines to use OpenVINO™ in Windows
52-
```
53-
import platform
54-
55-
if platform.system() == "Windows":
56-
from openvino import utils
57-
utils.add_openvino_libs_to_path()
58-
```
5950

6051
## To stop the sample from running
6152
```bash
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
certifi==2022.5.18.1
22
flatbuffers==2.0
3-
numpy==1.22.4
4-
onnx==1.11.0
3+
onnx
54
opencv-python==4.5.5.64
65
Pillow==9.3.0
7-
protobuf==4.21.6
6+
protobuf==3.19.0
87
scipy==1.7.3
98
typing-extensions==4.2.0

python/OpenVINO_EP/tiny_yolo_v2_object_detection/tiny_yolov2_obj_detection_sample.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import platform
1313

1414
if platform.system() == "Windows":
15-
from openvino import utils
15+
import onnxruntime.tools.add_openvino_win_libs as utils
1616
utils.add_openvino_libs_to_path()
1717

1818
# color look up table for different classes for object detection sample
@@ -29,7 +29,7 @@
2929

3030
def parse_arguments():
3131
parser = argparse.ArgumentParser(description='Object Detection using YOLOv2 in OPENCV using OpenVINO Execution Provider for ONNXRuntime')
32-
parser.add_argument('--device', default='CPU_FP32', help="Device to perform inference on 'cpu (MLAS)' or on devices supported by OpenVINO-EP [CPU_FP32, GPU_FP32, GPU_FP16, MYRIAD_FP16, VAD-M_FP16].")
32+
parser.add_argument('--device', default='CPU_FP32', help="Device to perform inference on 'cpu (MLAS)' or on devices supported by OpenVINO-EP [CPU_FP32, CPU_FP32, GPU_FP32, GPU_FP16].")
3333
parser.add_argument('--video', help='Path to video file.')
3434
parser.add_argument('--model', help='Path to model.')
3535
args = parser.parse_args()
@@ -150,16 +150,16 @@ def main():
150150
print("Device type selected is 'cpu' which is the default CPU Execution Provider (MLAS)")
151151
#Specify the path to the ONNX model on your machine and register the CPU EP
152152
sess = rt.InferenceSession(args.model, so, providers=['CPUExecutionProvider'])
153-
elif (args.device == 'CPU_FP32' or args.device == 'GPU_FP32' or args.device == 'GPU_FP16' or args.device == 'MYRIAD_FP16' or args.device == 'VADM_FP16'):
153+
elif (args.device == 'CPU_FP32', args.device == 'CPU_FP16' or args.device == 'GPU_FP32' or args.device == 'GPU_FP16'):
154154
#Specify the path to the ONNX model on your machine and register the OpenVINO EP
155155
sess = rt.InferenceSession(args.model, so, providers=['OpenVINOExecutionProvider'], provider_options=[{'device_type' : args.device}])
156156
print("Device type selected is: " + args.device + " using the OpenVINO Execution Provider")
157157
'''
158158
other 'device_type' options are: (Any hardware target can be assigned if you have the access to it)
159-
'CPU_FP32', 'GPU_FP32', 'GPU_FP16', 'MYRIAD_FP16', 'VAD-M_FP16'
159+
'CPU_FP32', 'CPU_FP16', 'GPU_FP32', 'GPU_FP16'
160160
'''
161161
else:
162-
raise Exception("Device type selected is not [cpu, CPU_FP32, GPU_FP32, GPU_FP16, MYRIAD_FP16, VADM_FP16]")
162+
raise Exception("Device type selected is not [cpu, CPU_FP32, GPU_FP32, GPU_FP16]")
163163

164164
# Get the input name of the model
165165
input_name = sess.get_inputs()[0].name

python/OpenVINO_EP/yolov4_object_detection/README.md

+3-12
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ The source code for this sample is available [here](https://github.com/microsoft
1616
# How to build
1717

1818
## Prerequisites
19-
1. For Windows, [download OpenVINO package](https://storage.openvinotoolkit.org/repositories/openvino/packages) select appropriate version, windows os and extract it. Run setupvars.bat file which is in the root directory of the extracted OpenVINO package to add OpenVINO libraries to PATH.
20-
2. Download the latest version of the [YOLOv4](https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/yolov4) model from here.
19+
1. Download the latest version of the [YOLOv4](https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/yolov4) model from here.
2120

2221
## Install ONNX Runtime for OpenVINO™ Execution Provider
23-
Please install the onnxruntime-openvino python package from [here](https://pypi.org/project/onnxruntime-openvino/1.11.0/). The package for Linux contains prebuilt OpenVINO Libs with ABI 0.
22+
Please install the onnxruntime-openvino python package from [here](https://pypi.org/project/onnxruntime-openvino). The package for Linux contains prebuilt OpenVINO Libs with ABI 0.
2423
```
25-
pip3 install onnxruntime-openvino
24+
pip3 install onnxruntime-openvino openvino
2625
```
2726

2827
## Optional Build steps for ONNX Runtime
@@ -59,14 +58,6 @@ python3 yolov4.py --device CPU_FP32 --video classroom.mp4 --model yolov4.onnx
5958
```
6059
Note:
6160
* You can pick different device options to run on OpenVINO™ Execution Provider like GPU_FP32, GPU_FP16 and MYRIAD_FP16.
62-
* Make sure the sample is having below lines to use OpenVINO™ in Windows
63-
```
64-
import platform
65-
66-
if platform.system() == "Windows":
67-
from openvino import utils
68-
utils.add_openvino_libs_to_path()
69-
```
7061

7162
### Run the sample on default CPU Execution Provider (MLAS)
7263
```bash
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
certifi==2022.5.18.1
22
flatbuffers==2.0
3-
numpy==1.22.4
4-
onnx==1.11.0
3+
onnx
54
opencv-python==4.5.5.64
65
Pillow==9.3.0
7-
protobuf==4.21.6
6+
protobuf==3.19.0
87
scipy==1.7.3
98
typing-extensions==4.2.0

python/OpenVINO_EP/yolov4_object_detection/yolov4.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import platform
2222

2323
if platform.system() == "Windows":
24-
from openvino import utils
24+
import onnxruntime.tools.add_openvino_win_libs as utils
2525
utils.add_openvino_libs_to_path()
2626

2727
def image_preprocess(image, target_size, gt_boxes=None):

0 commit comments

Comments
 (0)