File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* !
2
+ @Description : https://github.com/shaoshengsong/
3
+ @Author : shaoshengsong
4
+ @Date : 2022-09-23 02:52:22
5
+ */
6
+ #include < fstream>
7
+ #include < sstream>
8
+ #include < opencv2/imgproc.hpp>
9
+ #include < opencv2/opencv.hpp>
10
+ #include < opencv2/dnn.hpp>
11
+ #include " YOLOv5Detector.h"
12
+ #include " dataType.h"
13
+
14
+
15
+
16
+
17
+ int main (int argc, char *argv[])
18
+ {
19
+
20
+ std::shared_ptr<YOLOv5Detector> detector (new YOLOv5Detector ());
21
+ detector->init (k_detect_model_path);
22
+
23
+ std::vector<detect_result> results;
24
+ cv::Mat frame = cv::imread (" 1.jpg" );
25
+ // Second/Millisecond/Microsecond 秒s/毫秒ms/微秒us
26
+ auto start = std::chrono::system_clock::now ();
27
+ detector->detect (frame, results);
28
+ auto end = std::chrono::system_clock::now ();
29
+ auto detect_time =std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count ();// ms
30
+
31
+ detector->draw_frame (frame, results);
32
+
33
+ cv::imshow (" YOLOv5-6.x" , frame);
34
+
35
+ std::string output_file = cv::format (" out%d.jpg" , 1 );
36
+ cv::imwrite (output_file, frame);
37
+
38
+ results.clear ();
39
+
40
+
41
+
42
+
43
+
44
+ }
You can’t perform that action at this time.
0 commit comments