Browse Source

yolov5C++测试文件

Curious 7 months ago
parent
commit
e645ba137c
1 changed files with 29 additions and 28 deletions
  1. 29 28
      test/yolov5.cpp

+ 29 - 28
test/yolov5.cpp

@@ -10,25 +10,26 @@ using std::endl;
 using std::string;
 using std::vector;
 
+
 static const vector<string> class_name = {"cat", "chicken", "cow", "dog", "fox", "goat", "horse", "person", "racoon", "skunk"};
 
-void print_result(const Mat &result, float conf = 0.7, int len_data = 15)
-{
-    float *pdata = (float *)result.data;
-    for (int i = 0; i < result.total() / len_data; i++)
-    {
-        if (pdata[4] > conf)
-        {
-            for (int j = 0; j < len_data; j++)
-            {
-                cout << pdata[j] << " ";
-            }
-            cout << endl;
-        }
-        pdata += len_data;
-    }
-    return;
-}
+// void print_result(const Mat &result, float conf = 0.7, int len_data = 15)
+// {
+//     float *pdata = (float *)result.data;
+//     for (int i = 0; i < result.total() / len_data; i++)
+//     {
+//         if (pdata[4] > conf)
+//         {
+//             for (int j = 0; j < len_data; j++)
+//             {
+//                 cout << pdata[j] << " ";
+//             }
+//             cout << endl;
+//         }
+//         pdata += len_data;
+//     }
+//     return;
+// }
 
 vector<vector<float>> get_info(const Mat &result, float conf = 0.7, int len_data = 15)
 {
@@ -138,17 +139,17 @@ void nms(vector<vector<float>> &info, float iou = 0.4)
     }
 }
 
-void print_info(const vector<vector<float>> &info)
-{
-    for (auto i = 0; i < info.size(); i++)
-    {
-        for (auto j = 0; j < info[i].size(); j++)
-        {
-            cout << info[i][j] << " ";
-        }
-        cout << endl;
-    }
-}
+// void print_info(const vector<vector<float>> &info)
+// {
+//     for (auto i = 0; i < info.size(); i++)
+//     {
+//         for (auto j = 0; j < info[i].size(); j++)
+//         {
+//             cout << info[i][j] << " ";
+//         }
+//         cout << endl;
+//     }
+// }
 
 void draw_box(Mat &img, const vector<vector<float>> &info)
 {