55#include < fstream>
66#include < random>
77
8- std::vector<DL_RESULT> DetectObjects (std::unique_ptr<YOLO_V8>& p, const cv::Mat& img) {
8+ void Detector (std::unique_ptr<YOLO_V8>& p, std::vector<DL_RESULT>& res, const cv::Mat& img) {
9+
910
10- std::vector<DL_RESULT> res;
1111 p->RunSession (img, res);
1212
1313 for (auto & re : res)
@@ -42,12 +42,12 @@ std::vector<DL_RESULT> DetectObjects(std::unique_ptr<YOLO_V8>& p, const cv::Mat&
4242
4343
4444 }
45- std::cout << " Press any key to exit" << std::endl;
46- cv::imshow (" Result of Detection" , img);
47- cv::waitKey (0 );
48- cv::destroyAllWindows ();
49- return res;
50- }
45+ // std::cout << "Press any key to exit" << std::endl;
46+ // cv::imshow("Result of Detection", img);
47+ // cv::waitKey(0);
48+ // cv::destroyAllWindows();
49+
50+ }
5151
5252
5353
@@ -137,14 +137,15 @@ int ReadCocoYaml(std::unique_ptr<YOLO_V8>& p) {
137137 return 0 ;
138138}
139139
140- std::unique_ptr<YOLO_V8> Initialize ()
140+ std::tuple<std:: unique_ptr<YOLO_V8>, std::vector<DL_RESULT> > Initialize ()
141141{
142142 std::unique_ptr<YOLO_V8> yoloDetector = std::make_unique<YOLO_V8>();
143-
143+ std::vecroet<DL_RESULT> res;
144144 ReadCocoYaml (yoloDetector);
145145 DL_INIT_PARAM params;
146146 params.rectConfidenceThreshold = 0.1 ;
147147 params.iouThreshold = 0.5 ;
148+ // Mayve change the model from V11 to V8
148149 params.modelPath = " yolo11m.onnx" ;
149150 params.imgSize = { 640 , 640 };
150151 #ifdef USE_CUDA
@@ -163,7 +164,7 @@ std::unique_ptr<YOLO_V8> Initialize()
163164
164165 #endif
165166 yoloDetector->CreateSession (params);
166- return yoloDetector;
167+ return std::make_tuple ( std::move ( yoloDetector), std::move (res)) ;
167168}
168169
169170
0 commit comments