-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
29 lines (22 loc) · 899 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "inferenceopv.h"
int main(int argc, char* argv[]) {
try{
const std::string input_model_path = "yolov8s.xml";
const std::string input_image_path = "original.jpg";
clock_t start, end;
cv::Mat img = cv::imread(input_image_path);
InferenceOPV model(input_model_path);
start = clock();
std::vector<Object> detections = model.detect(img);
for (const auto& detection : detections) {
std::cout << " Object: " << std::endl;
std::cout << " Label: " << detection.class_id << std::endl;
std::cout << " Probability: " << detection.confidence << std::endl;
std::cout << " Rect: " << detection.box << std::endl;
}
}catch (const std::exception& ex){
std::cerr << ex.what()<<std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}