-
Notifications
You must be signed in to change notification settings - Fork 0
/
ud_trtdeploy.h
72 lines (63 loc) · 1.65 KB
/
ud_trtdeploy.h
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
69
70
71
72
#ifndef UD_TRTDEPLOY_H
#define UD_TRTDEPLOY_H
/*****************************************************************************
* @description : TensorRT 调用API
*****************************************************************************/
#pragma once
#include <afxext.h>
#include<afxwin.h>
#include<string>
#include <opencv2/opencv.hpp> // opencv include
#include <iostream> // system include
#include<math.h>
#include<cstring>
#include "ud_trtapi.h"
#include "ud_basetype.h"
using namespace std;
class TimeTick
{
public:
TimeTick(PD_VOID)
{
QueryPerformanceFrequency(&mFrequency);
};
private:
LARGE_INTEGER mStartTime;
LARGE_INTEGER mEndTime;
LARGE_INTEGER mCurrentTime;
LARGE_INTEGER mFrequency; // CPU频率 计时的精度跟频率有关,我电脑频率是10e8,计时精度为10纳秒级别
public:
PD_DOUBLE mInterval; // 间隔
public:
PD_VOID start()
{
QueryPerformanceCounter(&mStartTime);
};
PD_VOID end()
{
QueryPerformanceCounter(&mEndTime);
mInterval = ((PD_DOUBLE)mEndTime.QuadPart - (PD_DOUBLE)mStartTime.QuadPart) / (PD_DOUBLE)mFrequency.QuadPart; //秒,10e-8级别
};
PD_DOUBLE tick()
{
QueryPerformanceCounter(&mCurrentTime);
return (PD_DOUBLE)mCurrentTime.QuadPart / (PD_DOUBLE)mFrequency.QuadPart;
};
};
class CTrtDeploy
{
public:
CTrtDeploy();
CTrtDeploy(string m_modelPth);
~CTrtDeploy();
public:
PD_VOID Init(string ModelPth);
returnResult_S run(string G_sImgPth, int nThreshValue, string ModelPth);
returnResult_S TD_AllDeploy(string G_sImgPth);
CTrtAPI* m_pTrtAPI;
string ModelPth;
private:
PARAMS_S params;
std::shared_ptr<TRTCore_ctx> ctx;
};
#endif // !UD_TRTDEPLOY_H