Files
openvino/docs/snippets/movidius-programming-guide.cpp
2020-10-10 11:19:16 +03:00

38 lines
888 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <inference_engine.hpp>
int main() {
InferenceEngine::Core core;
InferenceEngine::IInferRequest::CompletionCallback callback;
int numRequests = 42;
int i = 1;
auto network = core.ReadNetwork("sample.xml");
auto executable_network = core.LoadNetwork(network, "CPU");
//! [part0]
struct Request {
InferenceEngine::InferRequest::Ptr inferRequest;
int frameidx;
};
//! [part0]
//! [part1]
// numRequests is the number of frames (max size, equal to the number of VPUs in use)
std::vector<Request> request(numRequests);
//! [part1]
//! [part2]
// initialize infer request pointer Consult IE API for more detail.
request[i].inferRequest = executable_network.CreateInferRequestPtr();
//! [part2]
//! [part3]
// Run inference
request[i].inferRequest->StartAsync();
//! [part3]
//! [part4]
request[i].inferRequest->SetCompletionCallback(callback);
//! [part4]
return 0;
}