Commit a74570e1ec8404af6cefdf914cf367f15d0d5490
1 parent
c3d0b30d
代码优化,没有修改逻辑
Showing
3 changed files
with
24 additions
and
23 deletions
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp
@@ -361,7 +361,7 @@ void CMutliSourceVideoProcess::FinishTask(const int taskID) | @@ -361,7 +361,7 @@ void CMutliSourceVideoProcess::FinishTask(const int taskID) | ||
361 | tasks[i].taskObjCallbackFunc = nullptr; | 361 | tasks[i].taskObjCallbackFunc = nullptr; |
362 | tasks[i].taskRealTimeCallbackFunc = nullptr; | 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 | if (tasks[i].folderName) | 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,35 +112,35 @@ void snapshot_helper::snapshot_helper_init(int gpuid, double gpu_total_memory, c | ||
112 | 112 | ||
113 | this->wait_framecount = wait_framecount; | 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 | HumanParsing_Init(hp_handle, gpuid, auth_license); | 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 | m_human_car_parsing.init(gpuid, auth_license); | 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 | NonVehicleFea_Init(nvf_handle, gpuid, auth_license); | 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 | VehicleColor_Init(vc_handle, gpuid, auth_license); | 133 | VehicleColor_Init(vc_handle, gpuid, auth_license); |
134 | VehiclePlateDetectRecog_Init(vp_handle, gpuid, auth_license); | 134 | VehiclePlateDetectRecog_Init(vp_handle, gpuid, auth_license); |
135 | VehicleRecognition_Init(vr_handle, dbpath_utf8, gpuid, auth_license); | 135 | VehicleRecognition_Init(vr_handle, dbpath_utf8, gpuid, auth_license); |
136 | VehicleRearRecg_Init(vrr_handle, dbpath, gpuid, auth_license); | 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 | vhd_features_init(vhd_handle, dbpath_utf8, gpuid, auth_license); | 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 | vf_features_init(vf_handle, dbpath_utf8, gpuid, auth_license); | 145 | vf_features_init(vf_handle, dbpath_utf8, gpuid, auth_license); |
146 | } | 146 | } |
@@ -461,7 +461,7 @@ void snapshot_helper::object_attri_analysis() //二次属性分析接口 | @@ -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 | LOG_INFO("in: {}", task_id); | 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,13 +474,13 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi | ||
474 | { | 474 | { |
475 | if (iter->first.videoID == task_id) | 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 | && iter->second.snapShotLittle.frame != NULL && iter->second.snapShotLittle.height == HP_HEIGHT && iter->second.snapShotLittle.width == HP_WIDTH) | 478 | && iter->second.snapShotLittle.frame != NULL && iter->second.snapShotLittle.height == HP_HEIGHT && iter->second.snapShotLittle.width == HP_WIDTH) |
479 | hp_keys.push_back(iter->first); | 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 | && iter->second.snapShotLittle.frame != NULL && iter->second.snapShotLittle.height == HCP_HEIGHT && iter->second.snapShotLittle.width == HCP_WIDTH) | 481 | && iter->second.snapShotLittle.frame != NULL && iter->second.snapShotLittle.height == HCP_HEIGHT && iter->second.snapShotLittle.width == HCP_WIDTH) |
482 | hcp_keys.push_back(iter->first); | 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 | && iter->second.snapShotLittle.frame != NULL && iter->second.snapShotLittle.height == VEHICLE_HEIGHT && iter->second.snapShotLittle.width == VEHICLE_WIDTH) | 484 | && iter->second.snapShotLittle.frame != NULL && iter->second.snapShotLittle.height == VEHICLE_HEIGHT && iter->second.snapShotLittle.width == VEHICLE_WIDTH) |
485 | vehicle_keys.push(iter->first); | 485 | vehicle_keys.push(iter->first); |
486 | else | 486 | else |
@@ -512,14 +512,14 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi | @@ -512,14 +512,14 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi | ||
512 | OBJ_KEY cur_obj_key = hp_keys[j]; | 512 | OBJ_KEY cur_obj_key = hp_keys[j]; |
513 | finish_hp_img[j].set_data(HP_WIDTH, HP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); | 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 | result = new hp_analysis_res[hp_batch_count]{}; | 517 | result = new hp_analysis_res[hp_batch_count]{}; |
518 | //TimeCounting t("HumanParsing_Process"); | 518 | //TimeCounting t("HumanParsing_Process"); |
519 | HumanParsing_Process(hp_handle, finish_hp_img, hp_batch_count, result); | 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 | result_f = new human_fea_result[hp_batch_count]{}; | 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,10 +536,10 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi | ||
536 | else | 536 | else |
537 | { | 537 | { |
538 | hp_result curRes = {}; | 538 | hp_result curRes = {}; |
539 | - if (hp_analysis_config == SY_CONFIG_OPEN) | 539 | + if (hp_analysis_cf == SY_CONFIG_OPEN) |
540 | memcpy(curRes.res_objs.res_objs, result[resIndex].res_objs, sizeof(classify_obj_res)* HP_FIR_INDEX_SIZE); | 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 | memcpy(curRes.feature, result_f[resIndex].human_fea, sizeof(int8)* HF_FEA_SIZE); | 543 | memcpy(curRes.feature, result_f[resIndex].human_fea, sizeof(int8)* HF_FEA_SIZE); |
544 | 544 | ||
545 | snapshot_res_callback(hp_keys[k], &curRes); | 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,7 +616,7 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi | ||
616 | finish_hcp_img[j].set_data(HCP_WIDTH, HCP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); | 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 | result = new hcp_analysis_result[hcp_batch_count]{}; | 620 | result = new hcp_analysis_result[hcp_batch_count]{}; |
621 | m_human_car_parsing.process(finish_hcp_img, hcp_batch_count, result); | 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,10 +638,10 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi | ||
638 | else | 638 | else |
639 | { | 639 | { |
640 | hcp_result curRes = {}; | 640 | hcp_result curRes = {}; |
641 | - if (hcp_analysis_config == SY_CONFIG_OPEN) | 641 | + if (hcp_analysis_cf == SY_CONFIG_OPEN) |
642 | memcpy(curRes.res_objs.res_objs, result[resIndex].res_objs, sizeof(classify_obj_res)* HCP_FIR_INDEX_SIZE); | 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 | memcpy(curRes.feature, result_f[resIndex].human_fea, sizeof(int8)* HCF_FEA_SIZE); | 645 | memcpy(curRes.feature, result_f[resIndex].human_fea, sizeof(int8)* HCF_FEA_SIZE); |
646 | 646 | ||
647 | snapshot_res_callback(hcp_keys[k], &curRes); | 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,7 +719,7 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi | ||
719 | vc_result *vcresult = new vc_result[det_batch_size]{}; | 719 | vc_result *vcresult = new vc_result[det_batch_size]{}; |
720 | vehicle_plate_result *vp_result = new vehicle_plate_result[det_batch_size]{}; | 720 | vehicle_plate_result *vp_result = new vehicle_plate_result[det_batch_size]{}; |
721 | vr_result *vrresult = new vr_result[det_batch_size]{}; | 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 | if(det_batch_size == 3) { | 723 | if(det_batch_size == 3) { |
724 | printf("batchsize: %d \n", det_batch_size); | 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,7 +729,7 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi | ||
729 | } | 729 | } |
730 | 730 | ||
731 | int8 ** fea = nullptr; | 731 | int8 ** fea = nullptr; |
732 | - if (vcf_recg_config == SY_CONFIG_OPEN) { | 732 | + if (vcf_recg_cf == SY_CONFIG_OPEN) { |
733 | fea = new int8*[det_batch_size] {}; | 733 | fea = new int8*[det_batch_size] {}; |
734 | for (int ii = 0; ii < det_batch_size; ++ii) { | 734 | for (int ii = 0; ii < det_batch_size; ++ii) { |
735 | fea[ii] = new int8[FEATURESIZE]{}; | 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,13 +744,13 @@ void snapshot_helper::finish_task_ss_analysis(int task_id, sy_command hp_analysi | ||
744 | auto iter = snapShotInfo.find(det_vehicle_keys[vc_idx]); | 744 | auto iter = snapShotInfo.find(det_vehicle_keys[vc_idx]); |
745 | if (iter != snapShotInfo.end()) { | 745 | if (iter != snapShotInfo.end()) { |
746 | vehicle_result curRes = {}; | 746 | vehicle_result curRes = {}; |
747 | - if (vehicle_analysis_config == SY_CONFIG_OPEN) { | 747 | + if (vehicle_analysis_cf == SY_CONFIG_OPEN) { |
748 | memcpy(&curRes.vc_res, &vcresult[vc_idx], sizeof(vc_result)); | 748 | memcpy(&curRes.vc_res, &vcresult[vc_idx], sizeof(vc_result)); |
749 | memcpy(&curRes.vp_res, &vp_result[vc_idx], sizeof(vehicle_plate_result)); | 749 | memcpy(&curRes.vp_res, &vp_result[vc_idx], sizeof(vehicle_plate_result)); |
750 | memcpy(&curRes.vr_res, &vrresult[vc_idx], sizeof(vr_result)); | 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 | int8 * feaRes = fea[vc_idx]; | 754 | int8 * feaRes = fea[vc_idx]; |
755 | memcpy(curRes.feature, feaRes, FEATURESIZE * sizeof(int8)); | 755 | memcpy(curRes.feature, feaRes, FEATURESIZE * sizeof(int8)); |
756 | } | 756 | } |
@@ -2043,6 +2043,7 @@ int snapshot_helper::SaveResultInFile(const OBJ_KEY & obj_key, const OBJ_VALUE & | @@ -2043,6 +2043,7 @@ int snapshot_helper::SaveResultInFile(const OBJ_KEY & obj_key, const OBJ_VALUE & | ||
2043 | { | 2043 | { |
2044 | if (hcp_analysis_cf == SY_CONFIG_OPEN || hcf_recg_cf == SY_CONFIG_OPEN) | 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 | save_snapshot(obj_key); | 2047 | save_snapshot(obj_key); |
2047 | hcp_analysis(obj_key); | 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,7 +172,7 @@ public: | ||
172 | bool vehicle_recg_analysis(); | 172 | bool vehicle_recg_analysis(); |
173 | bool vehicle_plate_dr_analysis(); | 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 | void object_attri_analysis(); | 177 | void object_attri_analysis(); |
178 | void snapshot_res_callback(OBJ_KEY obj_key,/* OBJ_VALUE obj_value,*/ void* analysisRes = NULL); | 178 | void snapshot_res_callback(OBJ_KEY obj_key,/* OBJ_VALUE obj_value,*/ void* analysisRes = NULL); |