Commit 3d1ce1297ec7122bebe6ea5ef2de6bb92070604d
1 parent
32b73c30
修正抠图失败还会保存原图的问题;
修复人脸轨迹结束后抠图信息没删除的问题
Showing
3 changed files
with
49 additions
and
22 deletions
src/ai_platform/MultiSourceProcess.cpp
@@ -693,6 +693,7 @@ bool CMultiSourceProcess::finish_task(const string taskID, const bool delete_sna | @@ -693,6 +693,7 @@ bool CMultiSourceProcess::finish_task(const string taskID, const bool delete_sna | ||
693 | m_task_param_manager->delete_task_param(taskID); | 693 | m_task_param_manager->delete_task_param(taskID); |
694 | #endif | 694 | #endif |
695 | m_snapshot_reprocessing->release_finished_locus_snapshot(taskID); | 695 | m_snapshot_reprocessing->release_finished_locus_snapshot(taskID); |
696 | + m_snapshot_reprocessing->release_finished_face_locus_snapshot(taskID); | ||
696 | m_snapshot_reprocessing->release_village_finished_locus_snapshot(taskID); | 697 | m_snapshot_reprocessing->release_village_finished_locus_snapshot(taskID); |
697 | 698 | ||
698 | return true; | 699 | return true; |
@@ -879,9 +880,6 @@ int CMultiSourceProcess::algorthim_vpt(vector<DeviceMemory*> vec_gpuMem){ | @@ -879,9 +880,6 @@ int CMultiSourceProcess::algorthim_vpt(vector<DeviceMemory*> vec_gpuMem){ | ||
879 | manned_snapshot(vpt_interest_task_id, vec_vptMem, deleteObjectID); | 880 | manned_snapshot(vpt_interest_task_id, vec_vptMem, deleteObjectID); |
880 | #endif | 881 | #endif |
881 | 882 | ||
882 | - // if(vptResult.size() > 0){ | ||
883 | - // cout << vptResult[0].obj_count<< endl; | ||
884 | - // } | ||
885 | vptResult.clear(); | 883 | vptResult.clear(); |
886 | unUsedResult.clear(); | 884 | unUsedResult.clear(); |
887 | deleteObjectID.clear(); | 885 | deleteObjectID.clear(); |
@@ -910,6 +908,14 @@ int CMultiSourceProcess::algorithm_vehicle_relult(vector<DeviceMemory*> vec_devM | @@ -910,6 +908,14 @@ int CMultiSourceProcess::algorithm_vehicle_relult(vector<DeviceMemory*> vec_devM | ||
910 | LOG_ERROR("taskId {} not found algor {}", task_id.c_str(), (int)algorithm_type_t::VEHICLE_SNAPSHOT); | 908 | LOG_ERROR("taskId {} not found algor {}", task_id.c_str(), (int)algorithm_type_t::VEHICLE_SNAPSHOT); |
911 | continue; | 909 | continue; |
912 | } | 910 | } |
911 | + | ||
912 | + vector<vpc_img_info> vec_obj_info_list = pVPCUtil->crop_batch(result.memPtr, result.objs); | ||
913 | + if(vec_obj_info_list.size() != result.objs.size()){ | ||
914 | + LOG_ERROR("vpc_crop size error !"); | ||
915 | + VPCUtil::vpc_imgList_release(vec_obj_info_list); | ||
916 | + continue; | ||
917 | + } | ||
918 | + | ||
913 | const algor_basic_config_param_t *basic_param = algor_other_params->second->basic_param; | 919 | const algor_basic_config_param_t *basic_param = algor_other_params->second->basic_param; |
914 | 920 | ||
915 | std::string cur_timestamp_ms = std::to_string(helpers::timer::get_cur_time_ms()); | 921 | std::string cur_timestamp_ms = std::to_string(helpers::timer::get_cur_time_ms()); |
@@ -921,13 +927,6 @@ int CMultiSourceProcess::algorithm_vehicle_relult(vector<DeviceMemory*> vec_devM | @@ -921,13 +927,6 @@ int CMultiSourceProcess::algorithm_vehicle_relult(vector<DeviceMemory*> vec_devM | ||
921 | saveInfo.img_info = VPCUtil::vpc_devMem2vpcImg(result.memPtr); | 927 | saveInfo.img_info = VPCUtil::vpc_devMem2vpcImg(result.memPtr); |
922 | m_save_snapshot_reprocessing->reprocessing_process_wo_locus_async(saveInfo); | 928 | m_save_snapshot_reprocessing->reprocessing_process_wo_locus_async(saveInfo); |
923 | 929 | ||
924 | - vector<vpc_img_info> vec_obj_info_list = pVPCUtil->crop_batch(result.memPtr, result.objs); | ||
925 | - if(vec_obj_info_list.size() != result.objs.size()){ | ||
926 | - LOG_ERROR("vpc_crop size error !"); | ||
927 | - VPCUtil::vpc_imgList_release(vec_obj_info_list); | ||
928 | - continue; | ||
929 | - } | ||
930 | - | ||
931 | // 保存抠图并发MQ | 930 | // 保存抠图并发MQ |
932 | for(int i =0; i < result.objs.size(); i++){ | 931 | for(int i =0; i < result.objs.size(); i++){ |
933 | video_object_info obj = result.objs[i]; | 932 | video_object_info obj = result.objs[i]; |
@@ -1013,7 +1012,7 @@ void CMultiSourceProcess::vehicle_snapshot(vector<string>& vpt_interest_task_id, | @@ -1013,7 +1012,7 @@ void CMultiSourceProcess::vehicle_snapshot(vector<string>& vpt_interest_task_id, | ||
1013 | } | 1012 | } |
1014 | 1013 | ||
1015 | void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { | 1014 | void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { |
1016 | - LOG_DEBUG("vehicle_locus_finished in"); | 1015 | + |
1017 | auto task_param_ptr = m_task_param_manager->get_task_algor_param(obj_key.video_id); | 1016 | auto task_param_ptr = m_task_param_manager->get_task_algor_param(obj_key.video_id); |
1018 | if (task_param_ptr == nullptr){ | 1017 | if (task_param_ptr == nullptr){ |
1019 | return; | 1018 | return; |
@@ -1050,8 +1049,6 @@ void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { | @@ -1050,8 +1049,6 @@ void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { | ||
1050 | LOG_DEBUG("algor_type"); | 1049 | LOG_DEBUG("algor_type"); |
1051 | auto algor_type = index_to_algo_type[obj_value.index.index]; | 1050 | auto algor_type = index_to_algo_type[obj_value.index.index]; |
1052 | 1051 | ||
1053 | - | ||
1054 | - | ||
1055 | LOG_DEBUG("task_other_param"); | 1052 | LOG_DEBUG("task_other_param"); |
1056 | auto it_algor_type = task_other_param.find(algor_type); | 1053 | auto it_algor_type = task_other_param.find(algor_type); |
1057 | if(it_algor_type == task_other_param.end()) { | 1054 | if(it_algor_type == task_other_param.end()) { |
@@ -1060,11 +1057,6 @@ void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { | @@ -1060,11 +1057,6 @@ void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { | ||
1060 | 1057 | ||
1061 | LOG_DEBUG("algor_param"); | 1058 | LOG_DEBUG("algor_param"); |
1062 | auto algor_param = (algor_config_param_snapshot *)it_algor_type->second->algor_param; | 1059 | auto algor_param = (algor_config_param_snapshot *)it_algor_type->second->algor_param; |
1063 | - | ||
1064 | - | ||
1065 | - | ||
1066 | - | ||
1067 | - // auto algor_param = (algor_config_param_snapshot *)task_other_param[algor_type]->algor_param; | ||
1068 | if(algor_param == nullptr) { | 1060 | if(algor_param == nullptr) { |
1069 | return; | 1061 | return; |
1070 | } | 1062 | } |
@@ -1137,7 +1129,7 @@ void CMultiSourceProcess::timing_snapshot_thread(){ | @@ -1137,7 +1129,7 @@ void CMultiSourceProcess::timing_snapshot_thread(){ | ||
1137 | DecoderManager* pDecManager = DecoderManager::getInstance(); | 1129 | DecoderManager* pDecManager = DecoderManager::getInstance(); |
1138 | while(!m_bfinish){ | 1130 | while(!m_bfinish){ |
1139 | vector<DeviceMemory*> vec_devMem = pDecManager->timing_snapshot_all(); | 1131 | vector<DeviceMemory*> vec_devMem = pDecManager->timing_snapshot_all(); |
1140 | - for (auto devMem : vec_devMem){ | 1132 | + for (auto devMem : vec_devMem) { |
1141 | auto task_id = devMem->getId(); | 1133 | auto task_id = devMem->getId(); |
1142 | auto task_other_params = m_task_param_manager->get_task_other_param(task_id); | 1134 | auto task_other_params = m_task_param_manager->get_task_other_param(task_id); |
1143 | if (task_other_params == nullptr) | 1135 | if (task_other_params == nullptr) |
@@ -1803,9 +1795,8 @@ void CMultiSourceProcess::face_locus_finished(const OBJ_KEY obj_key) { | @@ -1803,9 +1795,8 @@ void CMultiSourceProcess::face_locus_finished(const OBJ_KEY obj_key) { | ||
1803 | roi_save_info.json_str = json_str; | 1795 | roi_save_info.json_str = json_str; |
1804 | m_save_snapshot_reprocessing->reprocessing_process_wo_locus_async(roi_save_info); | 1796 | m_save_snapshot_reprocessing->reprocessing_process_wo_locus_async(roi_save_info); |
1805 | 1797 | ||
1806 | - | ||
1807 | - _total_face_snapshot_info.erase(obj_key); | ||
1808 | - | 1798 | + // 删除结束轨迹的数据 |
1799 | + m_snapshot_reprocessing->release_finished_face_locus_snapshot(obj_key.video_id, obj_key.obj_id, false); | ||
1809 | } | 1800 | } |
1810 | 1801 | ||
1811 | int CMultiSourceProcess::recode_thread() { | 1802 | int CMultiSourceProcess::recode_thread() { |
src/reprocessing_module/snapshot_reprocessing.cpp
@@ -819,4 +819,39 @@ void snapshot_reprocessing::release_village_finished_locus_snapshot(const string | @@ -819,4 +819,39 @@ void snapshot_reprocessing::release_village_finished_locus_snapshot(const string | ||
819 | 819 | ||
820 | map<OBJ_KEY, OBJ_VALUE> snapshot_reprocessing::get_total_face_snapshot_info(){ | 820 | map<OBJ_KEY, OBJ_VALUE> snapshot_reprocessing::get_total_face_snapshot_info(){ |
821 | return total_face_snapshot_info; | 821 | return total_face_snapshot_info; |
822 | +} | ||
823 | + | ||
824 | +void snapshot_reprocessing::release_finished_face_locus_snapshot(const string taskid, const int obj_id, bool bRelease) { | ||
825 | + | ||
826 | + LOG_DEBUG("[info] task_id {} delete obj_id {}", taskid, obj_id); //221026 | ||
827 | + if (obj_id != -1) { | ||
828 | + OBJ_KEY cur_key = { taskid , obj_id }; | ||
829 | + auto it = total_face_snapshot_info.find(cur_key); | ||
830 | + if (it == total_face_snapshot_info.end()){ | ||
831 | + return; | ||
832 | + } | ||
833 | + | ||
834 | + if (bRelease){ | ||
835 | + OBJ_VALUE ss = total_face_snapshot_info[cur_key]; | ||
836 | + | ||
837 | + VPCUtil::vpc_img_release(ss.snapShot); | ||
838 | + VPCUtil::vpc_img_release(ss.snapShotLittle); | ||
839 | + } | ||
840 | + | ||
841 | + total_face_snapshot_info.erase(cur_key); | ||
842 | + return; | ||
843 | + } | ||
844 | + | ||
845 | + for(auto ss = total_face_snapshot_info.begin(); ss != total_face_snapshot_info.end(); ss++) | ||
846 | + { | ||
847 | + if (strcmp(ss->first.video_id.c_str(), taskid.c_str()) == 0) | ||
848 | + { | ||
849 | + if (bRelease){ | ||
850 | + VPCUtil::vpc_img_release(ss->second.snapShot); | ||
851 | + VPCUtil::vpc_img_release(ss->second.snapShotLittle); | ||
852 | + } | ||
853 | + total_face_snapshot_info.erase(ss); | ||
854 | + return; | ||
855 | + } | ||
856 | + } | ||
822 | } | 857 | } |
823 | \ No newline at end of file | 858 | \ No newline at end of file |
src/reprocessing_module/snapshot_reprocessing.h
@@ -84,6 +84,7 @@ public: | @@ -84,6 +84,7 @@ public: | ||
84 | 84 | ||
85 | void release_finished_locus_snapshot(const string taskid, const int objid = -1, bool bRelease = true); //-1为删除该路所有任务的快照图 | 85 | void release_finished_locus_snapshot(const string taskid, const int objid = -1, bool bRelease = true); //-1为删除该路所有任务的快照图 |
86 | void release_village_finished_locus_snapshot(const string taskid, const int objid = -1, bool bRelease = true); | 86 | void release_village_finished_locus_snapshot(const string taskid, const int objid = -1, bool bRelease = true); |
87 | + void release_finished_face_locus_snapshot(const string taskid, const int objid = -1, bool bRelease = true); | ||
87 | 88 | ||
88 | private: | 89 | private: |
89 | bool best_snapshot_judge_algor(const OBJ_KEY& obj_key, const OBJ_VALUE& obj_value, int left, int top, int width, int height, int image_width, int image_height); | 90 | bool best_snapshot_judge_algor(const OBJ_KEY& obj_key, const OBJ_VALUE& obj_value, int left, int top, int width, int height, int image_width, int image_height); |