Blame view

3rdparty/vpt.h 3.22 KB
8805b950   Liu Meng   物品遗留效果优化
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
  /*******************************************************************************************
  * Version: vpt_det_v0.0.0
  * CopyRight: 中科院自动化研究所模式识别实验室图像视频组
  * UpdateDate: 20190327
  * Content: 人车物检测
  ********************************************************************************************/
  
  #ifndef VPT_DET_H_
  #define VPT_DET_H_
  
  #ifdef _MSC_VER
  #ifdef VPT_DET_EXPORTS
  #define VPT_DET_API __declspec(dllexport)
  #else
  #define VPT_DET_API __declspec(dllimport)
  #endif
  #else
  #define VPT_DET_API   __attribute__ ((visibility ("default")))
  #endif
  
  #include "sy_common.h"
  
  extern "C"
  {
  
  #define MAX_DET_COUNT 50
  
  	//Utools Obj Results
  #ifndef __VPT_OBJ_RESULT__
  #define __VPT_OBJ_RESULT__
  	typedef struct vpt_obj_result
  	{
  		int obj_id;					//对应batch输入顺序
  		sy_rect obj_rect;					//位置
  		int obj_index;
  		float obj_score;
  	}vpt_obj_result;
  #endif
  
  	//Utools Results
  #ifndef __VPT_RESULT__
  #define __VPT_RESULT__ 
  	typedef struct vpt_result
  	{
  		int obj_count_;		                //返回特征数组总个数 < 检测中:单batch检测总数 / 分类中:Multi >
  		vpt_obj_result *obj_results_;		//batch 所有的结果
  	}vpt_result;
  #endif //by Junlin 190121
  
  #ifndef __VPT_PARAM__
  #define __VPT_PARAM__
  	typedef struct vpt_param
  	{
  		int mode;				//运行模式(DEVICE_GPU / DEVICE_CPU)
  		int gpuid;              //指定显卡id
  		float threshold;
  		int max_batch;
  		int engine;    //指定运行引擎(ENGINE_MCAFFE2 / ENGINE_TENSORRT)
  		char* preprocess_param;
  		char* serialize_file;
  		vpt_param() :mode(DEVICE_GPU), gpuid(0), threshold(0.6), max_batch(20) {};
  	}vpt_param;
  #endif
  
  	/*************************************************************************
  	* FUNCTION: hcp_init
  	* PURPOSE: 初始化
  	* PARAM:
  	[out] tools		   - 句柄
  	[in]  param    - 初始化参数
  	* RETURN:
  	[out] int             - 初始化是否成功(SUCCEEDED表示成功,FAILED表示失败)
  	* NOTES:
  	*************************************************************************/
  	VPT_DET_API int vpt_init(void **handle, vpt_param param);
  
  	/*************************************************************************
  	* FUNCTION: hcp_process
  	* PURPOSE: 人骑车属性检测
  	* PARAM:
  	[in] tools		      - 句柄
  	[in] img_data          - 检测图像数据
  	[in] width            - 检测图像宽度
  	[in] height           - 检测图像高度
  	[in] channels         - 检测图像通道数
  	[in] result           - 检测结果
  	* RETURN:
  	[out] int             - 检测是否成功(SUCCEEDED表示成功,FAILED表示失败)
  	* NOTES:
  	*************************************************************************/
  	VPT_DET_API int vpt_process(void * handle, sy_img img, vpt_result *result);
  
  
  	VPT_DET_API int vpt_batch(void * handle, sy_img *batch_img, int batchsize, vpt_result **result);
  
  
  	/*************************************************************************
  	* FUNCTION: hcp_release
  	* PURPOSE: 资源释放
  	* PARAM:
  	[in] tools		    - 处理句柄
  	* RETURN:	NULL
  	* NOTES:
  	*************************************************************************/
  	VPT_DET_API void vpt_release(void **handle);
  
  
  	/*************************************************************************
  	* FUNCTION: hcp_get_version
  	* PURPOSE:
  	* PARAM:	NULL
  	* RETURN:	版本号
  	* NOTES:
  	*************************************************************************/
  	VPT_DET_API const char * vpt_get_version();
  }
  #endif