vehicle_analysis.h
7.97 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/************************************************************
* Version: vehicle_analysis_v0.0.0.190311.gpuonly
* CopyRight: 中科视语(北京)科技有限公司
* 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
#include "sy_common.h" //通用数据结构体定义
#include "vehicle_result.h" //车辆分析结果结构体定义
#ifndef __VEHICLE_INFO__
#define __VEHICLE_INFO__
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; //渣土车盖盖状态(车头:只有特殊品类车型中的渣土车和建筑垃圾车有输出结果,车尾:只有货车有输出结果)
mta_result mta_res; //摩托车是否载人/摩托车驾驶人是否戴头盔/农用车是否载人
manned_result manned_res; //是否是货车三轮车载人 0-不是货车/不是三轮车/三轮车未载人/货车未载人,1-货车载人,2-三轮车载人
int type; //车的类别:0-车头,1-车尾,2-摩托车,3-三轮车 ,4-车身
//int obj_quality_idx;//聚档数据类型:0-无效数据,1-低质数据,2-优质数据
} vehicle_info;
#endif
#ifndef __VEHICLE_ANALYSIS_RESULT__
#define __VEHICLE_ANALYSIS_RESULT__
typedef struct va_result { //车辆分析结果 内存在外部申请
vehicle_info *info; //单车辆全部分析结果
int count; //车辆数量
} va_result;
#endif
#ifndef __DET_PARAM__
#define __DET_PARAM__
typedef struct det_param //检测算法参数
{
int process_min_l;
int process_max_l;
float thresld;
}det_param;
#endif
#ifndef __VA_PARAM__
#define __VA_PARAM__
typedef struct va_param
{
//算法配置参数
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)
//算法初始化参数
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检测参数
float vc_thresld=0.5; //车颜色阈值
char* dbPath; //车型识别车型数据路路径 <当前仅支持英文路径>
char* models_Path; //所有模型的路径 <当前仅支持英文路径>//20210615
}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);
VEHICLEANALYSIS_API int va_acl_init();//仅调用一次,先调用va_acl_init,再调用va_init
/*************************************************************************
* function: va_release
* purpose: release sources
* param:
[in] handle - handle
* return: null
* notes: null
*************************************************************************/
VEHICLEANALYSIS_API void va_release(void ** handle);
VEHICLEANALYSIS_API void va_acl_release();//仅调用一次,当所有的va_release都释放了,最后调用va_acl_release
/*************************************************************************
* 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);
//img_data_array是device数据,batch_size==16时调用固定16模型,小于16时调用固定1模型。
VEHICLEANALYSIS_API int va_batch16_device(void * handle, sy_img * img_data_array, int batch_size, va_result *result);
/*************************************************************************
* FUNCTION: VA_ComputeSimilarity
* PURPOSE: 比对相似度(通用)
* PARAM:
[in] Afea - 第一张图片特征
[in] Bfea - 第二张图片特征
[in] featuresize - 特征长度
* RETURN: 相似度
* NOTES:
*************************************************************************/
VEHICLEANALYSIS_API float va_compute_similarity(float *Afea, float *Bfea, int featuresize);
/*************************************************************************
* FUNCTION: va_compute_similarity_byvafeature
* PURPOSE: 比对相似度(针对va特征)
* PARAM:
[in] Afea - 第一张图片va特征
[in] Bfea - 第二张图片va特征
[in] featuresize - 特征长度VA_FEATURESIZE
* RETURN: 相似度
* NOTES:
*************************************************************************/
VEHICLEANALYSIS_API float va_compute_similarity_byvafeature(void * handle , float *Afea, float *Bfea, int featuresize);
#ifdef __cplusplus
};
#endif
#endif