Ver código fonte

修改main函数

leon 5 meses atrás
pai
commit
06056ad34d
2 arquivos alterados com 7 adições e 5 exclusões
  1. 7 2
      src/main.cpp
  2. 0 3
      src/resnet.cu

+ 7 - 2
src/main.cpp

@@ -15,8 +15,13 @@ void single_inference() {
   cv::Mat image = cv::imread("inference/car.jpg");
   auto resnet = resnet::load("resnet.engine");
   if (resnet == nullptr) return;
-
-  auto objs = resnet->forward(cvimg(image));
+  trt::Timer timer;
+  for (int i = 0; i < 100; i++)
+  {
+    trt::Timer timer1;
+    auto attr = resnet->forward(cvimg(image));
+    printf("score : %lf, label : %d\n", attr.confidence, attr.class_label);
+  }
 }
 
 int main() {

+ 0 - 3
src/resnet.cu

@@ -434,9 +434,6 @@ class InferImpl : public Infer {
       float max_score = output_array_cpu[index];
       arrout.emplace_back(max_score, index);
     }
-    for (int ib = 0; ib < num_image; ++ib) {
-        printf("score : %lf, label : %d\n", arrout[ib].confidence, arrout[ib].class_label);
-    }
     return arrout;
   }
 };