- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I write simple code for objects detection . But my application crashes when I try to run this code
from openvino.inference_engine import IENetwork, IEPlugin import numpy as np import os class OpenVinoDetector(): def __init__(self, model_path): # read the model self.plugin = IEPlugin(device="CPU", plugin_dirs=None) self.plugin.add_cpu_extension('cpu_extension.dll') net = IENetwork.from_ir(model=model_path, \ weights=os.path.splitext(model_path)[0] + ".bin") self.network = self.plugin.load(network=net, num_requests=2) # input and output self.input_blob = next(iter(net.inputs)) self.out_blob = next(iter(net.outputs)) def detect(self, frame): cur_request_id = 0 self.network.start_async(request_id=cur_request_id, inputs={self.input_blob: frame}) if self.network.requests[cur_request_id].wait(-1) == 0: res = self.network.requests[cur_request_id].outputs[self.out_blob] conf = res[0,0,:,2] rects = res[0, 0, :, 3:7] return conf, rects detector = OpenVinoDetector(r'C:\Intel\computer_vision_sdk_2018.4.420\deployment_tools\model_optimizer\frozen_inference_graph.xml') for i in range(0,10): frame = np.zeros((1, 3, 240, 320)) conf,rects = detector.detect(frame)
I think problem in inference_engine library
void InferenceEnginePython::InferRequestWrap::infer_async() {
InferenceEngine::ResponseDesc response;
IE_CHECK_CALL(request_ptr->StartAsync(&response));
}
Because request_ptr is wrong.
If I move plugin initialization from class then application works.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Solved, It was problem with removing variables
del self.network
del self.plugin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, Viktor
I want to know how I can import openvino in a python API, such as vsCode.
I can import openvino in command prompt, but it's not in Visual Studio Code.
thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Victor and 谢, 海蓉:
You should find the below document quite useful,
https://docs.openvinotoolkit.org/latest/_inference_engine_ie_bridges_python_docs_api_overview.html
Thanks for using OpenVino !
Shubha
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page