未验证 提交 3d5cde1a 编写于 作者: L littletomatodonkey 提交者: GitHub

Update main.cpp

上级 13e8fcdc
...@@ -72,22 +72,15 @@ int main(int argc, char **argv) { ...@@ -72,22 +72,15 @@ int main(int argc, char **argv) {
cv::Mat srcimg = cv::imread(img_path, cv::IMREAD_COLOR); cv::Mat srcimg = cv::imread(img_path, cv::IMREAD_COLOR);
cv::cvtColor(srcimg, srcimg, cv::COLOR_BGR2RGB); cv::cvtColor(srcimg, srcimg, cv::COLOR_BGR2RGB);
auto start = std::chrono::system_clock::now(); double run_time = classifier.Run(srcimg);
classifier.Run(srcimg);
auto end = std::chrono::system_clock::now();
auto duration =
std::chrono::duration_cast<std::chrono::microseconds>(end - start);
double curr_time = double(duration.count()) *
std::chrono::microseconds::period::num /
std::chrono::microseconds::period::den;
if (idx >= warmup_iter) { if (idx >= warmup_iter) {
elapsed_time += curr_time; elapsed_time += run_time;
std::cout << "Current image path: " << img_path << std::endl; std::cout << "Current image path: " << img_path << std::endl;
std::cout << "Current time cost: " << curr_time << " s, " std::cout << "Current time cost: " << run_time << " s, "
<< "average time cost in all: " << "average time cost in all: "
<< elapsed_time / (idx + 1 - warmup_iter) << " s." << std::endl; << elapsed_time / (idx + 1 - warmup_iter) << " s." << std::endl;
} else { } else {
std::cout << "Current time cost: " << curr_time << " s." << std::endl; std::cout << "Current time cost: " << run_time << " s." << std::endl;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册