CommonDefinition.h 1.22 KB
Newer Older
liucong's avatar
liucong committed
1
// 常用定义
Your Name's avatar
Your Name committed
2
3
4
5
6
7
8
9

#ifndef __COMMON_DEFINITION_H__
#define __COMMON_DEFINITION_H__

#include <opencv2/opencv.hpp>

namespace migraphxSamples
{
liucong's avatar
liucong committed
10

Your Name's avatar
Your Name committed
11
12
// 路径分隔符(Linux:‘/’,Windows:’\\’)
#ifdef _WIN32
liucong's avatar
liucong committed
13
#define PATH_SEPARATOR '\\'
Your Name's avatar
Your Name committed
14
#else
liucong's avatar
liucong committed
15
#define PATH_SEPARATOR '/'
Your Name's avatar
Your Name committed
16
17
#endif

liucong's avatar
liucong committed
18
#define CONFIG_FILE "../Resource/Configuration.xml"
Your Name's avatar
Your Name committed
19

liucong's avatar
liucong committed
20
typedef enum _ErrorCode
Your Name's avatar
Your Name committed
21
{
liucong's avatar
liucong committed
22
23
24
25
    SUCCESS = 0,              // 0
    MODEL_NOT_EXIST,          // 模型不存在
    CONFIG_FILE_NOT_EXIST,    // 配置文件不存在
    FAIL_TO_LOAD_MODEL,       // 加载模型失败
Your Name's avatar
Your Name committed
26
    FAIL_TO_OPEN_CONFIG_FILE, // 加载配置文件失败
liucong's avatar
liucong committed
27
28
    IMAGE_ERROR,              // 图像错误
} ErrorCode;
Your Name's avatar
Your Name committed
29

liucong's avatar
liucong committed
30
typedef struct _ResultOfPrediction
Your Name's avatar
Your Name committed
31
32
33
{
    float confidence;
    int label;
liucong's avatar
liucong committed
34
    _ResultOfPrediction() : confidence(0.0f), label(0) {}
Your Name's avatar
Your Name committed
35

liucong's avatar
liucong committed
36
} ResultOfPrediction;
Your Name's avatar
Your Name committed
37

liucong's avatar
liucong committed
38
typedef struct _ResultOfDetection
Your Name's avatar
Your Name committed
39
{
liucong's avatar
liucong committed
40
    cv::Rect boundingBox;
Your Name's avatar
Your Name committed
41
42
    float confidence;
    int classID;
liucong's avatar
liucong committed
43
    std::string className;
Your Name's avatar
Your Name committed
44
45
    bool exist;

liucong's avatar
liucong committed
46
    _ResultOfDetection() : confidence(0.0f), classID(0), exist(true) {}
Your Name's avatar
Your Name committed
47

liucong's avatar
liucong committed
48
} ResultOfDetection;
Your Name's avatar
Your Name committed
49

liucong's avatar
liucong committed
50
typedef struct _InitializationParameterOfDetector
Your Name's avatar
Your Name committed
51
52
53
{
    std::string parentPath;
    std::string configFilePath;
liucong's avatar
liucong committed
54
} InitializationParameterOfDetector;
Your Name's avatar
Your Name committed
55

liucong's avatar
liucong committed
56
} // namespace migraphxSamples
Your Name's avatar
Your Name committed
57
58

#endif