"vscode:/vscode.git/clone" did not exist on "fee37d9e8da009534765768d0a09224914ad8f61"
DetectorYOLOV7.h 1.44 KB
Newer Older
lijian6's avatar
lijian6 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
// YOLOV7检测器

#ifndef __DETECTOR_YOLOV7_H__
#define __DETECTOR_YOLOV7_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
{

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

}YOLOV7Parameter;

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

    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;

    YOLOV7Parameter yolov7Parameter;
    migraphx::parameter_map ParameterMap;
};

}

#endif