Commit 12fade9b12c57a19ff3183ff895c1daf3e0b9658

Authored by Zhao Shuaihua
1 parent b283714b

修复货车载人显存泄露bug

src/ai_engine_module/truck_manned_process.cpp
@@ -420,9 +420,21 @@ namespace ai_engine_module @@ -420,9 +420,21 @@ namespace ai_engine_module
420 if (m_total_obj_info[trace_obj_key].center_points.size() > stop_check_frames) { 420 if (m_total_obj_info[trace_obj_key].center_points.size() > stop_check_frames) {
421 float res_max_dist = 0; 421 float res_max_dist = 0;
422 float total_dist = diff_car_pos(m_total_obj_info[trace_obj_key].center_points, stop_check_frames, res_max_dist); 422 float total_dist = diff_car_pos(m_total_obj_info[trace_obj_key].center_points, stop_check_frames, res_max_dist);
423 - if (res_max_dist < stop_min_move) continue; // 停车 423 + if (res_max_dist < stop_min_move) { // 停车
  424 + VPCUtil::vpc_img_release(flattened_vpc_imgs[n]); //flattened_imgs[n].data_
  425 + flattened_imgs[n].data_ = nullptr;
  426 + VPCUtil::vpc_img_release(flattened_vpc_vpose_imgs[n]);
  427 + flattened_vpose_imgs[n].data_ = nullptr;
  428 + continue;
  429 + }
  430 + }
  431 + else {
  432 + VPCUtil::vpc_img_release(flattened_vpc_imgs[n]); //flattened_imgs[n].data_
  433 + flattened_imgs[n].data_ = nullptr;
  434 + VPCUtil::vpc_img_release(flattened_vpc_vpose_imgs[n]);
  435 + flattened_vpose_imgs[n].data_ = nullptr;
  436 + continue;
424 } 437 }
425 - else continue;  
426 } 438 }
427 439
428 //vpose=========================================================== 440 //vpose===========================================================
src/ai_platform/MultiSourceProcess.cpp
@@ -1029,7 +1029,7 @@ int CMultiSourceProcess::algorthim_vpt(vector&lt;DeviceMemory*&gt; vec_gpuMem){ @@ -1029,7 +1029,7 @@ int CMultiSourceProcess::algorthim_vpt(vector&lt;DeviceMemory*&gt; vec_gpuMem){
1029 algorithm_traffic_light_process(vpt_interest_task_id, vec_vptMem, vptResult); 1029 algorithm_traffic_light_process(vpt_interest_task_id, vec_vptMem, vptResult);
1030 // 与道路分割相关的算法 1030 // 与道路分割相关的算法
1031 algorithm_roadseg_correlation_process(vpt_interest_task_id, vec_vptMem, vptResult); 1031 algorithm_roadseg_correlation_process(vpt_interest_task_id, vec_vptMem, vptResult);
1032 - village_snapshot(vpt_interest_task_id, vec_vptMem, deleteObjectID); 1032 + village_snapshot(vpt_interest_task_id, vec_vptMem, deleteObjectID);
1033 #endif 1033 #endif
1034 1034
1035 vptResult.clear(); 1035 vptResult.clear();
@@ -1763,7 +1763,7 @@ void CMultiSourceProcess::village_snapshot(vector&lt;string&gt;&amp; vpt_interest_task_id, @@ -1763,7 +1763,7 @@ void CMultiSourceProcess::village_snapshot(vector&lt;string&gt;&amp; vpt_interest_task_id,
1763 auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, motorhs_algor.at(idx)); 1763 auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, motorhs_algor.at(idx));
1764 save_snapshot_process(obj_key, motorhs_algor.at(idx), src_img, roi_img, 0, json_str); 1764 save_snapshot_process(obj_key, motorhs_algor.at(idx), src_img, roi_img, 0, json_str);
1765 } else { 1765 } else {
1766 - VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img); 1766 + VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img);
1767 } 1767 }
1768 1768
1769 } 1769 }
@@ -1811,8 +1811,8 @@ void CMultiSourceProcess::village_snapshot(vector&lt;string&gt;&amp; vpt_interest_task_id, @@ -1811,8 +1811,8 @@ void CMultiSourceProcess::village_snapshot(vector&lt;string&gt;&amp; vpt_interest_task_id,
1811 if (save_single_algor_pic) { 1811 if (save_single_algor_pic) {
1812 auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, algorithm_type_t::NONMOTOR_VEHICLE_REFIT); 1812 auto json_str = helpers::gen_json::gen_manned_json(obj_key.video_id, obj_key.obj_id, result->box, algorithm_type_t::NONMOTOR_VEHICLE_REFIT);
1813 save_snapshot_process(obj_key, algorithm_type_t::NONMOTOR_VEHICLE_REFIT, src_img, roi_img, 0, json_str); 1813 save_snapshot_process(obj_key, algorithm_type_t::NONMOTOR_VEHICLE_REFIT, src_img, roi_img, 0, json_str);
1814 - } else {  
1815 - VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img); 1814 + } else {
  1815 + VPCUtil::vpc_img_release(src_img); VPCUtil::vpc_img_release(roi_img);
1816 } 1816 }
1817 1817
1818 } 1818 }
src/demo/demo.cpp
@@ -1038,7 +1038,10 @@ void test_gpu(int gpuID){ @@ -1038,7 +1038,10 @@ void test_gpu(int gpuID){
1038 std::vector<algorithm_type_t> algor_vec2 = {algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN, algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::TRUCK_MANNED, algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE, 1038 std::vector<algorithm_type_t> algor_vec2 = {algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN, algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::TRUCK_MANNED, algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE,
1039 algorithm_type_t::NONMOTOR_VEHICLE_REFIT, algorithm_type_t::PERSON_RUNNING_REDLIGHTS, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS, algorithm_type_t::PERSON_IN_VEHICLELANE, algorithm_type_t::NONMOTOR_IN_VEHICLELANE, 1039 algorithm_type_t::NONMOTOR_VEHICLE_REFIT, algorithm_type_t::PERSON_RUNNING_REDLIGHTS, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS, algorithm_type_t::PERSON_IN_VEHICLELANE, algorithm_type_t::NONMOTOR_IN_VEHICLELANE,
1040 algorithm_type_t::NONMOTOR_CEOSSPARKLINE, algorithm_type_t::PERSON_CROSS, algorithm_type_t::NONMOTOR_WRONGDIRECTION, algorithm_type_t::VEHICLE_WRONGDIRECTION, algorithm_type_t::VEHICLE_NOTGIVEWAY}; 1040 algorithm_type_t::NONMOTOR_CEOSSPARKLINE, algorithm_type_t::PERSON_CROSS, algorithm_type_t::NONMOTOR_WRONGDIRECTION, algorithm_type_t::VEHICLE_WRONGDIRECTION, algorithm_type_t::VEHICLE_NOTGIVEWAY};
1041 - std::vector<algorithm_type_t> algor_vec3 = {algorithm_type_t::PERSON_RUNNING_REDLIGHTS, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS}; 1041 + std::vector<algorithm_type_t> algor_vec3 = {algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN, algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::TRUCK_MANNED, algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE,
  1042 + algorithm_type_t::NONMOTOR_VEHICLE_REFIT, algorithm_type_t::PERSON_RUNNING_REDLIGHTS, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS};
  1043 + // std::vector<algorithm_type_t> algor_vec3 = {algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN, algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE,
  1044 + // algorithm_type_t::NONMOTOR_VEHICLE_REFIT};
1042 1045
1043 /* 1046 /*
1044 int repeat_num = 1000; 1047 int repeat_num = 1000;
@@ -1060,7 +1063,7 @@ void test_gpu(int gpuID){ @@ -1060,7 +1063,7 @@ void test_gpu(int gpuID){
1060 // createTask(handle, algor_vec, 1); 1063 // createTask(handle, algor_vec, 1);
1061 // createTask(handle, algor_vec, 2); 1064 // createTask(handle, algor_vec, 2);
1062 // createTask(handle, algor_vec, 3); 1065 // createTask(handle, algor_vec, 3);
1063 - createTask(handle, algor_vec2, 4); 1066 + // createTask(handle, algor_vec3, 4);
1064 createTask(handle, algor_vec2, 5); 1067 createTask(handle, algor_vec2, 5);
1065 createTask(handle, algor_vec2, 6); 1068 createTask(handle, algor_vec2, 6);
1066 createTask(handle, algor_vec2, 7); 1069 createTask(handle, algor_vec2, 7);
@@ -1072,10 +1075,10 @@ void test_gpu(int gpuID){ @@ -1072,10 +1075,10 @@ void test_gpu(int gpuID){
1072 createTask(handle, algor_vec2, 13); 1075 createTask(handle, algor_vec2, 13);
1073 createTask(handle, algor_vec2, 14); 1076 createTask(handle, algor_vec2, 14);
1074 createTask(handle, algor_vec2, 15); 1077 createTask(handle, algor_vec2, 15);
1075 - createTask(handle, algor_vec2, 16);  
1076 - createTask(handle, algor_vec2, 17);  
1077 - createTask(handle, algor_vec2, 18);  
1078 - createTask(handle, algor_vec2, 19); 1078 + // createTask(handle, algor_vec2, 16);
  1079 + // createTask(handle, algor_vec2, 17);
  1080 + // createTask(handle, algor_vec2, 18);
  1081 + // createTask(handle, algor_vec2, 19);
1079 // createTask(handle, algor_vec2, 20); 1082 // createTask(handle, algor_vec2, 20);
1080 // createTask(handle, algor_vec2, 21); 1083 // createTask(handle, algor_vec2, 21);
1081 // createTask(handle, algor_vec2, 22); 1084 // createTask(handle, algor_vec2, 22);