SSDDefinition.h 2.92 KB
Newer Older
Your Name's avatar
Your Name committed
1
2
3
4
5
6
7
8
9
10
// SSD定义

#ifndef __SSD_DEFINITION_H__
#define __SSD_DEFINITION_H__

#include <vector>

namespace migraphxSamples
{

liucong's avatar
liucong committed
11
#define SSD_MAX_PRIORBOX_LAYER_NUM 10 // 能够支持的最大检测层数量
Your Name's avatar
Your Name committed
12
13
14
15
16
17
18

// SSD参数
typedef struct _SSDParameter
{
    int numberOfPriorBoxLayer; // 检测层数量

    // Model Parameters
liucong's avatar
liucong committed
19
20
21
    int convHeight[SSD_MAX_PRIORBOX_LAYER_NUM * 2];
    int convWidth[SSD_MAX_PRIORBOX_LAYER_NUM * 2];
    int convChannel[SSD_MAX_PRIORBOX_LAYER_NUM * 2];
Your Name's avatar
Your Name committed
22
23

    // PriorBoxLayer Parameters
liucong's avatar
liucong committed
24
25
    int priorBoxWidth[SSD_MAX_PRIORBOX_LAYER_NUM];   // 每个检测层priorbox的宽
    int priorBoxHeight[SSD_MAX_PRIORBOX_LAYER_NUM];  // 每个检测层priorbox的高
Your Name's avatar
Your Name committed
26
27
    std::vector<std::vector<float>> priorBoxMinSize; // 每个检测层priorbox的minsize
    std::vector<std::vector<float>> priorBoxMaxSize; // 每个检测层priorbox的maxsize
liucong's avatar
liucong committed
28
29
30
    int minSizeNum[SSD_MAX_PRIORBOX_LAYER_NUM];      // 每个检测层priorbox的minsize数量
    int maxSizeNum[SSD_MAX_PRIORBOX_LAYER_NUM];      // 每个检测层priorbox的maxsize数量
    int srcImageHeight;                              // 原图大小
Your Name's avatar
Your Name committed
31
    int srcImageWidth;
liucong's avatar
liucong committed
32
33
34
35
    int inputAspectRatioNum[SSD_MAX_PRIORBOX_LAYER_NUM];  // 每个检测层宽高比的数量
    std::vector<std::vector<float>> priorBoxAspectRatio;  // 每个检测层的宽高比
    float priorBoxStepWidth[SSD_MAX_PRIORBOX_LAYER_NUM];  // 每个检测层步长的宽
    float priorBoxStepHeight[SSD_MAX_PRIORBOX_LAYER_NUM]; // 每个检测层步长的高
Your Name's avatar
Your Name committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49
    float offset;
    int flip[SSD_MAX_PRIORBOX_LAYER_NUM];
    int clip[SSD_MAX_PRIORBOX_LAYER_NUM];
    int priorBoxVar[4];

    // SoftmaxLayer Parameters
    int softMaxInChn[SSD_MAX_PRIORBOX_LAYER_NUM];
    int softMaxInHeight;
    int concatNum;
    int softMaxOutWidth;
    int softMaxOutHeight;
    int softMaxOutChn;

    // DetectionOutLayer Parameters
liucong's avatar
liucong committed
50
    int classNum; // 类别数(包含背景类)
Your Name's avatar
Your Name committed
51
52
53
54
55
56
57
58
    int topK;
    int keepTopK;
    int NMSThresh;
    int confThresh;
    int detectInputChn[SSD_MAX_PRIORBOX_LAYER_NUM];
    int convStride[SSD_MAX_PRIORBOX_LAYER_NUM];

    // buffer
liucong's avatar
liucong committed
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
    int* buffer;
    int* classification[SSD_MAX_PRIORBOX_LAYER_NUM]; // 分类数据
    int* regression[SSD_MAX_PRIORBOX_LAYER_NUM];     // 回归
    int* priorboxOutputData;
    int* softMaxOutputData;
    int* getResultBuffer;
    int* dstScore;
    int* dstRoi;
    int* classRoiNum;
    _SSDParameter()
        : srcImageHeight(0),
          srcImageWidth(0),
          offset(0.0),
          softMaxInHeight(0),
          concatNum(0),
          softMaxOutWidth(0),
          softMaxOutHeight(0),
          softMaxOutChn(0),
          buffer(NULL),
          priorboxOutputData(NULL),
          softMaxOutputData(NULL),
          getResultBuffer(NULL),
          dstScore(NULL),
          dstRoi(NULL),
          classRoiNum(NULL)
    {
    }
} SSDParameter;
Your Name's avatar
Your Name committed
87
88
89
90
91

typedef struct _QuickSortStack
{
    int min;
    int max;
liucong's avatar
liucong committed
92
} QuickSortStack;
Your Name's avatar
Your Name committed
93

liucong's avatar
liucong committed
94
} // namespace migraphxSamples
Your Name's avatar
Your Name committed
95
96

#endif