Commit 497868ee45e6a27b7a3b2902e0349fa72782049b
1 parent
68c93490
修正调结果问题: tracker应该要用引用
Showing
3 changed files
with
28 additions
and
47 deletions
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp
... | ... | @@ -998,11 +998,6 @@ void CMutliSourceVideoProcess::algorthim_process() |
998 | 998 | cudaFree(tasks[task_id].task_algorithm_data.frame); |
999 | 999 | tasks[task_id].task_algorithm_data.frame = nullptr; |
1000 | 1000 | } |
1001 | - | |
1002 | - | |
1003 | - for (int i = 0; i < deleteObjectID.size(); i++) | |
1004 | - vector<int>().swap(deleteObjectID[i]); | |
1005 | - vector<vector<int>>().swap(deleteObjectID); | |
1006 | 1001 | |
1007 | 1002 | m_snaphot_helper.object_attri_analysis(); |
1008 | 1003 | cudaError_t cudaStatus = cudaGetLastError(); | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/VPTProcess.cpp
... | ... | @@ -93,12 +93,11 @@ void VPTProcess::config_fpn_param(ctools_init_params& param, int batch_size) { |
93 | 93 | |
94 | 94 | void VPTProcess::config_yolo_param(ctools_init_params& param, int batch_size) { |
95 | 95 | |
96 | - param.model_type_ = MODEL_YOLOV5; // debug by zsh | |
97 | - | |
96 | + param.model_type_ = MODEL_YOLOV5; | |
98 | 97 | param.weight_file_ = NULL; |
99 | 98 | param.net_file_ = NULL; |
100 | 99 | |
101 | - param.data_process_str_ = | |
100 | + param.data_process_str_ = | |
102 | 101 | //"CopyData_CPU2GPU_U8;" |
103 | 102 | "TypeConvert_U8_F32;" |
104 | 103 | "ResizeMaxMidPad_F32_F32,test_size,640,test_max_size,640,max_height,640,max_width,640," |
... | ... | @@ -107,7 +106,7 @@ void VPTProcess::config_yolo_param(ctools_init_params& param, int batch_size) { |
107 | 106 | "BGR2RGB_F32_F32;" |
108 | 107 | "NHWC2NCHW_F32" |
109 | 108 | ; |
110 | - param.need_im_info_ = 0; | |
109 | + param.need_im_info_ = 0; | |
111 | 110 | |
112 | 111 | if (param.engine_type_ == ENGINE_MCAFFE2) |
113 | 112 | { |
... | ... | @@ -135,10 +134,9 @@ void VPTProcess::config_yolo_param(ctools_init_params& param, int batch_size) { |
135 | 134 | "output_names output", |
136 | 135 | batch_size, g_data_mode.c_str(), g_is_create_calibrator, g_is_onnx_model); |
137 | 136 | |
138 | - param.tensorrt_calibrator_array_len_ = ga_trt_yolo_vpt_calibrator_len;// | |
139 | - param.tensorrt_calibrator_array_ = (unsigned char*)ga_trt_yolo_vpt_calibrator;// debug by zsh | |
137 | + param.tensorrt_calibrator_array_len_ = ga_trt_yolo_vpt_calibrator_len; | |
138 | + param.tensorrt_calibrator_array_ = (unsigned char*)ga_trt_yolo_vpt_calibrator; | |
140 | 139 | |
141 | - // param.tensorrt_plugin_factory_ptr_ = &(tensorrt_plugin_factory); | |
142 | 140 | } |
143 | 141 | } |
144 | 142 | |
... | ... | @@ -254,7 +252,7 @@ int VPTProcess::process(sy_img * batch_img, int batchsize, vector<unsigned long |
254 | 252 | } |
255 | 253 | |
256 | 254 | for (int i = 0; i < batchsize; i++){ |
257 | - TaskTracker task_tracker = taskTrackers[i]; | |
255 | + TaskTracker& task_tracker = taskTrackers[i]; | |
258 | 256 | if (!task_tracker.tracker.GetState()) { |
259 | 257 | continue; |
260 | 258 | } |
... | ... | @@ -263,35 +261,24 @@ int VPTProcess::process(sy_img * batch_img, int batchsize, vector<unsigned long |
263 | 261 | // 第一帧,只做带检测框的跟踪 |
264 | 262 | int objCount = task_tracker.tracker.update(task_tracker.ratioWidth, task_tracker.ratioHeight, true, detectResult[i], result[i].obj, deleteObjectID[i]); |
265 | 263 | result[i].objCount = objCount; |
264 | + } else { | |
265 | + int update_times = vec_frameIndex[i] - task_tracker.lastFrameIndex - 1; | |
266 | + if (update_times < 0) { | |
267 | + cout << "FrameIndex error !! lastFrameIndex= " << task_tracker.lastFrameIndex << " cur_frameindex = " << vec_frameIndex[i] << endl; | |
268 | + } | |
269 | + // cout << "lastFrameIndex= " << task_tracker.lastFrameIndex << " cur_frameindex = " << vec_frameIndex[detectIndex] << endl; | |
270 | + // cout << "update_times = " << update_times << endl; | |
266 | 271 | |
267 | - check_VPT_Result(result[i]); | |
268 | - | |
269 | - task_tracker.lastFrameIndex = vec_frameIndex[i]; | |
270 | - task_tracker.lastDetectResult = detectResult[i]; | |
271 | - task_tracker.lastUnUsedResult.objCount = result[i].objCount; | |
272 | - memcpy(task_tracker.lastUnUsedResult.obj, result[i].obj, sizeof(VPT_ObjInfo) * MAX_OBJ_COUNT); | |
273 | - task_tracker.lastDeleteObjectID = deleteObjectID[i]; | |
274 | - continue; | |
275 | - } | |
272 | + for (int j = 0; j < update_times; j++) { // 无检测框跟踪 | |
273 | + //cout << "taskTrackers size: " << task_tracker.size() << " batchsize:" << detectResult.size() << " update_times: "<< update_times << endl; | |
274 | + task_tracker.lastUnUsedResult.objCount = task_tracker.tracker.update(task_tracker.ratioWidth, task_tracker.ratioHeight, false, task_tracker.lastDetectResult, task_tracker.lastUnUsedResult.obj, task_tracker.lastDeleteObjectID); | |
275 | + } | |
276 | 276 | |
277 | - int update_times = vec_frameIndex[i] - task_tracker.lastFrameIndex - 1; | |
278 | - if (update_times < 0) | |
279 | - { | |
280 | - cout << "FrameIndex error !! lastFrameIndex= "<< task_tracker.lastFrameIndex <<" cur_frameindex = " << vec_frameIndex[i] << endl; | |
281 | - } | |
282 | - // cout << "lastFrameIndex= " << task_tracker.lastFrameIndex << " cur_frameindex = " << vec_frameIndex[detectIndex] << endl; | |
283 | - // cout << "update_times = " << update_times << endl; | |
284 | - | |
285 | - for (int j = 0; j < update_times; j++) | |
286 | - { // 无检测框跟踪 | |
287 | - //cout << "taskTrackers size: " << task_tracker.size() << " batchsize:" << detectResult.size() << " update_times: "<< update_times << endl; | |
288 | - task_tracker.lastUnUsedResult.objCount =task_tracker.tracker.update(task_tracker.ratioWidth, task_tracker.ratioHeight, false, task_tracker.lastDetectResult, task_tracker.lastUnUsedResult.obj, task_tracker.lastDeleteObjectID); | |
277 | + //有检测框输入的跟踪 | |
278 | + int objCount = task_tracker.tracker.update(task_tracker.ratioWidth, task_tracker.ratioHeight, true, detectResult[i], result[i].obj, deleteObjectID[i]); | |
279 | + result[i].objCount = objCount; | |
289 | 280 | } |
290 | 281 | |
291 | - //有检测框输入的跟踪 | |
292 | - int objCount = task_tracker.tracker.update(task_tracker.ratioWidth, task_tracker.ratioHeight, true, detectResult[i], result[i].obj, deleteObjectID[i]); | |
293 | - result[i].objCount = objCount; | |
294 | - | |
295 | 282 | check_VPT_Result(result[i]); |
296 | 283 | |
297 | 284 | task_tracker.lastDetectResult = detectResult[i]; |
... | ... | @@ -299,10 +286,9 @@ int VPTProcess::process(sy_img * batch_img, int batchsize, vector<unsigned long |
299 | 286 | memcpy(task_tracker.lastUnUsedResult.obj, result[i].obj, sizeof(VPT_ObjInfo) * MAX_OBJ_COUNT); |
300 | 287 | task_tracker.lastDeleteObjectID = deleteObjectID[i]; |
301 | 288 | |
302 | - // 记录帧序号 | |
289 | + // 记录帧序号 | |
303 | 290 | task_tracker.lastFrameIndex = vec_frameIndex[i]; |
304 | 291 | } |
305 | - | |
306 | 292 | } |
307 | 293 | |
308 | 294 | void VPTProcess::release() { | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.cpp
... | ... | @@ -2119,9 +2119,9 @@ CropInfo snapshot_helper::cacheSnapShotInfo(OBJ_KEY newObj, VPT_ObjInfo obj, Tas |
2119 | 2119 | cur_height = HCP_HEIGHT; |
2120 | 2120 | |
2121 | 2121 | // if(5 == newObj.videoID) |
2122 | - { | |
2123 | - LOG_DEBUG("task_id:{} obj_id:{} index = {}", newObj.videoID, newObj.objID, snapShotInfo[newObj].index.index ); | |
2124 | - } | |
2122 | + // { | |
2123 | + // LOG_DEBUG("task_id:{} obj_id:{} index = {}", newObj.videoID, newObj.objID, snapShotInfo[newObj].index.index ); | |
2124 | + // } | |
2125 | 2125 | } |
2126 | 2126 | else if (8 == snapShotInfo[newObj].index.index || (snapShotInfo[newObj].index.index >= 4 && snapShotInfo[newObj].index.index <= 6)) |
2127 | 2127 | { |
... | ... | @@ -2240,10 +2240,10 @@ CropInfo snapshot_helper::cacheSnapShotInfo(OBJ_KEY newObj, VPT_ObjInfo obj, Tas |
2240 | 2240 | else if (1 == snapShotInfo[newObj].index.index || 2 == snapShotInfo[newObj].index.index) |
2241 | 2241 | { |
2242 | 2242 | // if(5 == newObj.videoID) |
2243 | - { | |
2244 | - LOG_DEBUG("else , task_id:{} obj_id:{} index = {}", newObj.videoID, newObj.objID, snapShotInfo[newObj].index.index); | |
2245 | - } | |
2246 | - if (snapShotInfo[newObj].snapShotLittle.width != HCP_WIDTH || snapShotInfo[newObj].snapShotLittle.height != HCP_HEIGHT) | |
2243 | + // { | |
2244 | + // LOG_DEBUG("else , task_id:{} obj_id:{} index = {}", newObj.videoID, newObj.objID, snapShotInfo[newObj].index.index); | |
2245 | + // } | |
2246 | + // if (snapShotInfo[newObj].snapShotLittle.width != HCP_WIDTH || snapShotInfo[newObj].snapShotLittle.height != HCP_HEIGHT) | |
2247 | 2247 | { |
2248 | 2248 | cudaFree(snapShotInfo[newObj].snapShotLittle.frame); //释放显存 |
2249 | 2249 | cudaMalloc((void**)&snapShotInfo[newObj].snapShotLittle.frame, 3 * HCP_WIDTH * HCP_HEIGHT * sizeof(unsigned char)); | ... | ... |