| #include "inference.h" |
|
|
| #include <iostream> |
| #include <opencv2/highgui.hpp> |
|
|
| int main(int argc, char **argv) { |
| |
| if (argc != 3) { |
| std::cerr << "usage: " << argv[0] << " <model_path> <image_path>" << std::endl; |
| return 1; |
| } |
| |
| |
| const std::string model_path = argv[1]; |
| const std::string image_path = argv[2]; |
| |
| |
| cv::Mat image = cv::imread(image_path); |
| |
| |
| if (image.empty()) { |
| std::cerr << "ERROR: image is empty" << std::endl; |
| return 1; |
| } |
| |
| |
| const float confidence_threshold = 0.5; |
| const float NMS_threshold = 0.5; |
| |
| |
| yolo::Inference inference(model_path, cv::Size(640, 640), confidence_threshold, NMS_threshold); |
|
|
| |
| inference.RunInference(image); |
| |
| |
| cv::imshow("image", image); |
| cv::waitKey(0); |
|
|
| return 0; |
| } |
|
|