Blame view

src/human_car_parsing/human_car_parsing.h 3.77 KB
95cb794e   Zou XiKun   trt 20210304
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
118
119
120
121
122
123
124
125
126
127
128
129
  /*******************************************************************************************
  * Version: human_car_parsing_v0.0.0
  * CopyRight: 中科院自动化研究所模式识别实验室图像视频组
  * UpdateDate: 20190402
  * Content: 人骑车语义分析
  ********************************************************************************************/
  
  #ifndef HUMANCARPARSING_H_
  #define HUMANCARPARSING_H_
  
  #ifdef _MSC_VER
  #ifdef HUMANCARPARSING_EXPORTS
  #define HUMANCARPARSING_API __declspec(dllexport)
  #else
  #define HUMANCARPARSING_API __declspec(dllimport)
  #endif
  #else
  #define HUMANCARPARSING_API   __attribute__ ((visibility ("default")))
  #endif
  
  #include "sy_common.h"
  
  #ifdef __cplusplus
  extern "C"
  {
  #endif
  
  #ifndef __CLASSIFY_OBJ_RESULT__
  #define __CLASSIFY_OBJ_RESULT__
  	typedef struct classify_obj_res         //分类结果结构体
  	{
  		int res_index;              //分类结果
  		float res_prob;             //分类结构体
  		classify_obj_res() : res_index(0), res_prob(0) {};
  	} classify_obj_res;
  #endif
  
  #ifndef __HCF_FEA_RES__
  #define __HCF_FEA_RES__
  const int HCF_FEATURE_SIZE = 1280;
  #endif
  
  #ifndef __HCP_RESULT__
  #define __HCP_RESULT__
  const int HCP_ATTRI_INDEX_SIZE = 14;
  typedef struct hcp_analysis_result
  {
  	classify_obj_res res_objs[HCP_ATTRI_INDEX_SIZE];          //分类结果
  	float feature[HCF_FEATURE_SIZE]; //人骑车特征
  } hcp_analysis_result;
  #endif
  
  #ifndef __HCP_PARAM__
  #define __HCP_PARAM__
  	typedef struct hcp_param
  	{
  		int mode;				//运行模式(DEVICE_GPU / DEVICE_CPU)
  		int gpuid;              //指定显卡id
      int engine;     //指定运行引擎(ENGINE_MCAFFE2 / ENGINE_TENSORRT)
      int max_batch;     //指定trt最大batch
  		char* serialize_file;
  		hcp_param() :mode(DEVICE_GPU), gpuid(0) {};
  	}hcp_param;
  #endif
  
  	/*************************************************************************
  	* FUNCTION: hcp_init
  	* PURPOSE: 初始化
  	* PARAM:
  	[out] tools		   - 句柄
  	[in]  param    - 初始化参数
  	* RETURN:
  	[out] int             - 初始化是否成功(SUCCEEDED表示成功,FAILED表示失败)
  	* NOTES:
  	*************************************************************************/
  	HUMANCARPARSING_API int hcp_init(void ** handle, hcp_param param);
  
  	/*************************************************************************
  	* FUNCTION: hcp_process
  	* PURPOSE: 人骑车属性检测
  	* PARAM:
  	[in] tools		      - 句柄
  	[in] img_data          - 检测图像数据
  	[in] result           - 检测结果
  	* RETURN:
  	[out] int             - 检测是否成功(SUCCEEDED表示成功,FAILED表示失败)
  	* NOTES:
  	*************************************************************************/
  	HUMANCARPARSING_API int hcp_process(void * handle, sy_img img_data, hcp_analysis_result * result);
  
  	/*************************************************************************
  	* FUNCTION: hcp_batch
  	* PURPOSE: 人骑车属性检测
  	* PARAM:
  	[in] tools		      - 句柄
  	[in] img_data_array       - 检测图像数据
  	[in] batch_size        - 检测图像数目
  	[in] result           - 检测结果
  	* RETURN:
  	[out] int             - 检测是否成功(SUCCEEDED表示成功,FAILED表示失败)
  	* NOTES:
  	*************************************************************************/
  	HUMANCARPARSING_API int hcp_batch(void * handle, sy_img * img_data_array, int batch_size, hcp_analysis_result * result);
  
  
  	/*************************************************************************
  	* FUNCTION: hcp_release
  	* PURPOSE: 资源释放
  	* PARAM:
  	[in] tools		    - 处理句柄
  	* RETURN:	NULL
  	* NOTES:
  	*************************************************************************/
  	HUMANCARPARSING_API void hcp_release(void ** handle);
  
  	/*************************************************************************
  	* FUNCTION: hcp_get_version
  	* PURPOSE:
  	* PARAM:	NULL
  	* RETURN:	版本号
  	* NOTES:
  	*************************************************************************/
  	HUMANCARPARSING_API const char * hcp_get_version();
  
  #ifdef __cplusplus
  };
  #endif
  
  #endif