Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion c_sharp/OpenVINO_EP/yolov3_object_detection/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static void Main(string[] args)
// Session Options
SessionOptions options = new SessionOptions();
options.LogSeverityLevel = OrtLoggingLevel.ORT_LOGGING_LEVEL_INFO;
options.AppendExecutionProvider_OpenVINO(@"MYRIAD_FP16");
options.AppendExecutionProvider_OpenVINO(@"CPU_FP32");
options.AppendExecutionProvider_CPU(1);

// Run inference
Expand Down
2 changes: 1 addition & 1 deletion c_sharp/OpenVINO_EP/yolov3_object_detection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

1. The object detection sample uses YOLOv3 Deep Learning ONNX Model from the ONNX Model Zoo.

2. The sample involves presenting an image to the ONNX Runtime (RT), which uses the OpenVINO Execution Provider for ONNX RT to run inference on Intel<sup>®</sup> NCS2 stick (MYRIADX device). The sample uses ImageSharp for image processing and ONNX Runtime OpenVINO EP for inference.
2. The sample involves presenting an image to the ONNX Runtime (RT), which uses the OpenVINO Execution Provider for ONNX RT to run inference on Intel<sup>®</sup> CPU. The sample uses ImageSharp for image processing and ONNX Runtime OpenVINO EP for inference.

The source code for this sample is available [here](https://github.com/microsoft/onnxruntime-inference-examples/tree/main/c_sharp/OpenVINO_EP/yolov3_object_detection).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
certifi==2022.5.18.1
flatbuffers==2.0
numpy==1.22.4
onnx==1.11.0
numpy==1.23.5
onnx==1.13.0
opencv-python==4.5.5.64
Pillow==9.3.0
protobuf==4.21.6
scipy==1.7.3
protobuf==3.20.2
scipy==1.9.0
typing-extensions==4.2.0
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ def postprocess_output(out, frame, x_scale, y_scale, i):

def show_bbox(device, frame, inference_time):
cv2.putText(frame,device,(10,20),cv2.FONT_HERSHEY_COMPLEX,0.5,(255,255,255),1)
cv2.putText(frame,'FPS: {}'.format(1.0/inference_time),(10,40),cv2.FONT_HERSHEY_COMPLEX,0.5,(255,255,255),1)
if (inference_time!=0):
cv2.putText(frame,'FPS: {}'.format(1.0/inference_time),(10,40),cv2.FONT_HERSHEY_COMPLEX,0.5,(255,255,255),1)
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
cv2.imshow('frame',frame)

Expand All @@ -150,16 +151,16 @@ def main():
print("Device type selected is 'cpu' which is the default CPU Execution Provider (MLAS)")
#Specify the path to the ONNX model on your machine and register the CPU EP
sess = rt.InferenceSession(args.model, so, providers=['CPUExecutionProvider'])
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'):
elif (args.device == 'CPU_FP32' or args.device == 'CPU_FP16' or args.device == 'GPU_FP32' or args.device == 'GPU_FP16' or args.device == 'MYRIAD_FP16' or args.device == 'VADM_FP16'):
#Specify the path to the ONNX model on your machine and register the OpenVINO EP
sess = rt.InferenceSession(args.model, so, providers=['OpenVINOExecutionProvider'], provider_options=[{'device_type' : args.device}])
print("Device type selected is: " + args.device + " using the OpenVINO Execution Provider")
'''
other 'device_type' options are: (Any hardware target can be assigned if you have the access to it)
'CPU_FP32', 'GPU_FP32', 'GPU_FP16', 'MYRIAD_FP16', 'VAD-M_FP16'
'CPU_FP32', 'CPU_FP16', 'GPU_FP32', 'GPU_FP16', 'MYRIAD_FP16', 'VAD-M_FP16'
'''
else:
raise Exception("Device type selected is not [cpu, CPU_FP32, GPU_FP32, GPU_FP16, MYRIAD_FP16, VADM_FP16]")
raise Exception("Device type selected is not [cpu, CPU_FP32, CPU_FP16, GPU_FP32, GPU_FP16, MYRIAD_FP16, VADM_FP16]")

# Get the input name of the model
input_name = sess.get_inputs()[0].name
Expand Down
8 changes: 4 additions & 4 deletions python/OpenVINO_EP/yolov4_object_detection/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
certifi==2022.5.18.1
flatbuffers==2.0
numpy==1.22.4
onnx==1.11.0
numpy==1.23.5
onnx==1.13.0
opencv-python==4.5.5.64
Pillow==9.3.0
protobuf==4.21.6
scipy==1.7.3
protobuf==3.20.2
scipy==1.9.0
typing-extensions==4.2.0
3 changes: 2 additions & 1 deletion python/OpenVINO_EP/yolov4_object_detection/yolov4.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ def main():
image = draw_bbox(original_image, bboxes)

cv2.putText(image,device,(10,20),cv2.FONT_HERSHEY_COMPLEX,0.5,(255,255,255),1)
cv2.putText(image,'FPS: {}'.format(1.0/inference_time),(10,40),cv2.FONT_HERSHEY_COMPLEX,0.5,(255,255,255),1)
if (inference_time!=0):
cv2.putText(image,'FPS: {}'.format(1.0/inference_time),(10,40),cv2.FONT_HERSHEY_COMPLEX,0.5,(255,255,255),1)

# Write the frame with the detection boxes
if (args.image):
Expand Down