Commit 5a4c4dc0574b3f73c620ca789cb2d3082c001dc7

Authored by Hu Chunming
1 parent 404df7cd

va库代码移到本项目中

src/PicAnalysis.cpp
... ... @@ -38,10 +38,6 @@ int PicAnalysis::init(VillageParam param) {
38 38 vehicle_analysis_param.devId = dev_id;
39 39 vehicle_analysis_param.sdk_root = param.sdk_path;
40 40 vehicle_analysis_param.max_batch_size = 16;
41   - vehicle_analysis_param.log_level = param.log_level;
42   - vehicle_analysis_param.log_path = param.log_path;
43   - vehicle_analysis_param.log_days = param.log_days;
44   - vehicle_analysis_param.log_mem = param.log_mem;
45 41 ret = m_vehicle_analysis.init(vehicle_analysis_param);
46 42 if(0 != ret){
47 43 return -1;
... ...
src/ai_engine_module/VehicleAnalysis.cpp
1 1 #include "VehicleAnalysis.h"
2 2  
  3 +#include "VehicleAnalysisDevice.h"
  4 +
3 5  
4 6 VehicleAnalysis::VehicleAnalysis() {
5 7 cout << va_get_version() << endl;
... ... @@ -59,11 +61,6 @@ int VehicleAnalysis::init(VehicleAnalysisParam tParam) {
59 61 param.dbPath= (char*)dbPath.data();
60 62 param.models_Path= (char*)models_path.data(); //所有模型的地址
61 63  
62   - param.log_level = tParam.log_level;
63   - param.log_path = tParam.log_path;
64   - param.log_days = tParam.log_days;
65   - param.log_mem = tParam.log_mem;
66   -
67 64 LOG_INFO("va_init start");
68 65 // 内部有 ctx
69 66 int ret = va_init(&m_handle, param);
... ...
src/ai_engine_module/VehicleAnalysis.h
... ... @@ -15,10 +15,6 @@ struct VehicleAnalysisParam {
15 15 int devId;
16 16 std::string sdk_root;
17 17 int max_batch_size;
18   - int log_level{2};
19   - int log_days{30}; //日志保存周期
20   - std::string log_path{"logs"}; //日志文件路径
21   - unsigned long log_mem{64 * 1024 * 1024}; //每个日志最大大小
22 18 };
23 19  
24 20 struct VehicleAnalysisResult{
... ...
src/ai_engine_module/VehicleAnalysisDevice.cpp
... ... @@ -27,7 +27,7 @@
27 27 #include "head_shoulder_det.h"//ͷ�磨����������ˣ�
28 28  
29 29  
30   -// #include "VehicleAnalysisDevice.h"
  30 +#include "VehicleAnalysisDevice.h"
31 31  
32 32 #include "include.h"
33 33  
... ... @@ -41,7 +41,6 @@
41 41 #define FEATURESIZE 256 //��������
42 42  
43 43  
44   -
45 44 #define VR_HEAD_THRE 0.7 //��ͷ����ʶ����ֵ
46 45 #define VR_REAR_THRE 0.8 //��β����ʶ����ֵ
47 46 #define VR_CLS_THRE 0.25 //������������ֵ
... ... @@ -49,8 +48,6 @@
49 48 #define VR_LOGO_THRE 0.9 //��logo����ֵ
50 49 #define VR_15CLS_THRE 0.8 //����15�������ֵ
51 50  
52   -#define IF_DEBUG_INFO 0 //�Ƿ��ӡdebug��Ϣ
53   -
54 51 #define VERSION_WUXI 0 //�л����а汾�������汾�������汾��ֻ��topn���������������Ͳ���ʶ�𣬵�Ҫ���ӳ���15������������ȱʧ�ij����͡�
55 52 #define VR_WUXI_LOGO 1 //�����汾���Ƿ�����logo������
56 53 #define VPT_TOPN 10 //�˳���ȡtopn���з���
... ... @@ -60,8 +57,6 @@
60 57 using namespace std;
61 58  
62 59  
63   -//static int va_acl_flag=0;
64   -
65 60 typedef struct va_handle
66 61 {
67 62 void* vpt_handle;
... ... @@ -121,33 +116,14 @@ const char * va_get_version()
121 116 return "sy_va_version:1.2.0.20231129.atlas310p.arm.withOfflineAuthorization";
122 117 }
123 118  
124   -
125   -int va_acl_init()
126   -{
127   - if(IF_DEBUG_INFO) {
128   - LOG_INFO("start aclInit ");
129   - }
130   - ACL_CALL(aclInit(nullptr), ACL_ERROR_NONE, SY_FAILED);
131   - if(IF_DEBUG_INFO){
132   - LOG_DEBUG("end aclInit ");
133   - }
134   -
135   - return SUCCESS;
136   -}
137   -
138 119 int va_init(void ** handle, va_param param)
139 120 {
140   - string log_path = param.log_path + "/va.log";
141   -
142   - set_default_logger(LogLevel(param.log_level), "PicAnalysis", log_path.c_str(), param.log_mem, param.log_days);
143   -
144 121 va_handle *tools=new va_handle();
145 122 *handle=(void *)tools;
146 123  
147 124 int ret = SUCCESS;
148 125 tools->param = param;
149 126  
150   -
151 127 string str1=tools->param.models_Path;
152 128  
153 129  
... ... @@ -654,41 +630,12 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
654 630 result[b].count=0;
655 631 for(int c=0;c<VD_MAXDETECTCOUNT;c++)
656 632 {
657   -
658   - //1.vd
659   - result[b].info[c].vehicle_body_detect_res.rect = rect_init;
660   - result[b].info[c].vehicle_body_detect_res.score = 0;
661   -
662   - result[b].info[c].vehicle_detect_res.rect = rect_init;
663   - result[b].info[c].vehicle_detect_res.score = 0;
664   -
665   - result[b].info[c].vehicle_win_detect_res.rect = rect_init;
666   - result[b].info[c].vehicle_win_detect_res.score = 0;
667   -
668   - //3.vc����ɫ
669   - result[b].info[c].vehicle_color_res.index = -1;
670   - result[b].info[c].vehicle_color_res.score = 0;
671   - //result[b].info[c].vehicle_fea_res.feature[FEATURESIZE + 8] = 0;//20201201wh�������ij���ɫ��Ϣ
672   -
673 633 //4.vr����
674 634 memset(result[b].info[c].vehicle_recg_res.vehicle_brand, '\0', sizeof(result[b].info[c].vehicle_recg_res.vehicle_brand));
675 635 memset(result[b].info[c].vehicle_recg_res.vehicle_subbrand, '\0', sizeof(result[b].info[c].vehicle_recg_res.vehicle_subbrand));
676 636 memset(result[b].info[c].vehicle_recg_res.vehicle_issue_year, '\0', sizeof(result[b].info[c].vehicle_recg_res.vehicle_issue_year));
677 637 memset(result[b].info[c].vehicle_recg_res.vehicle_type, '\0', sizeof(result[b].info[c].vehicle_recg_res.vehicle_type));
678 638 memset(result[b].info[c].vehicle_recg_res.freight_ton, '\0', sizeof(result[b].info[c].vehicle_recg_res.freight_ton));
679   - result[b].info[c].vehicle_recg_res.name_score = 0;
680   - result[b].info[c].vehicle_recg_res.index = -1;
681   - //result[b].info[c].vehicle_fea_res.feature[FEATURESIZE +9] = 0;//20201201wh��������vr��Ϣ
682   - //result[b].info[c].vehicle_fea_res.feature[FEATURESIZE +10] = 0;//20201201wh��������vr��Ϣ
683   -
684   -
685   - //5.���Ƽ��ʶ��
686   - result[b].info[c].vehicle_plate_det_recg_res.special_type = 0;//������������20200225
687   - result[b].info[c].vehicle_plate_det_recg_res.type = -1;
688   - result[b].info[c].vehicle_plate_det_recg_res.num_score = 0;
689   - result[b].info[c].vehicle_plate_det_recg_res.detect_score = 0;
690   -
691   - result[b].info[c].vehicle_plate_det_recg_res.rect = rect_init;
692 639  
693 640 for(int p=0;p<PLATENUM;p++)
694 641 {
... ... @@ -700,69 +647,13 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
700 647 {
701 648 result[b].info[c].vehicle_fea_res.feature[FEATURESIZE*2+p] = 0;
702 649 }
703   -
704   - //6.������
705   - result[b].info[c].vehicle_pendant_det_res.count=0;
706   - for(int p=0; p<VPD_MAXNUM; p++)
707   - {
708   - //result[b].info[c].vehicle_pendant_det_res.vpd_res[p].rect = vpd_result_[win_idx].vpd_res[p].rect;
709   - result[b].info[c].vehicle_pendant_det_res.vpd_res[p].rect = rect_init;
710   - result[b].info[c].vehicle_pendant_det_res.vpd_res[p].confidence = 0;
711   - result[b].info[c].vehicle_pendant_det_res.vpd_res[p].index = -1;
712   - result[b].info[c].vehicle_pendant_det_res.vpd_res[p].driver_copilot_info = 0; //wh20210618����������������֮��
713   - //memset(result[b].info[c].vehicle_pendant_det_res.vpd_res[p].feature,0,sizeof(float)*VPD_FACE_FEATURESIZE);//wh20210618������������������
714   - }
715   - //result[b].info[c].vehicle_fea_res.feature[FEATURESIZE +11] = 0;//20201201wh��������vpd��Ϣ
716   -
717   - //7.vid��Υ��
718   - result[b].info[c].vehicle_illegal_det_res.driver.person.status = UNCERTAINTY;
719   - result[b].info[c].vehicle_illegal_det_res.driver.person.confidence = 0;
720   - result[b].info[c].vehicle_illegal_det_res.driver.belt.status = UNCERTAINTY;
721   - result[b].info[c].vehicle_illegal_det_res.driver.belt.confidence = 0;
722   - result[b].info[c].vehicle_illegal_det_res.driver.smoke.status = UNCERTAINTY;
723   - result[b].info[c].vehicle_illegal_det_res.driver.smoke.confidence = 0;
724   - result[b].info[c].vehicle_illegal_det_res.driver.phone.status = UNCERTAINTY;
725   - result[b].info[c].vehicle_illegal_det_res.driver.phone.confidence = 0;
726   - result[b].info[c].vehicle_illegal_det_res.driver.call.status = UNCERTAINTY;
727   - result[b].info[c].vehicle_illegal_det_res.driver.call.confidence = 0;
728   -
729   - result[b].info[c].vehicle_illegal_det_res.copilot.person.status = UNCERTAINTY;
730   - result[b].info[c].vehicle_illegal_det_res.copilot.person.confidence = 0;
731   - result[b].info[c].vehicle_illegal_det_res.copilot.belt.status = UNCERTAINTY;
732   - result[b].info[c].vehicle_illegal_det_res.copilot.belt.confidence = 0;
733   - result[b].info[c].vehicle_illegal_det_res.copilot.smoke.status = UNCERTAINTY;
734   - result[b].info[c].vehicle_illegal_det_res.copilot.smoke.confidence = 0;
735   - result[b].info[c].vehicle_illegal_det_res.copilot.phone.status = UNCERTAINTY;
736   - result[b].info[c].vehicle_illegal_det_res.copilot.phone.confidence = 0;
737   - result[b].info[c].vehicle_illegal_det_res.copilot.call.status = UNCERTAINTY;
738   - result[b].info[c].vehicle_illegal_det_res.copilot.call.confidence = 0;
739 650  
740 651 //8.vf������
741 652 memset(result[b].info[c].vehicle_fea_res.feature,0,sizeof(float)*VA_FEATURESIZE);
742 653  
743   - //mat
744   - result[b].info[c].mta_res.motor_driver_helmeted.status=-1;
745   - result[b].info[c].mta_res.motor_driver_helmeted.confidence=0;
746   - result[b].info[c].mta_res.motor_manned.status=-1;
747   - result[b].info[c].mta_res.motor_manned.confidence=0;
748   - result[b].info[c].mta_res.tricycle_manned.status=-1;
749   - result[b].info[c].mta_res.tricycle_manned.confidence=0;
750   -
751   - result[b].info[c].mta_res.motor_driver_hs_rect.rect = rect_init;
752   - result[b].info[c].mta_res.motor_driver_hs_rect.score=0;
753   -
754   - //���˷���manned_analysis
755   - //result[b].info[c].manned_res.status = 0;
756   - //result[b].info[c].manned_res.confidence = 0;
757   - result[b].info[c].manned_res.hs_count = 0;
758   - memset(result[b].info[c].manned_res.hs_rect,0,sizeof(vd_result)*10);
759   -
760 654 }
761 655 }//end result��ֵ
762   -
763   -
764   -
765   -
  656 +
766 657  
767 658 //��ͷ��β�����ı�ǩ
768 659 int car_body_num=0;//body�������
... ... @@ -1093,8 +984,6 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
1093 984  
1094 985 body_idx++;
1095 986 }
1096   -
1097   -
1098 987 }
1099 988 }
1100 989  
... ... @@ -1377,28 +1266,11 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
1377 1266  
1378 1267 if (vp_result[head_idx].count==0 || max_index == -1 )//û��⵽����
1379 1268 {
1380   - info_c.vehicle_plate_det_recg_res.special_type = 0;//���⳵������20200225//���泵�ơ����ٳ��ơ���ʱ���ơ�0-common,1-low_speed_license_plate,2-temporary_license_plate.
1381   - info_c.vehicle_plate_det_recg_res.stain_vp_result.score = 0;
1382   - info_c.vehicle_plate_det_recg_res.stain_vp_result.type = -1;
1383   -
1384   - info_c.vehicle_plate_det_recg_res.type = 0;
1385   - info_c.vehicle_plate_det_recg_res.num_score = 0;
1386   - info_c.vehicle_plate_det_recg_res.detect_score = 0;
1387   -
1388   - info_c.vehicle_plate_det_recg_res.rect.left_ = 0;
1389   - info_c.vehicle_plate_det_recg_res.rect.top_ = 0;
1390   - info_c.vehicle_plate_det_recg_res.rect.width_ = 0;
1391   - info_c.vehicle_plate_det_recg_res.rect.height_ = 0;
1392   -
1393 1269 for(int p=0;p<PLATENUM;p++)
1394 1270 {
1395   - info_c.vehicle_plate_det_recg_res.recg[p].index = 0;
1396   - info_c.vehicle_plate_det_recg_res.recg[p].maxprob = 0;
1397   - //info_c.vehicle_plate_det_recg_res.recg[p].character = NULL;
1398 1271 memset(info_c.vehicle_plate_det_recg_res.recg[p].character, '\0', sizeof(info_c.vehicle_plate_det_recg_res.recg[p].character));
1399 1272 }
1400   -
1401   - //20201201wh���������ӳ�������
  1273 +
1402 1274 for(int p=0;p<PLATENUM;p++)
1403 1275 {
1404 1276 info_c.vehicle_fea_res.feature[FEATURESIZE*2+p] = 0;
... ... @@ -1412,18 +1284,13 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
1412 1284 info_c.vehicle_plate_det_recg_res.type = vp_result[head_idx].vehicle_plate_infos[max_index].type;
1413 1285 info_c.vehicle_plate_det_recg_res.num_score = vp_result[head_idx].vehicle_plate_infos[max_index].num_score;
1414 1286 info_c.vehicle_plate_det_recg_res.detect_score = vp_result[head_idx].vehicle_plate_infos[max_index].detect_score;
1415   - if (info_c.vehicle_plate_det_recg_res.detect_score > 0.1 && info_c.vehicle_plate_det_recg_res.stain_vp_result.type == 1)
1416   - {
1417   - info_c.vehicle_plate_det_recg_res.stain_vp_result.type = 2;
1418   - info_c.vehicle_plate_det_recg_res.stain_vp_result.score = info_c.vehicle_plate_det_recg_res.detect_score;
1419   - }
1420   -
1421   -
  1287 +
1422 1288 info_c.vehicle_plate_det_recg_res.rect.left_ = vp_result[head_idx].vehicle_plate_infos[max_index].rect.left_ * scale_w[head_idx]+ info_c.vehicle_detect_res.rect.left_;
1423 1289 info_c.vehicle_plate_det_recg_res.rect.top_ = vp_result[head_idx].vehicle_plate_infos[max_index].rect.top_ * scale_h[head_idx]+ info_c.vehicle_detect_res.rect.top_;
1424 1290 info_c.vehicle_plate_det_recg_res.rect.width_ = vp_result[head_idx].vehicle_plate_infos[max_index].rect.width_ * scale_w[head_idx];
1425 1291 info_c.vehicle_plate_det_recg_res.rect.height_ = vp_result[head_idx].vehicle_plate_infos[max_index].rect.height_* scale_h[head_idx];
1426 1292  
  1293 + int space_char_num = 0;
1427 1294 for(int p=0;p<PLATENUM;p++)
1428 1295 {
1429 1296 info_c.vehicle_plate_det_recg_res.recg[p].index = vp_result[head_idx].vehicle_plate_infos[max_index].recg[p].index;
... ... @@ -1433,7 +1300,25 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
1433 1300 info_c.vehicle_plate_det_recg_res.recg[p].character[1] = vp_result[head_idx].vehicle_plate_infos[max_index].recg[p].character[1];
1434 1301 info_c.vehicle_plate_det_recg_res.recg[p].character[2] = vp_result[head_idx].vehicle_plate_infos[max_index].recg[p].character[2];
1435 1302 info_c.vehicle_plate_det_recg_res.recg[p].character[3] = vp_result[head_idx].vehicle_plate_infos[max_index].recg[p].character[3];
1436   - }
  1303 +
  1304 + if (fabs(info_c.vehicle_plate_det_recg_res.recg[p].maxprob) < 0.0001) {
  1305 + space_char_num++ ;
  1306 + }
  1307 + }
  1308 +
  1309 + auto plate_info = info_c.vehicle_plate_det_recg_res;
  1310 + LOG_DEBUG(" 号牌号码:{}{}{}{}{}{}{}{}", plate_info.recg[0].character, plate_info.recg[1].character, plate_info.recg[2].character, plate_info.recg[3].character, plate_info.recg[4].character, plate_info.recg[5].character, plate_info.recg[6].character, plate_info.recg[7].character);
  1311 +
  1312 + if (info_c.vehicle_plate_det_recg_res.stain_vp_result.type == 0)
  1313 + {
  1314 + if (space_char_num == 0) {
  1315 + info_c.vehicle_plate_det_recg_res.stain_vp_result.type = 1;
  1316 + info_c.vehicle_plate_det_recg_res.stain_vp_result.score = info_c.vehicle_plate_det_recg_res.detect_score;
  1317 + } else if (space_char_num > 0 && space_char_num < PLATENUM) {
  1318 + info_c.vehicle_plate_det_recg_res.stain_vp_result.type = 2;
  1319 + info_c.vehicle_plate_det_recg_res.stain_vp_result.score = info_c.vehicle_plate_det_recg_res.detect_score;
  1320 + }
  1321 + }
1437 1322  
1438 1323 //20201201wh���������ӳ�����Ϣ
1439 1324 for(int p=0;p<PLATENUM;p++)
... ... @@ -1728,25 +1613,9 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
1728 1613 }
1729 1614  
1730 1615 if (vp_result[rear_idx].count==0 || vp_result[rear_idx].vehicle_plate_infos[max_index].rect.left_ == -1 )//û��⵽����
1731   - {
1732   - info_c.vehicle_plate_det_recg_res.special_type = 0;//���⳵������20200225
1733   - info_c.vehicle_plate_det_recg_res.stain_vp_result.score = 0;
1734   - info_c.vehicle_plate_det_recg_res.stain_vp_result.type = -1;
1735   -
1736   - info_c.vehicle_plate_det_recg_res.type = 0;
1737   - info_c.vehicle_plate_det_recg_res.num_score = 0;
1738   - info_c.vehicle_plate_det_recg_res.detect_score = 0;
1739   -
1740   - info_c.vehicle_plate_det_recg_res.rect.left_ = 0;
1741   - info_c.vehicle_plate_det_recg_res.rect.top_ = 0;
1742   - info_c.vehicle_plate_det_recg_res.rect.width_ = 0;
1743   - info_c.vehicle_plate_det_recg_res.rect.height_ = 0;
1744   -
  1616 + {
1745 1617 for(int p=0;p<PLATENUM;p++)
1746 1618 {
1747   - info_c.vehicle_plate_det_recg_res.recg[p].index = 0;
1748   - info_c.vehicle_plate_det_recg_res.recg[p].maxprob = 0;
1749   - //info_c.vehicle_plate_det_recg_res.recg[p].character = NULL;
1750 1619 memset(info_c.vehicle_plate_det_recg_res.recg[p].character, '\0', sizeof(info_c.vehicle_plate_det_recg_res.recg[p].character));
1751 1620 }
1752 1621  
... ... @@ -1763,29 +1632,42 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
1763 1632 info_c.vehicle_plate_det_recg_res.type = vp_result[rear_idx].vehicle_plate_infos[max_index].type;
1764 1633 info_c.vehicle_plate_det_recg_res.num_score = vp_result[rear_idx].vehicle_plate_infos[max_index].num_score;
1765 1634 info_c.vehicle_plate_det_recg_res.detect_score = vp_result[rear_idx].vehicle_plate_infos[max_index].detect_score;
1766   - if (info_c.vehicle_plate_det_recg_res.detect_score > 0.1 && info_c.vehicle_plate_det_recg_res.stain_vp_result.type == 1)
1767   - {
1768   - info_c.vehicle_plate_det_recg_res.stain_vp_result.type = 2;
1769   - info_c.vehicle_plate_det_recg_res.stain_vp_result.score = info_c.vehicle_plate_det_recg_res.detect_score;
1770   - }
1771 1635  
1772 1636 info_c.vehicle_plate_det_recg_res.rect.left_ = vp_result[rear_idx].vehicle_plate_infos[max_index].rect.left_ * scale_w[rear_idx] + info_c.vehicle_body_detect_res.rect.left_;
1773 1637 info_c.vehicle_plate_det_recg_res.rect.top_ = vp_result[rear_idx].vehicle_plate_infos[max_index].rect.top_ * scale_h[rear_idx] + info_c.vehicle_body_detect_res.rect.top_;
1774 1638 info_c.vehicle_plate_det_recg_res.rect.width_ = vp_result[rear_idx].vehicle_plate_infos[max_index].rect.width_* scale_w[rear_idx];
1775 1639 info_c.vehicle_plate_det_recg_res.rect.height_ = vp_result[rear_idx].vehicle_plate_infos[max_index].rect.height_* scale_h[rear_idx];
1776 1640  
  1641 + int space_char_num = 0;
1777 1642 for(int p=0;p<PLATENUM;p++)
1778 1643 {
1779 1644 info_c.vehicle_plate_det_recg_res.recg[p].index = vp_result[rear_idx].vehicle_plate_infos[max_index].recg[p].index;
1780   -
1781 1645 info_c.vehicle_plate_det_recg_res.recg[p].maxprob = vp_result[rear_idx].vehicle_plate_infos[max_index].recg[p].maxprob;
1782 1646 //info_c.vehicle_plate_det_recg_res.recg[p].character = vp_result[idx][j].recg[p].character;
1783 1647 info_c.vehicle_plate_det_recg_res.recg[p].character[0] = vp_result[rear_idx].vehicle_plate_infos[max_index].recg[p].character[0];
1784 1648 info_c.vehicle_plate_det_recg_res.recg[p].character[1] = vp_result[rear_idx].vehicle_plate_infos[max_index].recg[p].character[1];
1785 1649 info_c.vehicle_plate_det_recg_res.recg[p].character[2] = vp_result[rear_idx].vehicle_plate_infos[max_index].recg[p].character[2];
1786 1650 info_c.vehicle_plate_det_recg_res.recg[p].character[3] = vp_result[rear_idx].vehicle_plate_infos[max_index].recg[p].character[3];
  1651 +
  1652 + if (fabs(info_c.vehicle_plate_det_recg_res.recg[p].maxprob) < 0.0001) {
  1653 + space_char_num++ ;
  1654 + }
1787 1655 }
1788   - //20201201���ӳ������ij�����Ϣ
  1656 +
  1657 + auto plate_info = info_c.vehicle_plate_det_recg_res;
  1658 + LOG_DEBUG(" 号牌号码:{}{}{}{}{}{}{}{}", plate_info.recg[0].character, plate_info.recg[1].character, plate_info.recg[2].character, plate_info.recg[3].character, plate_info.recg[4].character, plate_info.recg[5].character, plate_info.recg[6].character, plate_info.recg[7].character);
  1659 +
  1660 + if (info_c.vehicle_plate_det_recg_res.stain_vp_result.type == 0)
  1661 + {
  1662 + if (space_char_num == 0) {
  1663 + info_c.vehicle_plate_det_recg_res.stain_vp_result.type = 1;
  1664 + info_c.vehicle_plate_det_recg_res.stain_vp_result.score = info_c.vehicle_plate_det_recg_res.detect_score;
  1665 + } else if (space_char_num > 0 && space_char_num < PLATENUM) {
  1666 + info_c.vehicle_plate_det_recg_res.stain_vp_result.type = 2;
  1667 + info_c.vehicle_plate_det_recg_res.stain_vp_result.score = info_c.vehicle_plate_det_recg_res.detect_score;
  1668 + }
  1669 + }
  1670 +
1789 1671 for(int p=0;p<PLATENUM;p++)
1790 1672 {
1791 1673 info_c.vehicle_fea_res.feature[FEATURESIZE*2+p] = (float)vp_result[rear_idx].vehicle_plate_infos[max_index].recg[p].index;
... ... @@ -2019,9 +1901,11 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
2019 1901 LOG_DEBUG("end 7.head win vf+vid ----- ");
2020 1902  
2021 1903 }
2022   - //process_vidresult(handle, batch_size, result);
  1904 +
  1905 + LOG_DEBUG("process_vidresult_atlas");
2023 1906 process_vidresult_atlas(handle, batch_size, result);
2024 1907  
  1908 + LOG_DEBUG("motor_num:{}", motor_num);
2025 1909 if(motor_num>0)
2026 1910 {
2027 1911 //double t22 = msecond();
... ... @@ -2083,19 +1967,20 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
2083 1967 {
2084 1968 for(int c=0;c<result[b].count;c++)
2085 1969 {
2086   - if(result[b].info[c].type == 2)///Ħ��
2087   - {
  1970 + auto& info_c = result[b].info[c];
  1971 + if(info_c.type == 2)///Ħ��
  1972 + { //摩托车
2088 1973 int res_index = hcp_result[motor_idx].res_objs[0].res_index;//��ȡĦ�г���ʻ�˵�head������
2089 1974 float res_socre = hcp_result[motor_idx].res_objs[0].res_prob;
2090 1975 if(res_index == 4)//head������ͷ��
2091 1976 {
2092   - result[b].info[c].mta_res.motor_driver_helmeted.status=MOTOR_DRIVER_HELMETED;//��ͷ��
2093   - result[b].info[c].mta_res.motor_driver_helmeted.confidence=res_socre;
  1977 + info_c.mta_res.motor_driver_helmeted.status=MOTOR_DRIVER_HELMETED;//��ͷ��
  1978 + info_c.mta_res.motor_driver_helmeted.confidence=res_socre;
2094 1979 }
2095 1980 else
2096 1981 {
2097   - result[b].info[c].mta_res.motor_driver_helmeted.status=MOTOR_DRIVER_NOT_HELMETED;//δ��ͷ��
2098   - result[b].info[c].mta_res.motor_driver_helmeted.confidence=res_socre;
  1982 + info_c.mta_res.motor_driver_helmeted.status=MOTOR_DRIVER_NOT_HELMETED;//δ��ͷ��
  1983 + info_c.mta_res.motor_driver_helmeted.confidence=res_socre;
2099 1984 }
2100 1985  
2101 1986 motor_idx++;
... ... @@ -2113,6 +1998,7 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
2113 1998 }
2114 1999  
2115 2000 int tricycle_batch_size = tricycle_num + (car_body_num - head_num -rear_num);//type ==4��type = 3��Ŀ��
  2001 + LOG_DEBUG("tricycle_batch_size:{}", tricycle_batch_size);
2116 2002 if(tricycle_batch_size>0)
2117 2003 {
2118 2004 LOG_DEBUG("start :tricycle_img_data.");
... ... @@ -2186,7 +2072,8 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
2186 2072 {
2187 2073 for(int c=0;c<result[b].count;c++)
2188 2074 {
2189   - if(result[b].info[c].type == 3 || result[b].info[c].type == 4)//��tricycle �� ����
  2075 + auto& info_c = result[b].info[c];
  2076 + if(info_c.type == 3 || info_c.type == 4)//��tricycle �� ����
2190 2077 {
2191 2078 //ͳ�Ʒ�����ߵij���
2192 2079 int max_index = 0;
... ... @@ -2203,47 +2090,54 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
2203 2090  
2204 2091 if (vp_result[tricycle_idx].count==0 || max_index == -1 )//û��⵽����
2205 2092 {
2206   - result[b].info[c].vehicle_plate_det_recg_res.special_type = 0;//���⳵������20200225
2207   -
2208   - result[b].info[c].vehicle_plate_det_recg_res.type = 0;
2209   - result[b].info[c].vehicle_plate_det_recg_res.num_score = 0;
2210   - result[b].info[c].vehicle_plate_det_recg_res.detect_score = 0;
2211   -
2212   - result[b].info[c].vehicle_plate_det_recg_res.rect.left_ = result[b].info[c].vehicle_body_detect_res.rect.left_;
2213   - result[b].info[c].vehicle_plate_det_recg_res.rect.top_ = result[b].info[c].vehicle_body_detect_res.rect.top_;
2214   - result[b].info[c].vehicle_plate_det_recg_res.rect.width_ = 0;
2215   - result[b].info[c].vehicle_plate_det_recg_res.rect.height_ = 0;
  2093 + info_c.vehicle_plate_det_recg_res.rect.left_ = info_c.vehicle_body_detect_res.rect.left_;
  2094 + info_c.vehicle_plate_det_recg_res.rect.top_ = info_c.vehicle_body_detect_res.rect.top_;
2216 2095  
2217 2096 for(int p=0;p<PLATENUM;p++)
2218 2097 {
2219   - result[b].info[c].vehicle_plate_det_recg_res.recg[p].index = 0;
2220   - result[b].info[c].vehicle_plate_det_recg_res.recg[p].maxprob = 0;
2221   - //result[b].info[c].vehicle_plate_det_recg_res.recg[p].character = NULL;
2222   - memset(result[b].info[c].vehicle_plate_det_recg_res.recg[p].character, '\0', sizeof(result[b].info[c].vehicle_plate_det_recg_res.recg[p].character));
  2098 + memset(info_c.vehicle_plate_det_recg_res.recg[p].character, '\0', sizeof(info_c.vehicle_plate_det_recg_res.recg[p].character));
2223 2099 }
2224 2100  
2225   - }
2226   - else{
2227   - result[b].info[c].vehicle_plate_det_recg_res.type = vp_result[tricycle_idx].vehicle_plate_infos[max_index].type;
2228   - result[b].info[c].vehicle_plate_det_recg_res.num_score = vp_result[tricycle_idx].vehicle_plate_infos[max_index].num_score;
2229   - result[b].info[c].vehicle_plate_det_recg_res.detect_score = vp_result[tricycle_idx].vehicle_plate_infos[max_index].detect_score;
  2101 + } else{
  2102 + info_c.vehicle_plate_det_recg_res.type = vp_result[tricycle_idx].vehicle_plate_infos[max_index].type;
  2103 + info_c.vehicle_plate_det_recg_res.num_score = vp_result[tricycle_idx].vehicle_plate_infos[max_index].num_score;
  2104 + info_c.vehicle_plate_det_recg_res.detect_score = vp_result[tricycle_idx].vehicle_plate_infos[max_index].detect_score;
2230 2105  
2231   - result[b].info[c].vehicle_plate_det_recg_res.rect.left_ = vp_result[tricycle_idx].vehicle_plate_infos[max_index].rect.left_ * scale_w[tricycle_idx] + result[b].info[c].vehicle_body_detect_res.rect.left_;//ӳ�䳵��
2232   - result[b].info[c].vehicle_plate_det_recg_res.rect.top_ = vp_result[tricycle_idx].vehicle_plate_infos[max_index].rect.top_ * scale_h[tricycle_idx] + result[b].info[c].vehicle_body_detect_res.rect.top_;//ӳ�䳵��
2233   - result[b].info[c].vehicle_plate_det_recg_res.rect.width_ = vp_result[tricycle_idx].vehicle_plate_infos[max_index].rect.width_ * scale_w[tricycle_idx];
2234   - result[b].info[c].vehicle_plate_det_recg_res.rect.height_ = vp_result[tricycle_idx].vehicle_plate_infos[max_index].rect.height_ * scale_h[tricycle_idx];
  2106 + info_c.vehicle_plate_det_recg_res.rect.left_ = vp_result[tricycle_idx].vehicle_plate_infos[max_index].rect.left_ * scale_w[tricycle_idx] + info_c.vehicle_body_detect_res.rect.left_;//ӳ�䳵��
  2107 + info_c.vehicle_plate_det_recg_res.rect.top_ = vp_result[tricycle_idx].vehicle_plate_infos[max_index].rect.top_ * scale_h[tricycle_idx] + info_c.vehicle_body_detect_res.rect.top_;//ӳ�䳵��
  2108 + info_c.vehicle_plate_det_recg_res.rect.width_ = vp_result[tricycle_idx].vehicle_plate_infos[max_index].rect.width_ * scale_w[tricycle_idx];
  2109 + info_c.vehicle_plate_det_recg_res.rect.height_ = vp_result[tricycle_idx].vehicle_plate_infos[max_index].rect.height_ * scale_h[tricycle_idx];
2235 2110  
  2111 + int space_char_num = 0;
2236 2112 for(int p=0;p<PLATENUM;p++)
2237 2113 {
2238   - result[b].info[c].vehicle_plate_det_recg_res.recg[p].index = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].index;
2239   -
2240   - result[b].info[c].vehicle_plate_det_recg_res.recg[p].maxprob = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].maxprob;
2241   - //result[b].info[c].vehicle_plate_det_recg_res.recg[p].character = vp_result[idx][j].recg[p].character;
2242   - result[b].info[c].vehicle_plate_det_recg_res.recg[p].character[0] = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].character[0];
2243   - result[b].info[c].vehicle_plate_det_recg_res.recg[p].character[1] = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].character[1];
2244   - result[b].info[c].vehicle_plate_det_recg_res.recg[p].character[2] = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].character[2];
2245   - result[b].info[c].vehicle_plate_det_recg_res.recg[p].character[3] = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].character[3];
2246   - }
  2114 + info_c.vehicle_plate_det_recg_res.recg[p].index = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].index;
  2115 +
  2116 + info_c.vehicle_plate_det_recg_res.recg[p].maxprob = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].maxprob;
  2117 + //info_c.vehicle_plate_det_recg_res.recg[p].character = vp_result[idx][j].recg[p].character;
  2118 + info_c.vehicle_plate_det_recg_res.recg[p].character[0] = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].character[0];
  2119 + info_c.vehicle_plate_det_recg_res.recg[p].character[1] = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].character[1];
  2120 + info_c.vehicle_plate_det_recg_res.recg[p].character[2] = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].character[2];
  2121 + info_c.vehicle_plate_det_recg_res.recg[p].character[3] = vp_result[tricycle_idx].vehicle_plate_infos[max_index].recg[p].character[3];
  2122 +
  2123 + if (fabs(info_c.vehicle_plate_det_recg_res.recg[p].maxprob) < 0.0001) {
  2124 + space_char_num++ ;
  2125 + }
  2126 + }
  2127 +
  2128 + auto plate_info = info_c.vehicle_plate_det_recg_res;
  2129 + LOG_DEBUG(" 号牌号码:{}{}{}{}{}{}{}{}", plate_info.recg[0].character, plate_info.recg[1].character, plate_info.recg[2].character, plate_info.recg[3].character, plate_info.recg[4].character, plate_info.recg[5].character, plate_info.recg[6].character, plate_info.recg[7].character);
  2130 +
  2131 + if (info_c.vehicle_plate_det_recg_res.stain_vp_result.type == 0)
  2132 + {
  2133 + if (space_char_num == 0) {
  2134 + info_c.vehicle_plate_det_recg_res.stain_vp_result.type = 1;
  2135 + info_c.vehicle_plate_det_recg_res.stain_vp_result.score = info_c.vehicle_plate_det_recg_res.detect_score;
  2136 + } else if (space_char_num > 0 && space_char_num < PLATENUM) {
  2137 + info_c.vehicle_plate_det_recg_res.stain_vp_result.type = 2;
  2138 + info_c.vehicle_plate_det_recg_res.stain_vp_result.score = info_c.vehicle_plate_det_recg_res.detect_score;
  2139 + }
  2140 + }
2247 2141 }
2248 2142  
2249 2143 tricycle_idx++;
... ... @@ -2261,10 +2155,49 @@ int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *
2261 2155 LOG_DEBUG("end tricycle 5.vp process----- ");
2262 2156 }
2263 2157 //end for 5.VP���Ƽ��ʶ��-----------------------
2264   -
  2158 + // if(tools->param.vehicle_plate_det_recg_config==SY_CONFIG_OPEN)
  2159 + // {
  2160 + // LOG_DEBUG("start tricycle hcp.");
  2161 + // hcp_analysis_result * hcp_result = new hcp_analysis_result[tricycle_batch_size];
  2162 + // int ret = hcp_batch(tools->hcp_handle, tricycle_img_data, tricycle_batch_size, hcp_result);
  2163 +
  2164 + // //output Ħ�г���ʻ�˴�ͷ��
  2165 + // int tricycle_idx=0;
  2166 + // for (int b = 0; b < batch_size; b++)
  2167 + // {
  2168 + // for(int c=0;c<result[b].count;c++)
  2169 + // {
  2170 + // auto& info_c = result[b].info[c];
  2171 + // if(info_c.type == 3 || info_c.type == 4)
  2172 + // { //三轮车
  2173 + // int res_index = hcp_result[tricycle_idx].res_objs[0].res_index;//��ȡĦ�г���ʻ�˵�head������
  2174 + // float res_socre = hcp_result[tricycle_idx].res_objs[0].res_prob;
  2175 + // if(res_index == 4)//head������ͷ��
  2176 + // {
  2177 + // info_c.mta_res.motor_driver_helmeted.status=MOTOR_DRIVER_HELMETED;//��ͷ��
  2178 + // info_c.mta_res.motor_driver_helmeted.confidence=res_socre;
  2179 + // }
  2180 + // else
  2181 + // {
  2182 + // info_c.mta_res.motor_driver_helmeted.status=MOTOR_DRIVER_NOT_HELMETED;//δ��ͷ��
  2183 + // info_c.mta_res.motor_driver_helmeted.confidence=res_socre;
  2184 + // }
  2185 +
  2186 + // tricycle_idx++;
  2187 + // }
  2188 + // }
  2189 + // }
  2190 +
  2191 + // if(hcp_result!= NULL)
  2192 + // {
  2193 + // delete[] hcp_result;
  2194 + // hcp_result=NULL;
  2195 + // }
  2196 +
  2197 + // LOG_DEBUG("end tricycle hcp.");
  2198 + // }
2265 2199 }
2266 2200 //end tricycle ����
2267   -
2268 2201  
2269 2202  
2270 2203 //delete
... ... @@ -2479,13 +2412,6 @@ void va_release(void ** handle)
2479 2412 }
2480 2413  
2481 2414  
2482   -void va_acl_release()
2483   -{
2484   - aclFinalize();
2485   -}
2486   -
2487   -
2488   -
2489 2415 //1.��绰
2490 2416 //�������
2491 2417 //-��Ӧ�����ˣ�
... ... @@ -4059,34 +3985,4 @@ int vr_supplement(void *handle, sy_img * body_img_data, int batch_size,int car_b
4059 3985  
4060 3986 return SUCCESS;
4061 3987  
4062   -}
4063   -
4064   -//end for ����ʶ�����복logo�����ϲ���---------------------------
4065   -
4066   -
4067   -
4068   -
4069   -
4070   -
4071   -
4072   -//===================== �������� =====================//
4073   -
4074   -int checkTime()
4075   -{
4076   - struct tm* info;
4077   - int nYear, nMonth, nDay;
4078   - time_t raw;
4079   - time(&raw);
4080   - info = localtime(&raw);
4081   - nYear = info->tm_year + 1900;
4082   - nMonth = info->tm_mon + 1;
4083   - nDay = info->tm_mday;
4084   - if (nYear == 2019 && nMonth < 7)
4085   - return 1;
4086   - LOG_ERROR("Software license is out of time! Please contact software developers.");
4087   - //exit(0);
4088   - return -1;
4089   -}
4090   -
4091   -
4092   -
  3988 +}
4093 3989 \ No newline at end of file
... ...
src/ai_engine_module/VehicleAnalysisDevice.h 0 → 100644
  1 +#ifndef __AI_ENGINE_MODULE_VEHICLE_ANALYSIS_DEVICE_H__
  2 +#define __AI_ENGINE_MODULE_VEHICLE_ANALYSIS_DEVICE_H__
  3 +
  4 +#include "vehicle_analysis.h"
  5 +
  6 +/*************************************************************************
  7 +* function: va_init
  8 +* purpose: init resources
  9 +* param:
  10 +[in] handle - handle
  11 +[in] param - init param
  12 +* return: success(0) or error code(<0)
  13 +* notes: null
  14 +*************************************************************************/
  15 +int va_init(void ** handle, va_param param);
  16 +
  17 +/*************************************************************************
  18 +* function: va_release
  19 +* purpose: release sources
  20 +* param:
  21 +[in] handle - handle
  22 +* return: null
  23 +* notes: null
  24 +*************************************************************************/
  25 +void va_release(void ** handle);
  26 +
  27 +/*************************************************************************
  28 +* function: va_get_version
  29 +* purpose: get sdk version
  30 +* param: null
  31 +* return: null
  32 +* notes: null
  33 +*************************************************************************/
  34 +const char * va_get_version();
  35 +
  36 +/*************************************************************************
  37 +* function: va_batch
  38 +* purpose: vehicle analysis batch
  39 +* param:
  40 +[in] handle - handle
  41 +[in] img_data_array - data array
  42 +[in] format - data format
  43 +[in] batch_size - batch size
  44 +[in] result - vehicle analysis result
  45 +* return: success(0) or error code(<0)
  46 +* notes: null
  47 +*************************************************************************/
  48 +int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *result);
  49 +//img_data_array是device数据,batch_size==16时调用固定16模型,小于16时调用固定1模型。
  50 +int va_batch16_device(void * handle, sy_img * img_data_array, int batch_size, va_result *result);
  51 +
  52 +
  53 +
  54 +/*************************************************************************
  55 +* FUNCTION: VA_ComputeSimilarity
  56 +* PURPOSE: 比对相似度(通用)
  57 +* PARAM:
  58 +[in] Afea - 第一张图片特征
  59 +[in] Bfea - 第二张图片特征
  60 +[in] featuresize - 特征长度
  61 +* RETURN: 相似度
  62 +* NOTES:
  63 +*************************************************************************/
  64 +float va_compute_similarity(float *Afea, float *Bfea, int featuresize);
  65 +
  66 +/*************************************************************************
  67 +* FUNCTION: va_compute_similarity_byvafeature
  68 +* PURPOSE: 比对相似度(针对va特征)
  69 +* PARAM:
  70 +[in] Afea - 第一张图片va特征
  71 +[in] Bfea - 第二张图片va特征
  72 +[in] featuresize - 特征长度VA_FEATURESIZE
  73 +* RETURN: 相似度
  74 +* NOTES:
  75 +*************************************************************************/
  76 +float va_compute_similarity_byvafeature(void * handle , float *Afea, float *Bfea, int featuresize);
  77 +
  78 +
  79 +#endif // __AI_ENGINE_MODULE_VEHICLE_ANALYSIS_DEVICE_H__
0 80 \ No newline at end of file
... ...
src/ai_engine_module/VehicleAnalysisDevice.h0 deleted
1   -#ifndef __AI_ENGINE_MODULE_VEHICLE_ANALYSIS_DEVICE_H__
2   -#define __AI_ENGINE_MODULE_VEHICLE_ANALYSIS_DEVICE_H__
3   -
4   -#include "vehicle_analysis.h"
5   -
6   -int va_init(void ** handle, va_param param);
7   -
8   -int va_batch(void * handle, sy_img * img_data_array, int batch_size, va_result *result);
9   -
10   -void va_release(void ** handle);
11   -
12   -
13   -#endif // __AI_ENGINE_MODULE_VEHICLE_ANALYSIS_DEVICE_H__
14 0 \ No newline at end of file