Commit a74570e1ec8404af6cefdf914cf367f15d0d5490

Authored by Hu Chunming
1 parent c3d0b30d

代码优化,没有修改逻辑

vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp
... ... @@ -361,7 +361,7 @@ void CMutliSourceVideoProcess::FinishTask(const int taskID)
361 361 tasks[i].taskObjCallbackFunc = nullptr;
362 362 tasks[i].taskRealTimeCallbackFunc = nullptr;
363 363  
364   - m_snaphot_helper.finish_task_ss_analysis(taskID, m_hp_analysis_config, m_hcp_analysis_config, m_vehicle_analysis_config, m_hf_recg_config, m_hcf_recg_config, m_vcf_recg_config);
  364 + m_snaphot_helper.finish_task_ss_analysis(taskID);
365 365  
366 366 if (tasks[i].folderName)
367 367 {
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.cpp
... ... @@ -112,35 +112,35 @@ void snapshot_helper::snapshot_helper_init(int gpuid, double gpu_total_memory, c
112 112  
113 113 this->wait_framecount = wait_framecount;
114 114  
115   - if (hp_analysis_config == SY_CONFIG_OPEN || hf_recg_config == SY_CONFIG_OPEN)
  115 + if (hp_analysis_cf == SY_CONFIG_OPEN || hf_recg_cf == SY_CONFIG_OPEN)
116 116 {
117 117 HumanParsing_Init(hp_handle, gpuid, auth_license);
118 118 }
119 119  
120   - if (hcp_analysis_config == SY_CONFIG_OPEN || hcf_recg_config == SY_CONFIG_OPEN)
  120 + if (hcp_analysis_cf == SY_CONFIG_OPEN || hcf_recg_cf == SY_CONFIG_OPEN)
121 121 {
122 122 m_human_car_parsing.init(gpuid, auth_license);
123 123 }
124 124  
125   - if (hf_recg_config == SY_CONFIG_OPEN || hcf_recg_config == SY_CONFIG_OPEN)
  125 + if (hf_recg_cf == SY_CONFIG_OPEN || hcf_recg_cf == SY_CONFIG_OPEN)
126 126 {
127 127 NonVehicleFea_Init(nvf_handle, gpuid, auth_license);
128 128 }
129 129  
130 130  
131   - if (vehicle_analysis_config == SY_CONFIG_OPEN)
  131 + if (vehicle_analysis_cf == SY_CONFIG_OPEN)
132 132 {
133 133 VehicleColor_Init(vc_handle, gpuid, auth_license);
134 134 VehiclePlateDetectRecog_Init(vp_handle, gpuid, auth_license);
135 135 VehicleRecognition_Init(vr_handle, dbpath_utf8, gpuid, auth_license);
136 136 VehicleRearRecg_Init(vrr_handle, dbpath, gpuid, auth_license);
137 137 }
138   - if (vehicle_analysis_config == SY_CONFIG_OPEN || vcf_recg_config == SY_CONFIG_OPEN)
  138 + if (vehicle_analysis_cf == SY_CONFIG_OPEN || vcf_recg_cf == SY_CONFIG_OPEN)
139 139 {
140 140 vhd_features_init(vhd_handle, dbpath_utf8, gpuid, auth_license);
141 141 }
142 142  
143   - if (vcf_recg_config == SY_CONFIG_OPEN)
  143 + if (vcf_recg_cf == SY_CONFIG_OPEN)
144 144 {
145 145 vf_features_init(vf_handle, dbpath_utf8, gpuid, auth_license);
146 146 }
... ... @@ -461,7 +461,7 @@ void snapshot_helper::object_attri_analysis() //二次属性分析接口
461 461 }
462 462 }
463 463  
464   -void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysis_config, sy_command hcp_analysis_config, sy_command vehicle_analysis_config, sy_command hf_recg_config, sy_command hcf_recg_config, sy_command vcf_recg_config) //是否开启车辆特征识别); //某一路任务结束了,立马对该路任务进行二次属性分析
  464 +void snapshot_helper::finish_task_ss_analysis(int task_id) //是否开启车辆特征识别); //某一路任务结束了,立马对该路任务进行二次属性分析
465 465 {
466 466 LOG_INFO("in: {}", task_id);
467 467  
... ... @@ -474,13 +474,13 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi
474 474 {
475 475 if (iter->first.videoID == task_id)
476 476 {
477   - if (iter->second.index.index == 0 && (hp_analysis_config == SY_CONFIG_OPEN || hf_recg_config == SY_CONFIG_OPEN) && m_task_info[task_id].snapshot_folder != NULL
  477 + if (iter->second.index.index == 0 && (hp_analysis_cf == SY_CONFIG_OPEN || hf_recg_cf == SY_CONFIG_OPEN) && m_task_info[task_id].snapshot_folder != NULL
478 478 && iter->second.snapShotLittle.frame != NULL && iter->second.snapShotLittle.height == HP_HEIGHT && iter->second.snapShotLittle.width == HP_WIDTH)
479 479 hp_keys.push_back(iter->first);
480   - else if ((iter->second.index.index == 1 || iter->second.index.index == 2) && (hcp_analysis_config == SY_CONFIG_OPEN || hcf_recg_config == SY_CONFIG_OPEN) && m_task_info[task_id].snapshot_folder != NULL
  480 + else if ((iter->second.index.index == 1 || iter->second.index.index == 2) && (hcp_analysis_cf == SY_CONFIG_OPEN || hcf_recg_cf == SY_CONFIG_OPEN) && m_task_info[task_id].snapshot_folder != NULL
481 481 && iter->second.snapShotLittle.frame != NULL && iter->second.snapShotLittle.height == HCP_HEIGHT && iter->second.snapShotLittle.width == HCP_WIDTH)
482 482 hcp_keys.push_back(iter->first);
483   - else if ((iter->second.index.index == 8 || (iter->second.index.index >= 4 && iter->second.index.index <= 6)) && (vehicle_analysis_config == SY_CONFIG_OPEN || vcf_recg_config == SY_CONFIG_OPEN) && m_task_info[task_id].snapshot_folder != NULL
  483 + else if ((iter->second.index.index == 8 || (iter->second.index.index >= 4 && iter->second.index.index <= 6)) && (vehicle_analysis_cf == SY_CONFIG_OPEN || vcf_recg_cf == SY_CONFIG_OPEN) && m_task_info[task_id].snapshot_folder != NULL
484 484 && iter->second.snapShotLittle.frame != NULL && iter->second.snapShotLittle.height == VEHICLE_HEIGHT && iter->second.snapShotLittle.width == VEHICLE_WIDTH)
485 485 vehicle_keys.push(iter->first);
486 486 else
... ... @@ -512,14 +512,14 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi
512 512 OBJ_KEY cur_obj_key = hp_keys[j];
513 513 finish_hp_img[j].set_data(HP_WIDTH, HP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
514 514 }
515   - if (hp_analysis_config == SY_CONFIG_OPEN)
  515 + if (hp_analysis_cf == SY_CONFIG_OPEN)
516 516 {
517 517 result = new hp_analysis_res[hp_batch_count]{};
518 518 //TimeCounting t("HumanParsing_Process");
519 519 HumanParsing_Process(hp_handle, finish_hp_img, hp_batch_count, result);
520 520 }
521 521  
522   - if (hf_recg_config == SY_CONFIG_OPEN)
  522 + if (hf_recg_cf == SY_CONFIG_OPEN)
523 523 {
524 524 result_f = new human_fea_result[hp_batch_count]{};
525 525  
... ... @@ -536,10 +536,10 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi
536 536 else
537 537 {
538 538 hp_result curRes = {};
539   - if (hp_analysis_config == SY_CONFIG_OPEN)
  539 + if (hp_analysis_cf == SY_CONFIG_OPEN)
540 540 memcpy(curRes.res_objs.res_objs, result[resIndex].res_objs, sizeof(classify_obj_res)* HP_FIR_INDEX_SIZE);
541 541  
542   - if (hf_recg_config == SY_CONFIG_OPEN)
  542 + if (hf_recg_cf == SY_CONFIG_OPEN)
543 543 memcpy(curRes.feature, result_f[resIndex].human_fea, sizeof(int8)* HF_FEA_SIZE);
544 544  
545 545 snapshot_res_callback(hp_keys[k], &curRes);
... ... @@ -616,7 +616,7 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi
616 616 finish_hcp_img[j].set_data(HCP_WIDTH, HCP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame);
617 617 }
618 618  
619   - if (hcp_analysis_config == SY_CONFIG_OPEN) {
  619 + if (hcp_analysis_cf == SY_CONFIG_OPEN) {
620 620 result = new hcp_analysis_result[hcp_batch_count]{};
621 621 m_human_car_parsing.process(finish_hcp_img, hcp_batch_count, result);
622 622 }
... ... @@ -638,10 +638,10 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi
638 638 else
639 639 {
640 640 hcp_result curRes = {};
641   - if (hcp_analysis_config == SY_CONFIG_OPEN)
  641 + if (hcp_analysis_cf == SY_CONFIG_OPEN)
642 642 memcpy(curRes.res_objs.res_objs, result[resIndex].res_objs, sizeof(classify_obj_res)* HCP_FIR_INDEX_SIZE);
643 643  
644   - if (hcf_recg_config == SY_CONFIG_OPEN)
  644 + if (hcf_recg_cf == SY_CONFIG_OPEN)
645 645 memcpy(curRes.feature, result_f[resIndex].human_fea, sizeof(int8)* HCF_FEA_SIZE);
646 646  
647 647 snapshot_res_callback(hcp_keys[k], &curRes);
... ... @@ -719,7 +719,7 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi
719 719 vc_result *vcresult = new vc_result[det_batch_size]{};
720 720 vehicle_plate_result *vp_result = new vehicle_plate_result[det_batch_size]{};
721 721 vr_result *vrresult = new vr_result[det_batch_size]{};
722   - if (vehicle_analysis_config == SY_CONFIG_OPEN) {
  722 + if (vehicle_analysis_cf == SY_CONFIG_OPEN) {
723 723 if(det_batch_size == 3) {
724 724 printf("batchsize: %d \n", det_batch_size);
725 725 }
... ... @@ -729,7 +729,7 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi
729 729 }
730 730  
731 731 int8 ** fea = nullptr;
732   - if (vcf_recg_config == SY_CONFIG_OPEN) {
  732 + if (vcf_recg_cf == SY_CONFIG_OPEN) {
733 733 fea = new int8*[det_batch_size] {};
734 734 for (int ii = 0; ii < det_batch_size; ++ii) {
735 735 fea[ii] = new int8[FEATURESIZE]{};
... ... @@ -744,13 +744,13 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi
744 744 auto iter = snapShotInfo.find(det_vehicle_keys[vc_idx]);
745 745 if (iter != snapShotInfo.end()) {
746 746 vehicle_result curRes = {};
747   - if (vehicle_analysis_config == SY_CONFIG_OPEN) {
  747 + if (vehicle_analysis_cf == SY_CONFIG_OPEN) {
748 748 memcpy(&curRes.vc_res, &vcresult[vc_idx], sizeof(vc_result));
749 749 memcpy(&curRes.vp_res, &vp_result[vc_idx], sizeof(vehicle_plate_result));
750 750 memcpy(&curRes.vr_res, &vrresult[vc_idx], sizeof(vr_result));
751 751 }
752 752  
753   - if (vcf_recg_config == SY_CONFIG_OPEN) {
  753 + if (vcf_recg_cf == SY_CONFIG_OPEN) {
754 754 int8 * feaRes = fea[vc_idx];
755 755 memcpy(curRes.feature, feaRes, FEATURESIZE * sizeof(int8));
756 756 }
... ... @@ -2043,6 +2043,7 @@ int snapshot_helper::SaveResultInFile(const OBJ_KEY &amp; obj_key, const OBJ_VALUE &amp;
2043 2043 {
2044 2044 if (hcp_analysis_cf == SY_CONFIG_OPEN || hcf_recg_cf == SY_CONFIG_OPEN)
2045 2045 {
  2046 + LOG_DEBUG("({}, {})", obj_key.videoID, obj_key.objID);
2046 2047 save_snapshot(obj_key);
2047 2048 hcp_analysis(obj_key);
2048 2049 }
... ...
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.h
... ... @@ -172,7 +172,7 @@ public:
172 172 bool vehicle_recg_analysis();
173 173 bool vehicle_plate_dr_analysis();
174 174  
175   - void finish_task_ss_analysis(int task_id, sy_command hp_analysis_config, sy_command hcp_analysis_config, sy_command vehicle_analysis_config, sy_command hf_recg_config, sy_command hcf_recg_config, sy_command vcf_recg_config);
  175 + void finish_task_ss_analysis(int task_id);
176 176  
177 177 void object_attri_analysis();
178 178 void snapshot_res_callback(OBJ_KEY obj_key,/* OBJ_VALUE obj_value,*/ void* analysisRes = NULL);
... ...