C++ & OpenVINO

This commit is contained in:
2024-08-24 15:24:01 +03:00
parent 4e84f550d4
commit 8a04448f63
13 changed files with 296 additions and 232 deletions

View File

@ -1,3 +0,0 @@
# models
intel/
*.onnx

View File

@ -4,10 +4,8 @@ import cv2
import numpy as np
import openvino as ov
# model_path = './yolov8/yolov8n/yolov8n.xml'
model_path = './yolov8/yolov8s/yolov8s.xml'
# model_path = './intel/person-detection-retail-0013/FP16/person-detection-retail-0013.xml'
image_path = 'cat_dog.jpg'
model_path = '../Models/yolov8n_openvino_model/yolov8n.xml'
image_path = '../../../assets/bus.jpg'
device_name = 'CPU'
@ -30,7 +28,7 @@ def main():
ppp = ov.preprocess.PrePostProcessor(model)
ppp.input().tensor().set_element_type(ov.Type.u8).set_layout(ov.Layout('NHWC'))
ppp.input().model().set_layout(ov.Layout('NCHW'))
ppp.output().tensor().set_element_type(ov.Type.f32) # f16
ppp.output().tensor().set_element_type(ov.Type.f32)
model = ppp.build()
compiled_model = core.compile_model(model, device_name)
@ -43,7 +41,7 @@ def main():
for detection in detections:
confidence = detection[2]
if confidence > 0.7:
if confidence > 0.25:
class_id = int(detection[1])
xmin = int(detection[3] * w)