DetectorYOLOV8.h 1.44 KB
Newer Older
wangsen's avatar
wangsen committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// YOLOV8检测器

#ifndef __DETECTOR_YOLOV8_H__
#define __DETECTOR_YOLOV8_H__

#include <string>
#include <migraphx/program.hpp>
#include <opencv2/opencv.hpp>
#include <CommonDefinition.h>
#include "Decoder.h"

using namespace std;
using namespace cv;
using namespace migraphx;

namespace migraphxSamples
{

// YOLOV8参数
typedef struct _YOLOV8Parameter
{
    int numberOfClasses;// 类别数
    float confidenceThreshold;// 置信度阈值
    float nmsThreshold;// NMS阈值
    // float objectThreshold;//目标置信度值

}YOLOV8Parameter;

class DetectorYOLOV8
{
public:
    DetectorYOLOV8();
    
    ~DetectorYOLOV8();

    ErrorCode Initialize(InitializationParameterOfDetector initializationParameterOfDetector);

    ErrorCode Detect(const cv::Mat &srcImage, std::vector<ResultOfDetection> &resultsOfDetection);

    ErrorCode Detect(DCU_Frame &srcImage, std::vector<ResultOfDetection> &resultsOfDetection);

    float* preprocess_Image = NULL;

private:
    ErrorCode DoCommonInitialization(InitializationParameterOfDetector initializationParameterOfDetector);


private:
    cv::FileStorage configurationFile;
    InitializationParameterOfDetector initializationParameter;
    FILE *logFile;

    // net
    migraphx::program net;
    cv::Size inputSize;
    string inputName;
    migraphx::shape inputShape;
    
    bool useFP16;
    vector<string> classNames;

    YOLOV8Parameter yolov8Parameter;
    migraphx::parameter_map ParameterMap;
};

}

#endif