Blame view

algorithm/vehicle_analysis/vehicle_analysis.h 8.85 KB
eac85cd5   Hu Chunming   调通va
1
2
  /************************************************************

  * Version: vehicle_analysis_v0.0.0.190311.gpuonly

a89b93e8   Hu Chunming   更新注释
3
  * CopyRight: 中科视语(北京)科技有限公司

eac85cd5   Hu Chunming   调通va
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  * UpdateDate: 20190311

  * Content: drafting the first edition by 

  ************************************************************/

  

  #ifndef VEHICLEANALYSIS_H_

  #define VEHICLEANALYSIS_H_

  

  #ifdef _MSC_VER

  #ifdef VEHICLEANALYSIS_EXPORTS

  #define VEHICLEANALYSIS_API __declspec(dllexport)

  #else

  #define VEHICLEANALYSIS_API __declspec(dllimport)

  #endif

  #else

  #define VEHICLEANALYSIS_API __attribute__ ((visibility ("default")))

  #endif

  

  #ifdef __cplusplus

  extern "C"

  {

  #endif

  

a89b93e8   Hu Chunming   更新注释
26
27
  #include "sy_common.h"		                        //通用数据结构体定义

  #include "vehicle_result.h"		                    //车辆分析结果结构体定义

eac85cd5   Hu Chunming   调通va
28
29
30
31
  

  

  #ifndef __VEHICLE_INFO__

  #define __VEHICLE_INFO__

a89b93e8   Hu Chunming   更新注释
32
33
34
35
36
37
38
39
40
41
42
43
  	typedef struct vehicle_info {                   	 //单车辆分析结果

  		vd_result vehicle_detect_res;               	 //(车头+车尾)检测结果

  		vd_result vehicle_win_detect_res;            	//车窗检测结果

  		vd_result vehicle_body_detect_res;           	 //车身检测结果

  		vc_result vehicle_color_res;                 	//车颜色

  		vr_result vehicle_recg_res;                 //车型识别

  		vplate_results vehicle_plate_det_recg_res;   	 //车牌检测识别结果

  		v_pendant_d_result vehicle_pendant_det_res;      //车属性

  		vid_result vehicle_illegal_det_res;          	//车违规

  		vf_result vehicle_fea_res;                   	//以车搜车

  		//vs_result vehicle_special_res;               	//特殊品类车型(只有货车有输出结果)

  		//mucktruckcover_result vehicle_mucktruckcover_res; //渣土车盖盖状态(车头:只有特殊品类车型中的渣土车和建筑垃圾车有输出结果,车尾:只有货车有输出结果)

eac85cd5   Hu Chunming   调通va
44
  		

a89b93e8   Hu Chunming   更新注释
45
  		mta_result mta_res;                           //摩托车是否载人/摩托车驾驶人是否戴头盔/农用车是否载人

eac85cd5   Hu Chunming   调通va
46
  

a89b93e8   Hu Chunming   更新注释
47
  		manned_result manned_res;	 //是否是货车三轮车载人 0-不是货车/不是三轮车/三轮车未载人/货车未载人,1-货车载人,2-三轮车载人

eac85cd5   Hu Chunming   调通va
48
  				

a89b93e8   Hu Chunming   更新注释
49
  	    int type;                                    //车的类别:0-车头,1-车尾,2-摩托车,3-三轮车	4-车身	

d4ec4cba   Hu Chunming   补交头文件
50
51
  		int vpt_type;

  		int rainshed;		//是否安装雨棚, 0 有雨棚   1 无雨棚

a89b93e8   Hu Chunming   更新注释
52
53
  				

  		//int obj_quality_idx;//聚档数据类型:0-无效数据,1-低质数据,2-优质数据

eac85cd5   Hu Chunming   调通va
54
55
56
57
58
59
  	} vehicle_info;

  #endif

  

  

  #ifndef __VEHICLE_ANALYSIS_RESULT__

  #define __VEHICLE_ANALYSIS_RESULT__

a89b93e8   Hu Chunming   更新注释
60
61
62
  	typedef struct va_result {		                 //车辆分析结果 内存在外部申请

  		vehicle_info *info;				             //单车辆全部分析结果

  		int count;					                 //车辆数量

eac85cd5   Hu Chunming   调通va
63
64
65
66
67
68
  	} va_result;                                     

  #endif

  

  

  #ifndef __DET_PARAM__

  #define __DET_PARAM__

a89b93e8   Hu Chunming   更新注释
69
  	typedef struct det_param                         //检测算法参数

eac85cd5   Hu Chunming   调通va
70
71
72
73
74
75
76
77
78
79
80
81
  	{

  		int process_min_l;

  		int process_max_l;

  		float thresld;

  	}det_param;

  #endif

  

  

  #ifndef __VA_PARAM__

  #define __VA_PARAM__

  	typedef struct va_param

  	{

a89b93e8   Hu Chunming   更新注释
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  		//算法配置参数

  		sy_command vehicle_detect_config;	   	        	 //是否启动车检测

  		sy_command vehicle_recg_config;			      		 //是否启动车型识别

  		sy_command vehicle_recg_supplement_config;			 //是否启动车型识别补充识别(车头车尾logo检测识别+车型15分类)(前提:启动车型识别vehicle_recg_config

  		sy_command vehicle_plate_det_recg_config;	  		 //是否启动车牌检测识别

  		sy_command vehicle_color_config;			  		 //是否启动车辆颜色识别

  		sy_command vehicle_pendant_det_config;		  		 //是否启动车辆属性识别

  		sy_command vehicle_illegal_config;			  		 //是否启动车违规行为检测

  		sy_command vehicle_feature_config;			   		 //是否启动车辆特征提取

  		//sy_command vehicle_special_config;			   		 //是否启动特殊品类车型识别。(前提:启动车型识别vehicle_recg_config

  		//sy_command vehicle_image_quality_config;	         //是否启动车辆图像清晰度识别	

  		sy_command vehicle_motor_tricycle_analysis_config;	 //是否启动摩托车三轮车分析(摩托车是否载人/摩托车驾驶人是否戴头盔/农用车是否载人)	

  		//sy_command vehicle_motor_hs_output_config;			 //是否启动摩托车未戴头盔输出头肩坐标。(前提:启动摩托车三轮车分析vehicle_motor_tricycle_analysis_config		

  		//sy_command vehicle_stain_vp_config;	 				  //是否启动遮挡车牌识别	

  		//sy_command vehicle_muck_truck_cover_config;			  //是否启动渣土车盖盖识别。(前提:开启特殊品类车型识别vehicle_special_config)

  		//sy_command vehicle_lorry_manned_config;			      //是否启动货车载人识别。(前提:开启车型识别vehicle_recg_config

  		sy_command vehicle_manned_config;			      //是否启动货车、三轮车载人识别。(前提:开启车型识别vehicle_recg_config

eac85cd5   Hu Chunming   调通va
99
100
  

  		

a89b93e8   Hu Chunming   更新注释
101
102
103
104
105
106
107
  		//算法初始化参数

  		int gpuid;                                      //指定显卡id

  		float vehicle_det_thresld=0.5;      			     //车检测参数

  		int min_obj_size=200;							//车头尾检测目标最小长边(建议取值范围100~200,长边小于该尺寸的过滤掉)

  		float vehicle_plate_det_thresld=0.5;              //车牌检测参数

  		float vehicle_attribute_det_thresld=0.5;          //车属性检测参数

  		float vehicle_logo_det_thresld=0.1;              //logo检测参数

eac85cd5   Hu Chunming   调通va
108
  		

a89b93e8   Hu Chunming   更新注释
109
110
111
  		float vc_thresld=0.5;							//车颜色阈值

  		char* dbPath;                                   //车型识别车型数据路路径 <当前仅支持英文路径>		

  		char* models_Path;                               //所有模型的路径 <当前仅支持英文路径>//20210615

eac85cd5   Hu Chunming   调通va
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
  				

  	}va_param;

  #endif

  

  

  	/*************************************************************************

  	* function: va_init

  	* purpose: init resources

  	* param:

  	[in] handle 		- handle

  	[in] param 			- init param

  	* return: success(0) or error code(<0)

  	* notes: null

  	*************************************************************************/

  	VEHICLEANALYSIS_API int va_init(void ** handle, va_param param);

a89b93e8   Hu Chunming   更新注释
127
  	VEHICLEANALYSIS_API int va_acl_init();//仅调用一次,先调用va_acl_init,再调用va_init

eac85cd5   Hu Chunming   调通va
128
129
130
131
132
133
134
135
136
137
  

  	/*************************************************************************

  	* function: va_release

  	* purpose: release sources

  	* param:

  	[in] handle				- handle

  	* return: null

  	* notes: null

  	*************************************************************************/

  	VEHICLEANALYSIS_API void va_release(void ** handle);

a89b93e8   Hu Chunming   更新注释
138
  	VEHICLEANALYSIS_API void va_acl_release();//仅调用一次,当所有的va_release都释放了,最后调用va_acl_release

eac85cd5   Hu Chunming   调通va
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
  	

  	/*************************************************************************

  	* function: va_get_version

  	* purpose: get sdk version

  	* param: null

  	* return: null

  	* notes: null

  	*************************************************************************/

  	VEHICLEANALYSIS_API const char * va_get_version();

  

  	/*************************************************************************

  	* function: va_batch

  	* purpose: vehicle analysis batch

  	* param:

  	[in] handle				- handle

  	[in] img_data_array		- data array

  	[in] format				- data format

  	[in] batch_size			- batch size

  	[in] result				- vehicle analysis result

  	* return: success(0) or error code(<0)

  	* notes: null

  	*************************************************************************/

  	VEHICLEANALYSIS_API int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *result);	

a89b93e8   Hu Chunming   更新注释
162
  	//img_data_arraydevice数据,batch_size==16时调用固定16模型,小于16时调用固定1模型。

eac85cd5   Hu Chunming   调通va
163
164
165
166
167
168
  	VEHICLEANALYSIS_API int va_batch16_device(void * handle, sy_img * img_data_array, int batch_size, va_result *result);		

  	

  

  

  	/*************************************************************************

  	* FUNCTION: VA_ComputeSimilarity

a89b93e8   Hu Chunming   更新注释
169
  	* PURPOSE: 比对相似度(通用)

eac85cd5   Hu Chunming   调通va
170
  	* PARAM:

a89b93e8   Hu Chunming   更新注释
171
172
173
174
  	[in] Afea					- 第一张图片特征

  	[in] Bfea					- 第二张图片特征

  	[in] featuresize			- 特征长度

  	* RETURN:	相似度

eac85cd5   Hu Chunming   调通va
175
176
177
178
179
180
  	* NOTES:	

  	*************************************************************************/

  	VEHICLEANALYSIS_API float va_compute_similarity(float *Afea, float *Bfea, int featuresize);

  

  	/*************************************************************************

  	* FUNCTION: va_compute_similarity_byvafeature

a89b93e8   Hu Chunming   更新注释
181
  	* PURPOSE: 比对相似度(针对va特征)

eac85cd5   Hu Chunming   调通va
182
  	* PARAM:

a89b93e8   Hu Chunming   更新注释
183
184
185
186
  	[in] Afea					- 第一张图片va特征

  	[in] Bfea					- 第二张图片va特征

  	[in] featuresize			- 特征长度VA_FEATURESIZE

  	* RETURN:	相似度

eac85cd5   Hu Chunming   调通va
187
188
189
190
191
192
193
194
195
196
197
198
  	* NOTES:	

  	*************************************************************************/

  	VEHICLEANALYSIS_API float va_compute_similarity_byvafeature(void * handle , float *Afea, float *Bfea, int featuresize);

  

  	

  

  #ifdef __cplusplus

  };

  #endif

  

  #endif