Files
openvino/docs/snippets/movidius-programming-guide.cpp
2021-06-01 16:31:29 +03:00

37 lines
808 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 <ie_core.hpp>
int main() {
InferenceEngine::Core core;
int numRequests = 42;
int i = 1;
auto network = core.ReadNetwork("sample.xml");
auto executable_network = core.LoadNetwork(network, "CPU");
//! [part0]
struct Request {
InferenceEngine::InferRequest 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.CreateInferRequest();
//! [part2]
//! [part3]
// Run inference
request[i].inferRequest.StartAsync();
//! [part3]
//! [part4]
request[i].inferRequest.SetCompletionCallback([] () {});
//! [part4]
return 0;
}