Commit 3e43f0c7172fc961dc67c2c8845f0f05737516df
1 parent
1bd542b2
优化初始化值
Showing
2 changed files
with
40 additions
and
123 deletions
algorithm/vehicle_analysis/vehicle_analysis.h
@@ -55,8 +55,8 @@ | @@ -55,8 +55,8 @@ | ||
55 | #ifndef __VEHICLE_ANALYSIS_RESULT__ | 55 | #ifndef __VEHICLE_ANALYSIS_RESULT__ |
56 | #define __VEHICLE_ANALYSIS_RESULT__ | 56 | #define __VEHICLE_ANALYSIS_RESULT__ |
57 | typedef struct va_result { //车辆分析结果 内存在外部申请 | 57 | typedef struct va_result { //车辆分析结果 内存在外部申请 |
58 | - vehicle_info *info; //单车辆全部分析结果 | ||
59 | - int count; //车辆数量 | 58 | + vehicle_info info[100]; //单车辆全部分析结果 |
59 | + int count{0}; //车辆数量 | ||
60 | } va_result; | 60 | } va_result; |
61 | #endif | 61 | #endif |
62 | 62 | ||
@@ -106,88 +106,9 @@ | @@ -106,88 +106,9 @@ | ||
106 | float vc_thresld=0.5; //车颜色阈值 | 106 | float vc_thresld=0.5; //车颜色阈值 |
107 | char* dbPath; //车型识别车型数据路路径 <当前仅支持英文路径> | 107 | char* dbPath; //车型识别车型数据路路径 <当前仅支持英文路径> |
108 | char* models_Path; //所有模型的路径 <当前仅支持英文路径>//20210615 | 108 | char* models_Path; //所有模型的路径 <当前仅支持英文路径>//20210615 |
109 | - | ||
110 | - int log_level{2}; | ||
111 | - int log_days{30}; //日志保存周期 | ||
112 | - std::string log_path{"logs"}; //日志文件路径 | ||
113 | - unsigned long log_mem{64 * 1024 * 1024}; //每个日志最大大小 | ||
114 | }va_param; | 109 | }va_param; |
115 | #endif | 110 | #endif |
116 | 111 | ||
117 | 112 | ||
118 | - /************************************************************************* | ||
119 | - * function: va_init | ||
120 | - * purpose: init resources | ||
121 | - * param: | ||
122 | - [in] handle - handle | ||
123 | - [in] param - init param | ||
124 | - * return: success(0) or error code(<0) | ||
125 | - * notes: null | ||
126 | - *************************************************************************/ | ||
127 | - VEHICLEANALYSIS_API int va_init(void ** handle, va_param param); | ||
128 | - VEHICLEANALYSIS_API int va_acl_init();//仅调用一次,先调用va_acl_init,再调用va_init | ||
129 | - | ||
130 | - /************************************************************************* | ||
131 | - * function: va_release | ||
132 | - * purpose: release sources | ||
133 | - * param: | ||
134 | - [in] handle - handle | ||
135 | - * return: null | ||
136 | - * notes: null | ||
137 | - *************************************************************************/ | ||
138 | - VEHICLEANALYSIS_API void va_release(void ** handle); | ||
139 | - VEHICLEANALYSIS_API void va_acl_release();//仅调用一次,当所有的va_release都释放了,最后调用va_acl_release | ||
140 | - | ||
141 | - /************************************************************************* | ||
142 | - * function: va_get_version | ||
143 | - * purpose: get sdk version | ||
144 | - * param: null | ||
145 | - * return: null | ||
146 | - * notes: null | ||
147 | - *************************************************************************/ | ||
148 | - VEHICLEANALYSIS_API const char * va_get_version(); | ||
149 | - | ||
150 | - /************************************************************************* | ||
151 | - * function: va_batch | ||
152 | - * purpose: vehicle analysis batch | ||
153 | - * param: | ||
154 | - [in] handle - handle | ||
155 | - [in] img_data_array - data array | ||
156 | - [in] format - data format | ||
157 | - [in] batch_size - batch size | ||
158 | - [in] result - vehicle analysis result | ||
159 | - * return: success(0) or error code(<0) | ||
160 | - * notes: null | ||
161 | - *************************************************************************/ | ||
162 | - VEHICLEANALYSIS_API int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *result); | ||
163 | - //img_data_array是device数据,batch_size==16时调用固定16模型,小于16时调用固定1模型。 | ||
164 | - VEHICLEANALYSIS_API int va_batch16_device(void * handle, sy_img * img_data_array, int batch_size, va_result *result); | ||
165 | - | ||
166 | - | ||
167 | - | ||
168 | - /************************************************************************* | ||
169 | - * FUNCTION: VA_ComputeSimilarity | ||
170 | - * PURPOSE: 比对相似度(通用) | ||
171 | - * PARAM: | ||
172 | - [in] Afea - 第一张图片特征 | ||
173 | - [in] Bfea - 第二张图片特征 | ||
174 | - [in] featuresize - 特征长度 | ||
175 | - * RETURN: 相似度 | ||
176 | - * NOTES: | ||
177 | - *************************************************************************/ | ||
178 | - VEHICLEANALYSIS_API float va_compute_similarity(float *Afea, float *Bfea, int featuresize); | ||
179 | - | ||
180 | - /************************************************************************* | ||
181 | - * FUNCTION: va_compute_similarity_byvafeature | ||
182 | - * PURPOSE: 比对相似度(针对va特征) | ||
183 | - * PARAM: | ||
184 | - [in] Afea - 第一张图片va特征 | ||
185 | - [in] Bfea - 第二张图片va特征 | ||
186 | - [in] featuresize - 特征长度VA_FEATURESIZE | ||
187 | - * RETURN: 相似度 | ||
188 | - * NOTES: | ||
189 | - *************************************************************************/ | ||
190 | - VEHICLEANALYSIS_API float va_compute_similarity_byvafeature(void * handle , float *Afea, float *Bfea, int featuresize); | ||
191 | - | ||
192 | #endif | 113 | #endif |
193 | 114 |
algorithm/vehicle_analysis/vehicle_result.h
@@ -6,20 +6,16 @@ | @@ -6,20 +6,16 @@ | ||
6 | #define VPT_INFO_MIDD_TEMP_ | 6 | #define VPT_INFO_MIDD_TEMP_ |
7 | typedef struct vpt_info_midd_temp | 7 | typedef struct vpt_info_midd_temp |
8 | { | 8 | { |
9 | - int obj_id; | 9 | + int obj_id {-1}; |
10 | sy_rect obj_rect; | 10 | sy_rect obj_rect; |
11 | - int obj_index; | ||
12 | - float obj_score; | ||
13 | - int dis; //20220308到最佳目标点的加权距离 | 11 | + int obj_index {-1}; |
12 | + float obj_score {0.0}; | ||
13 | + int dis {-1}; //20220308到最佳目标点的加权距离 | ||
14 | }vpt_info_midd_temp; | 14 | }vpt_info_midd_temp; |
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | 17 | ||
18 | 18 | ||
19 | - | ||
20 | - | ||
21 | - | ||
22 | - | ||
23 | //1.车检测结果 | 19 | //1.车检测结果 |
24 | #define MAXCARCOUNT 100 //支持最多100个车检测 | 20 | #define MAXCARCOUNT 100 //支持最多100个车检测 |
25 | 21 | ||
@@ -28,7 +24,7 @@ typedef struct vpt_info_midd_temp | @@ -28,7 +24,7 @@ typedef struct vpt_info_midd_temp | ||
28 | typedef struct vd_result | 24 | typedef struct vd_result |
29 | { | 25 | { |
30 | sy_rect rect; | 26 | sy_rect rect; |
31 | - float score; | 27 | + float score{0.0}; |
32 | }vd_result; | 28 | }vd_result; |
33 | #endif | 29 | #endif |
34 | 30 | ||
@@ -38,8 +34,8 @@ typedef struct vd_result | @@ -38,8 +34,8 @@ typedef struct vd_result | ||
38 | #define VC_RESULT_ | 34 | #define VC_RESULT_ |
39 | typedef struct vc_result | 35 | typedef struct vc_result |
40 | { | 36 | { |
41 | - float score; | ||
42 | - int index;//车颜色索引0-12,对应"棕", "橙", "灰", "白", "粉", "紫", "红", "绿", "蓝", "银", "青", "黄", "黑" | 37 | + float score{0.0}; |
38 | + int index{-1};//车颜色索引0-12,对应"棕", "橙", "灰", "白", "粉", "紫", "红", "绿", "蓝", "银", "青", "黄", "黑" | ||
43 | }vc_result; | 39 | }vc_result; |
44 | #endif | 40 | #endif |
45 | 41 | ||
@@ -49,13 +45,13 @@ typedef struct vc_result | @@ -49,13 +45,13 @@ typedef struct vc_result | ||
49 | #define VR_RESULT_ | 45 | #define VR_RESULT_ |
50 | typedef struct vr_result //结果 | 46 | typedef struct vr_result //结果 |
51 | { | 47 | { |
52 | - char vehicle_brand[260]; //车辆品牌 | ||
53 | - char vehicle_subbrand[260]; //车辆子品牌 | ||
54 | - char vehicle_issue_year[260]; //车辆年款 | ||
55 | - char vehicle_type[260]; //车辆类型 | ||
56 | - char freight_ton[260]; //货车吨级 | ||
57 | - float name_score; //识别置信度 | ||
58 | - int index; | 48 | + char vehicle_brand[260] {}; //车辆品牌 |
49 | + char vehicle_subbrand[260] {}; //车辆子品牌 | ||
50 | + char vehicle_issue_year[260] {}; //车辆年款 | ||
51 | + char vehicle_type[260] {}; //车辆类型 | ||
52 | + char freight_ton[260] {}; //货车吨级 | ||
53 | + float name_score{0.0}; //识别置信度 | ||
54 | + int index{-1}; | ||
59 | }vr_result; | 55 | }vr_result; |
60 | #endif | 56 | #endif |
61 | 57 | ||
@@ -80,9 +76,9 @@ typedef struct vr_result //结果 | @@ -80,9 +76,9 @@ typedef struct vr_result //结果 | ||
80 | #define VPLATENUM_RESULT_ | 76 | #define VPLATENUM_RESULT_ |
81 | typedef struct vplate_num | 77 | typedef struct vplate_num |
82 | { | 78 | { |
83 | - char character[4]; | ||
84 | - float maxprob; | ||
85 | - int index; | 79 | + char character[4] {}; |
80 | + float maxprob{0.0}; | ||
81 | + int index{-1}; | ||
86 | }vplate_num; | 82 | }vplate_num; |
87 | #endif | 83 | #endif |
88 | 84 | ||
@@ -96,8 +92,8 @@ typedef struct vplate_num | @@ -96,8 +92,8 @@ typedef struct vplate_num | ||
96 | #define SVP_RESULT_ | 92 | #define SVP_RESULT_ |
97 | typedef struct stain_vplate_result | 93 | typedef struct stain_vplate_result |
98 | { | 94 | { |
99 | - float score; //识别置信度 | ||
100 | - int type; //COVER 或者 NO_COVER 或者 NORMAL 或者 PARTIAL | 95 | + float score{0.0}; //识别置信度 |
96 | + int type{0}; //车牌状态:0-无车牌,1-车牌,2-遮挡车牌 | ||
101 | }stain_vplate_result; | 97 | }stain_vplate_result; |
102 | #endif | 98 | #endif |
103 | 99 | ||
@@ -106,12 +102,12 @@ typedef struct vplate_num | @@ -106,12 +102,12 @@ typedef struct vplate_num | ||
106 | typedef struct vplate_results | 102 | typedef struct vplate_results |
107 | { | 103 | { |
108 | sy_rect rect;//车牌检测坐标 | 104 | sy_rect rect;//车牌检测坐标 |
109 | - float detect_score;//车牌检测置信度 | 105 | + float detect_score{0.0};//车牌检测置信度 |
110 | vplate_num recg[PLATENUM];//识别号码结果 | 106 | vplate_num recg[PLATENUM];//识别号码结果 |
111 | - float num_score;//识别置信度 | ||
112 | - int type; //车牌类型:0-单排蓝色 1-单排黄色 2-单排白色 3-单排黑色 4-双排黄色 5-双排白色 6-新能源黄绿色 7-新能源白绿色 | 107 | + float num_score{0.0};//识别置信度 |
108 | + int type{-1}; //车牌类型:0-单排蓝色 1-单排黄色 2-单排白色 3-单排黑色 4-双排黄色 5-双排白色 6-新能源黄绿色 7-新能源白绿色 | ||
113 | 109 | ||
114 | - int special_type; //常规车牌、临时车牌、低速车牌。0-common,1-temporary_license_plate,2-low_speed_license_plate. | 110 | + int special_type{0}; //常规车牌、临时车牌、低速车牌。0-common,1-temporary_license_plate,2-low_speed_license_plate. |
115 | stain_vplate_result stain_vp_result; //车牌遮挡识别结果 | 111 | stain_vplate_result stain_vp_result; //车牌遮挡识别结果 |
116 | }vplate_results; | 112 | }vplate_results; |
117 | #endif | 113 | #endif |
@@ -125,17 +121,17 @@ typedef struct vplate_results | @@ -125,17 +121,17 @@ typedef struct vplate_results | ||
125 | typedef struct v_pendant_d_info | 121 | typedef struct v_pendant_d_info |
126 | { | 122 | { |
127 | sy_rect rect; | 123 | sy_rect rect; |
128 | - int index; //类型 0-driver 1-face 2-belt 3-sunshield 4-tag 5-decoration 6-napkinbox 7-zhuanjt 8-callPhone 9-sunRoof 10-holder 11-smoke | ||
129 | - float confidence; //置信度 | 124 | + int index{-1}; //类型 0-driver 1-face 2-belt 3-sunshield 4-tag 5-decoration 6-napkinbox 7-zhuanjt 8-callPhone 9-sunRoof 10-holder 11-smoke |
125 | + float confidence{0.0}; //置信度 | ||
130 | 126 | ||
131 | - int driver_copilot_info; //车属性的主驾副驾信息,0-不分主驾副驾,1-主驾,2-副驾,(只有司机 、人脸、安全带、遮阳板、打电话、抽烟 区分主驾副驾,其他属性默认是输出0) | 127 | + int driver_copilot_info{0}; //车属性的主驾副驾信息,0-不分主驾副驾,1-主驾,2-副驾,(只有司机 、人脸、安全带、遮阳板、打电话、抽烟 区分主驾副驾,其他属性默认是输出0) |
132 | //float feature[VPD_FACE_FEATURESIZE]; //车属性中的人脸特征。 | 128 | //float feature[VPD_FACE_FEATURESIZE]; //车属性中的人脸特征。 |
133 | }v_pendant_d_info; | 129 | }v_pendant_d_info; |
134 | 130 | ||
135 | typedef struct v_pendant_d_result | 131 | typedef struct v_pendant_d_result |
136 | { | 132 | { |
137 | - v_pendant_d_info* vpd_res; | ||
138 | - int count; | 133 | + v_pendant_d_info vpd_res[300]; |
134 | + int count{0}; | ||
139 | }v_pendant_d_result; | 135 | }v_pendant_d_result; |
140 | #endif | 136 | #endif |
141 | 137 | ||
@@ -152,8 +148,8 @@ typedef struct v_pendant_d_result | @@ -152,8 +148,8 @@ typedef struct v_pendant_d_result | ||
152 | 148 | ||
153 | typedef struct vid_details | 149 | typedef struct vid_details |
154 | { | 150 | { |
155 | - int status; //是否违规 ILLEGAL:违规(抽烟 未系安全带 打电话) lEGAL:未违规(未抽烟 系安全带 未打电话) UNCERTAINTY:不确定 | ||
156 | - float confidence; //置信度 | 151 | + int status {UNCERTAINTY}; //是否违规 ILLEGAL:违规(抽烟 未系安全带 打电话) lEGAL:未违规(未抽烟 系安全带 未打电话) UNCERTAINTY:不确定 |
152 | + float confidence{0.0}; //置信度 | ||
157 | }vid_details; | 153 | }vid_details; |
158 | 154 | ||
159 | typedef struct vid_info | 155 | typedef struct vid_info |
@@ -181,7 +177,7 @@ typedef struct vid_result | @@ -181,7 +177,7 @@ typedef struct vid_result | ||
181 | #define VF_RESULT_ | 177 | #define VF_RESULT_ |
182 | typedef struct vf_result | 178 | typedef struct vf_result |
183 | { | 179 | { |
184 | - float feature[VA_FEATURESIZE]; | 180 | + float feature[VA_FEATURESIZE] {}; |
185 | }vf_result; | 181 | }vf_result; |
186 | #endif | 182 | #endif |
187 | 183 | ||
@@ -190,8 +186,8 @@ typedef struct vf_result | @@ -190,8 +186,8 @@ typedef struct vf_result | ||
190 | #define VS_INFORMATION_ | 186 | #define VS_INFORMATION_ |
191 | typedef struct vs_information | 187 | typedef struct vs_information |
192 | { | 188 | { |
193 | - float score;//车类型置信度 | ||
194 | - int index; //车类型索引0-10:"吊车", "罐装车", "货车", "渣土车", "轿运车","救援车", "垃圾车", "消防车", "清扫车", "随车吊","危化品车" | 189 | + float score {0.0};//车类型置信度 |
190 | + int index {-1}; //车类型索引0-10:"吊车", "罐装车", "货车", "渣土车", "轿运车","救援车", "垃圾车", "消防车", "清扫车", "随车吊","危化品车" | ||
195 | }vs_information; | 191 | }vs_information; |
196 | #endif | 192 | #endif |
197 | 193 | ||
@@ -201,7 +197,7 @@ typedef struct vs_information | @@ -201,7 +197,7 @@ typedef struct vs_information | ||
201 | typedef struct vs_result | 197 | typedef struct vs_result |
202 | { | 198 | { |
203 | vs_information vs_info[2];//车类型信息 | 199 | vs_information vs_info[2];//车类型信息 |
204 | - int count;//车类型的数量,是1,内部没设阈值 | 200 | + int count {-1};//车类型的数量,是1,内部没设阈值 |
205 | }vs_result; | 201 | }vs_result; |
206 | #endif | 202 | #endif |
207 | 203 | ||
@@ -214,8 +210,8 @@ typedef struct vs_result | @@ -214,8 +210,8 @@ typedef struct vs_result | ||
214 | #define MUCKTRUCKCOVER_RESULT_ | 210 | #define MUCKTRUCKCOVER_RESULT_ |
215 | typedef struct mucktruckcover_result | 211 | typedef struct mucktruckcover_result |
216 | { | 212 | { |
217 | - int status; //是否盖盖 COVER-盖盖 NOCOVER_NODIRT-无盖无土 NOCOVER_DIRT-无盖有土 | ||
218 | - float confidence; //置信度 | 213 | + int status {-1}; //是否盖盖 COVER-盖盖 NOCOVER_NODIRT-无盖无土 NOCOVER_DIRT-无盖有土 |
214 | + float confidence {0.0}; //置信度 | ||
219 | }mucktruckcover_result; | 215 | }mucktruckcover_result; |
220 | 216 | ||
221 | #endif | 217 | #endif |
@@ -234,7 +230,7 @@ typedef struct mucktruckcover_result | @@ -234,7 +230,7 @@ typedef struct mucktruckcover_result | ||
234 | 230 | ||
235 | typedef struct mta_details | 231 | typedef struct mta_details |
236 | { | 232 | { |
237 | - int status; //摩托车是否载人/摩托车驾驶人是否戴头盔/三轮车是否载人 UNCERTAINTY:不确定 | 233 | + int status{-1}; //摩托车是否载人/摩托车驾驶人是否戴头盔/三轮车是否载人 UNCERTAINTY:不确定 |
238 | float confidence{0.0}; //置信度 | 234 | float confidence{0.0}; //置信度 |
239 | }mta_details; | 235 | }mta_details; |
240 | 236 | ||
@@ -259,7 +255,7 @@ typedef struct manned_result | @@ -259,7 +255,7 @@ typedef struct manned_result | ||
259 | //float confidence; //置信度 | 255 | //float confidence; //置信度 |
260 | 256 | ||
261 | vd_result hs_rect[10]; //头肩坐标 | 257 | vd_result hs_rect[10]; //头肩坐标 |
262 | - int hs_count; //头肩个数 | 258 | + int hs_count{0}; //头肩个数 |
263 | }manned_result; | 259 | }manned_result; |
264 | #endif | 260 | #endif |
265 | 261 |