Commit f79fec75f3947a6fa6a61e9d48c004ea71fdb97b
1 parent
d07e3a22
代码优化
Showing
8 changed files
with
30 additions
and
139 deletions
vehicle_structure_platform.git0708-3080-trt-face/src/FFNvDecoder/DxDecoderWrap.cpp
@@ -114,21 +114,10 @@ int DxDecoderWrap::DxCloseDecoder() | @@ -114,21 +114,10 @@ int DxDecoderWrap::DxCloseDecoder() | ||
114 | } | 114 | } |
115 | 115 | ||
116 | 116 | ||
117 | -int DxDecoderWrap::DxGetResolution( int * width, int * height ) | 117 | +int DxDecoderWrap::DxGetResolution( int &width, int &height ) |
118 | { | 118 | { |
119 | - | ||
120 | if(m_pDec) { | 119 | if(m_pDec) { |
121 | - int w,h; | ||
122 | - m_pDec->getResolution(w, h); | ||
123 | - | ||
124 | - if ( width ) { | ||
125 | - *width = w; | ||
126 | - } | ||
127 | - | ||
128 | - if ( height ) { | ||
129 | - *height = h; | ||
130 | - } | ||
131 | - | 120 | + m_pDec->getResolution(width, height); |
132 | return 0; | 121 | return 0; |
133 | } | 122 | } |
134 | 123 |
vehicle_structure_platform.git0708-3080-trt-face/src/FFNvDecoder/DxDecoderWrap.h
@@ -56,7 +56,7 @@ public: | @@ -56,7 +56,7 @@ public: | ||
56 | 56 | ||
57 | int DxGetFrameCount(); | 57 | int DxGetFrameCount(); |
58 | 58 | ||
59 | - int DxGetResolution( int * width, int * height ); | 59 | + int DxGetResolution( int &width, int &height ); |
60 | 60 | ||
61 | bool DxFrameIsEmpty(); | 61 | bool DxFrameIsEmpty(); |
62 | int DxLockFrame( DxGPUFrame * frame ); | 62 | int DxLockFrame( DxGPUFrame * frame ); |
vehicle_structure_platform.git0708-3080-trt-face/src/FFNvDecoder/ImageSaveGPU.cpp
@@ -3,28 +3,6 @@ | @@ -3,28 +3,6 @@ | ||
3 | #include "logger.hpp" | 3 | #include "logger.hpp" |
4 | 4 | ||
5 | 5 | ||
6 | -//int saveJPEG(const char *szOutputFile, float* d_srcRGB, int img_width, int img_height) | ||
7 | -//{ | ||
8 | -// return jpegNPP(szOutputFile, d_srcRGB, img_width, img_height); | ||
9 | -// //return 0; | ||
10 | -//} | ||
11 | -// | ||
12 | -//int saveJPEG(const char *szOutputFile, unsigned char* d_srcRGB, int img_width, int img_height) | ||
13 | -//{ | ||
14 | -// return jpegNPP(szOutputFile, d_srcRGB, img_width, img_height); | ||
15 | -// //return 0; | ||
16 | -//} | ||
17 | -// | ||
18 | -//int saveJPEG(const char *szOutputFile, unsigned char* d_srcRGB) | ||
19 | -//{ | ||
20 | -// return jpegNPP(szOutputFile, d_srcRGB); | ||
21 | -//} | ||
22 | -// | ||
23 | -//int saveJPEG(const char *szOutputFile, float* d_srcRGB) | ||
24 | -//{ | ||
25 | -// return jpegNPP(szOutputFile, d_srcRGB); | ||
26 | -//} | ||
27 | - | ||
28 | int resizeFrame(float* d_srcRGB, int src_width, int src_height, float* d_dstRGB, int dst_width, int dst_height) | 6 | int resizeFrame(float* d_srcRGB, int src_width, int src_height, float* d_dstRGB, int dst_width, int dst_height) |
29 | { | 7 | { |
30 | cudaError_t cudaStatus = cuda_common::ResizeImage(d_srcRGB, src_width, src_height, d_dstRGB, dst_width, dst_height); | 8 | cudaError_t cudaStatus = cuda_common::ResizeImage(d_srcRGB, src_width, src_height, d_dstRGB, dst_width, dst_height); |
@@ -36,18 +14,6 @@ int resizeFrame(float* d_srcRGB, int src_width, int src_height, float* d_dstRGB, | @@ -36,18 +14,6 @@ int resizeFrame(float* d_srcRGB, int src_width, int src_height, float* d_dstRGB, | ||
36 | return 0; | 14 | return 0; |
37 | } | 15 | } |
38 | 16 | ||
39 | -//int initTables() | ||
40 | -//{ | ||
41 | -// initTable(); | ||
42 | -// return 0; | ||
43 | -//} | ||
44 | -// | ||
45 | -//int initTables(int flag, int width, int height) | ||
46 | -//{ | ||
47 | -// initTable(0, width, height); | ||
48 | -// return 0; | ||
49 | -//} | ||
50 | - | ||
51 | int drawImageOnGPU(float* d_srcRGB, int src_width, int src_height, int left, int top, int right, int bottom) | 17 | int drawImageOnGPU(float* d_srcRGB, int src_width, int src_height, int left, int top, int right, int bottom) |
52 | { | 18 | { |
53 | cuda_common::DrawImage(d_srcRGB, src_width, src_height, left, top, right, bottom); | 19 | cuda_common::DrawImage(d_srcRGB, src_width, src_height, left, top, right, bottom); |
@@ -66,12 +32,6 @@ int drawLineOnGPU(float* d_srcRGB, int src_width, int src_height, int begin_x, i | @@ -66,12 +32,6 @@ int drawLineOnGPU(float* d_srcRGB, int src_width, int src_height, int begin_x, i | ||
66 | return 0; | 32 | return 0; |
67 | } | 33 | } |
68 | 34 | ||
69 | -//int releaseJpegSaver() | ||
70 | -//{ | ||
71 | -// releaseJpegNPP(); | ||
72 | -// return 0; | ||
73 | -//} | ||
74 | - | ||
75 | int partMemCopy(unsigned char* d_srcRGB, int src_width, int src_height, unsigned char* d_dstRGB, int left, int top, int right, int bottom) | 35 | int partMemCopy(unsigned char* d_srcRGB, int src_width, int src_height, unsigned char* d_dstRGB, int left, int top, int right, int bottom) |
76 | { | 36 | { |
77 | cudaError_t cudaStatus = cuda_common::PartMemCopy(d_srcRGB, src_width, src_height, d_dstRGB, left, top, right, bottom); | 37 | cudaError_t cudaStatus = cuda_common::PartMemCopy(d_srcRGB, src_width, src_height, d_dstRGB, left, top, right, bottom); |
@@ -82,8 +42,7 @@ int partMemCopy(unsigned char* d_srcRGB, int src_width, int src_height, unsigned | @@ -82,8 +42,7 @@ int partMemCopy(unsigned char* d_srcRGB, int src_width, int src_height, unsigned | ||
82 | 42 | ||
83 | return 0; | 43 | return 0; |
84 | } | 44 | } |
85 | -//#include <fstream> | ||
86 | -//extern std::ofstream g_os; | 45 | + |
87 | int PartMemResizeBatch(unsigned char * d_srcRGB, int src_width, int src_height, unsigned char** d_dstRGB, | 46 | int PartMemResizeBatch(unsigned char * d_srcRGB, int src_width, int src_height, unsigned char** d_dstRGB, |
88 | int count, int* vleft, int * vtop, int* vright, int* vbottom, int *dst_w, int *dst_h, | 47 | int count, int* vleft, int * vtop, int* vright, int* vbottom, int *dst_w, int *dst_h, |
89 | float submeanb, float submeang, float submeanr, | 48 | float submeanb, float submeang, float submeanr, |
@@ -101,23 +60,4 @@ int PartMemResizeBatch(unsigned char * d_srcRGB, int src_width, int src_height, | @@ -101,23 +60,4 @@ int PartMemResizeBatch(unsigned char * d_srcRGB, int src_width, int src_height, | ||
101 | } | 60 | } |
102 | 61 | ||
103 | return 0; | 62 | return 0; |
104 | -} | ||
105 | - | ||
106 | - | ||
107 | -//int PartMemResizeBatch(float * d_srcRGB, int src_width, int src_height, unsigned char* d_dstRGB, | ||
108 | -// int count, int* vleft, int * vtop, int* vright, int* vbottom, int dst_w, int dst_h, | ||
109 | -// float submeanb, float submeang, float submeanr, | ||
110 | -// float varianceb, float varianceg, float variancer) | ||
111 | -// | ||
112 | -//{ | ||
113 | -// cudaError_t cudaStatus = cuda_common::PartMemResizeBatch( | ||
114 | -// d_srcRGB, src_width, src_height, d_dstRGB, count, vleft, vtop, vright, vbottom, dst_w, dst_h, | ||
115 | -// submeanb, submeang, submeanr, | ||
116 | -// varianceb, varianceg, variancer); | ||
117 | -// if (cudaStatus != cudaSuccess) { | ||
118 | -// fprintf(stderr, "cuda_common::PartMemCopy failed: %s\n", cudaGetErrorString(cudaStatus)); | ||
119 | -// return -1; | ||
120 | -// } | ||
121 | -// | ||
122 | -// return 0; | ||
123 | -//} | ||
124 | \ No newline at end of file | 63 | \ No newline at end of file |
64 | +} | ||
125 | \ No newline at end of file | 65 | \ No newline at end of file |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp
@@ -419,13 +419,6 @@ void CMutliSourceVideoProcess::FinishTask(const int taskID) | @@ -419,13 +419,6 @@ void CMutliSourceVideoProcess::FinishTask(const int taskID) | ||
419 | tasks[i].folderNameLittle = nullptr; | 419 | tasks[i].folderNameLittle = nullptr; |
420 | } | 420 | } |
421 | 421 | ||
422 | - | ||
423 | - if (tasks[i].taskDataToRT) | ||
424 | - { | ||
425 | - free(tasks[i].taskDataToRT); | ||
426 | - tasks[i].taskDataToRT = nullptr; | ||
427 | - } | ||
428 | - | ||
429 | tasks[i].frameImage.release(); | 422 | tasks[i].frameImage.release(); |
430 | 423 | ||
431 | 424 | ||
@@ -543,15 +536,19 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh | @@ -543,15 +536,19 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh | ||
543 | return false; | 536 | return false; |
544 | } | 537 | } |
545 | 538 | ||
546 | - int tmp_total_frame = new_task.taskTcuvid->DxGetFrameCount(); | 539 | + int total_frame = new_task.taskTcuvid->DxGetFrameCount(); |
547 | 540 | ||
548 | - printf("finish add codec. tmp_total_frame: %d \n", tmp_total_frame); | 541 | + int width = 0; |
542 | + int height = 0; | ||
543 | + new_task.taskTcuvid->DxGetResolution(width, height); | ||
549 | 544 | ||
545 | + LOG_INFO("[{}] - finish add codec. w:{} h:{} total_frame:", cfg.name.c_str(), width, height, total_frame); | ||
546 | + | ||
547 | + new_task.frameImage = cv::Mat::zeros(height, width, CV_8UC3); | ||
550 | new_task.taskState = PLAY; | 548 | new_task.taskState = PLAY; |
551 | new_task.task_algorithm_data.frame = NULL; | 549 | new_task.task_algorithm_data.frame = NULL; |
552 | new_task.taskFrameCount = 0; | 550 | new_task.taskFrameCount = 0; |
553 | new_task.taskLastFrameCount = 0; | 551 | new_task.taskLastFrameCount = 0; |
554 | - new_task.taskDataToRT = NULL; | ||
555 | 552 | ||
556 | new_task.taskObjCallbackFunc = nullptr; | 553 | new_task.taskObjCallbackFunc = nullptr; |
557 | if (objCallbackFunc != nullptr) | 554 | if (objCallbackFunc != nullptr) |
@@ -561,7 +558,7 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh | @@ -561,7 +558,7 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh | ||
561 | if (realTimeCallbackFunc != nullptr) | 558 | if (realTimeCallbackFunc != nullptr) |
562 | new_task.taskRealTimeCallbackFunc = std::bind(realTimeCallbackFunc, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); | 559 | new_task.taskRealTimeCallbackFunc = std::bind(realTimeCallbackFunc, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); |
563 | 560 | ||
564 | - new_task.taskTotalFrameCount = tmp_total_frame; | 561 | + new_task.taskTotalFrameCount = total_frame; |
565 | if (resultFolderLittle == NULL) | 562 | if (resultFolderLittle == NULL) |
566 | { | 563 | { |
567 | new_task.folderNameLittle = NULL; | 564 | new_task.folderNameLittle = NULL; |
@@ -620,10 +617,6 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh | @@ -620,10 +617,6 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh | ||
620 | CreateResultFolder(new_task.folderNameFace, ""); | 617 | CreateResultFolder(new_task.folderNameFace, ""); |
621 | } | 618 | } |
622 | 619 | ||
623 | - // printf("finish create folder\n"); | ||
624 | - | ||
625 | - //Sleep(10); | ||
626 | - //std::cout << "CreateResultFolder" << std::endl; | ||
627 | TASK_INFO new_task_info = {}; | 620 | TASK_INFO new_task_info = {}; |
628 | new_task_info.image_folder = new_task.folderName; | 621 | new_task_info.image_folder = new_task.folderName; |
629 | new_task_info.snapshot_folder = new_task.folderNameLittle; | 622 | new_task_info.snapshot_folder = new_task.folderNameLittle; |
@@ -638,6 +631,8 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh | @@ -638,6 +631,8 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh | ||
638 | TaskinPlay++; | 631 | TaskinPlay++; |
639 | tasks.push_back(new_task); | 632 | tasks.push_back(new_task); |
640 | 633 | ||
634 | + AddTaskTracker(VPT_Handle, new_task.taskID, width, height); | ||
635 | + | ||
641 | if (!ProcessFlag) { | 636 | if (!ProcessFlag) { |
642 | ProcessThread = boost::thread(ThreadProcess, this); | 637 | ProcessThread = boost::thread(ThreadProcess, this); |
643 | ProcessFlag = true; | 638 | ProcessFlag = true; |
@@ -1492,8 +1487,10 @@ DWORD ThreadProcess(LPVOID param) | @@ -1492,8 +1487,10 @@ DWORD ThreadProcess(LPVOID param) | ||
1492 | if (0 != copy_obj_count) | 1487 | if (0 != copy_obj_count) |
1493 | { | 1488 | { |
1494 | cudaSetDevice(pThreadParam->mgpuid); | 1489 | cudaSetDevice(pThreadParam->mgpuid); |
1490 | + cuCtxPushCurrent(context); | ||
1495 | PartMemResizeBatch((unsigned char*)pThreadParam->tasks[*iter].task_algorithm_data.frame, frameWidth, frameHeight, | 1491 | PartMemResizeBatch((unsigned char*)pThreadParam->tasks[*iter].task_algorithm_data.frame, frameWidth, frameHeight, |
1496 | snapshot_image_data, copy_obj_count, snapshot_left, snapshot_top, snapshot_right, snapshot_bottom, snapshot_dst_width, snapshot_dst_height, 0, 0, 0, 1, 1, 1); | 1492 | snapshot_image_data, copy_obj_count, snapshot_left, snapshot_top, snapshot_right, snapshot_bottom, snapshot_dst_width, snapshot_dst_height, 0, 0, 0, 1, 1, 1); |
1493 | + cuCtxPopCurrent(&context); | ||
1497 | 1494 | ||
1498 | //最新刚添加的人脸检测模块,针对存在的行人快照进行人脸检测+人脸快照框的优选 | 1495 | //最新刚添加的人脸检测模块,针对存在的行人快照进行人脸检测+人脸快照框的优选 |
1499 | if (pThreadParam->m_face_det_config == SY_CONFIG_OPEN && !human_idx.empty()) | 1496 | if (pThreadParam->m_face_det_config == SY_CONFIG_OPEN && !human_idx.empty()) |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp.qx
@@ -410,13 +410,6 @@ void CMutliSourceVideoProcess::FinishTask(const int taskID) | @@ -410,13 +410,6 @@ void CMutliSourceVideoProcess::FinishTask(const int taskID) | ||
410 | tasks[i].folderNameLittle = nullptr; | 410 | tasks[i].folderNameLittle = nullptr; |
411 | } | 411 | } |
412 | 412 | ||
413 | - | ||
414 | - if (tasks[i].taskDataToRT) | ||
415 | - { | ||
416 | - free(tasks[i].taskDataToRT); | ||
417 | - tasks[i].taskDataToRT = nullptr; | ||
418 | - } | ||
419 | - | ||
420 | tasks[i].frameImage.release(); | 413 | tasks[i].frameImage.release(); |
421 | 414 | ||
422 | 415 | ||
@@ -553,7 +546,6 @@ bool CMutliSourceVideoProcess::AddTask(const char* videoFileName, const char* re | @@ -553,7 +546,6 @@ bool CMutliSourceVideoProcess::AddTask(const char* videoFileName, const char* re | ||
553 | new_task.task_algorithm_data.frame = NULL; | 546 | new_task.task_algorithm_data.frame = NULL; |
554 | new_task.taskFrameCount = 0; | 547 | new_task.taskFrameCount = 0; |
555 | new_task.taskLastFrameCount = 0; | 548 | new_task.taskLastFrameCount = 0; |
556 | - new_task.taskDataToRT = NULL; | ||
557 | 549 | ||
558 | new_task.taskObjCallbackFunc = nullptr; | 550 | new_task.taskObjCallbackFunc = nullptr; |
559 | if (objCallbackFunc != nullptr) | 551 | if (objCallbackFunc != nullptr) |
@@ -1039,14 +1031,13 @@ DWORD ThreadProcess(LPVOID param) | @@ -1039,14 +1031,13 @@ DWORD ThreadProcess(LPVOID param) | ||
1039 | if (cudaStatus != cudaSuccess) { | 1031 | if (cudaStatus != cudaSuccess) { |
1040 | fprintf(stderr, "here cudaMalloc m_pRGBData[0] failed! error: %s\n", cudaGetErrorString(cudaStatus)); | 1032 | fprintf(stderr, "here cudaMalloc m_pRGBData[0] failed! error: %s\n", cudaGetErrorString(cudaStatus)); |
1041 | break; | 1033 | break; |
1042 | - } | 1034 | + } |
1043 | 1035 | ||
1044 | pThreadParam->tasks[i].task_algorithm_data.height = frame.height; | 1036 | pThreadParam->tasks[i].task_algorithm_data.height = frame.height; |
1045 | pThreadParam->tasks[i].task_algorithm_data.width = frame.width; | 1037 | pThreadParam->tasks[i].task_algorithm_data.width = frame.width; |
1046 | pThreadParam->tasks[i].task_algorithm_data.size = frame.size; | 1038 | pThreadParam->tasks[i].task_algorithm_data.size = frame.size; |
1047 | 1039 | ||
1048 | pThreadParam->tasks[i].frameImage = cv::Mat::zeros(frame.height, frame.width, CV_8UC3); | 1040 | pThreadParam->tasks[i].frameImage = cv::Mat::zeros(frame.height, frame.width, CV_8UC3); |
1049 | - pThreadParam->tasks[i].taskDataToRT = (float*)malloc(3 * frame.height * frame.width * sizeof(unsigned char)); | ||
1050 | AddTaskTracker(pThreadParam->VPT_Handle, pThreadParam->tasks[i].taskID, 1, 1); | 1041 | AddTaskTracker(pThreadParam->VPT_Handle, pThreadParam->tasks[i].taskID, 1, 1); |
1051 | } | 1042 | } |
1052 | 1043 |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.h
@@ -147,7 +147,6 @@ struct Task{ | @@ -147,7 +147,6 @@ struct Task{ | ||
147 | TaskState taskState; | 147 | TaskState taskState; |
148 | DxDecoderWrap *taskTcuvid; | 148 | DxDecoderWrap *taskTcuvid; |
149 | DxGPUFrame task_algorithm_data; //����¿�ܲ���resize�Ĵ���������ʱ��backup��ԭͼ��С��ͼƬ�ͽ��㷨������� | 149 | DxGPUFrame task_algorithm_data; //����¿�ܲ���resize�Ĵ���������ʱ��backup��ԭͼ��С��ͼƬ�ͽ��㷨������� |
150 | - float* taskDataToRT; | ||
151 | bool taskHasBackup; | 150 | bool taskHasBackup; |
152 | //VideoHeightWidth taskHeightWidthRatio; | 151 | //VideoHeightWidth taskHeightWidthRatio; |
153 | VideoHeightWidth taskHeightWidth; | 152 | VideoHeightWidth taskHeightWidth; |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/VPTProcess.cpp
@@ -404,49 +404,48 @@ int VPT_Process_GPU(void * handle, sy_img * batch_img, int startBatch, int batch | @@ -404,49 +404,48 @@ int VPT_Process_GPU(void * handle, sy_img * batch_img, int startBatch, int batch | ||
404 | 404 | ||
405 | for (int i = startBatch; i < tools->taskTrackers.size(); i++) | 405 | for (int i = startBatch; i < tools->taskTrackers.size(); i++) |
406 | { | 406 | { |
407 | - if (!tools->taskTrackers[i].tracker.GetState()) { | 407 | + TaskTracker task_tracker = tools->taskTrackers[i]; |
408 | + if (!task_tracker.tracker.GetState()) { | ||
408 | continue; | 409 | continue; |
409 | } | 410 | } |
410 | 411 | ||
411 | - //cout << "task index : " << i << " lastFrameIndex: " << tools->taskTrackers[i].lastFrameIndex << " cur_frameIndex:" << vec_frameIndex[detectIndex] << endl; | ||
412 | - int width = 1920; int height = 1080; | ||
413 | - if (tools->taskTrackers[i].lastFrameIndex <= 0) { | 412 | + if (task_tracker.lastFrameIndex <= 0) { |
414 | // 第一帧,只做带检测框的跟踪 | 413 | // 第一帧,只做带检测框的跟踪 |
415 | - int objCount = tools->taskTrackers[i].tracker.update(/*tools->param.w*/width* tools->taskTrackers[i].ratioWidth, /*tools->param.h*/height* tools->taskTrackers[i].ratioHeight, true, detectResult[detectIndex], result[resIndex].obj, deleteObjectID[detectIndex]); | 414 | + int objCount = task_tracker.tracker.update(task_tracker.ratioWidth, task_tracker.ratioHeight, true, detectResult[detectIndex], result[resIndex].obj, deleteObjectID[detectIndex]); |
416 | result[resIndex].objCount = objCount; | 415 | result[resIndex].objCount = objCount; |
417 | vector<vector<float>>().swap(detectResult[detectIndex]); | 416 | vector<vector<float>>().swap(detectResult[detectIndex]); |
418 | detectResult[detectIndex].clear(); | 417 | detectResult[detectIndex].clear(); |
419 | 418 | ||
420 | - tools->taskTrackers[i].lastFrameIndex = vec_frameIndex[detectIndex]; | 419 | + task_tracker.lastFrameIndex = vec_frameIndex[detectIndex]; |
421 | continue; | 420 | continue; |
422 | } | 421 | } |
423 | 422 | ||
424 | - int update_times = vec_frameIndex[detectIndex] - tools->taskTrackers[i].lastFrameIndex - 1; | 423 | + int update_times = vec_frameIndex[detectIndex] - task_tracker.lastFrameIndex - 1; |
425 | if (update_times < 0) | 424 | if (update_times < 0) |
426 | { | 425 | { |
427 | - cout << "FrameIndex error !! lastFrameIndex= "<< tools->taskTrackers[i].lastFrameIndex <<" cur_frameindex = " << vec_frameIndex[detectIndex] << endl; | 426 | + cout << "FrameIndex error !! lastFrameIndex= "<< task_tracker.lastFrameIndex <<" cur_frameindex = " << vec_frameIndex[detectIndex] << endl; |
428 | } | 427 | } |
429 | - // cout << "lastFrameIndex= " << tools->taskTrackers[i].lastFrameIndex << " cur_frameindex = " << vec_frameIndex[detectIndex] << endl; | 428 | + // cout << "lastFrameIndex= " << task_tracker.lastFrameIndex << " cur_frameindex = " << vec_frameIndex[detectIndex] << endl; |
430 | // cout << "update_times = " << update_times << endl; | 429 | // cout << "update_times = " << update_times << endl; |
431 | 430 | ||
432 | for (int j = 0; j < update_times; j++) | 431 | for (int j = 0; j < update_times; j++) |
433 | { // 无检测框跟踪 | 432 | { // 无检测框跟踪 |
434 | - //cout << "taskTrackers size: " << tools->taskTrackers.size() << " batchsize:" << detectResult.size() << " update_times: "<< update_times << endl; | 433 | + //cout << "taskTrackers size: " << task_tracker.size() << " batchsize:" << detectResult.size() << " update_times: "<< update_times << endl; |
435 | VPT_Result unresult; | 434 | VPT_Result unresult; |
436 | VPT_ObjInfo obj[MAX_OBJ_COUNT]; | 435 | VPT_ObjInfo obj[MAX_OBJ_COUNT]; |
437 | - unresult.objCount = tools->taskTrackers[i].tracker.update(/*tools->param.w*/width* tools->taskTrackers[i].ratioWidth, /*tools->param.h*/height* tools->taskTrackers[i].ratioHeight, false, detectResult[detectIndex], unresult.obj, deleteObjectID[detectIndex]); | 436 | + unresult.objCount =task_tracker.tracker.update(task_tracker.ratioWidth, task_tracker.ratioHeight, false, detectResult[detectIndex], unresult.obj, deleteObjectID[detectIndex]); |
438 | check_VPT_Result(unresult); | 437 | check_VPT_Result(unresult); |
439 | unUsedResult[resIndex].push_back(unresult); | 438 | unUsedResult[resIndex].push_back(unresult); |
440 | } | 439 | } |
441 | 440 | ||
442 | //有检测框输入的跟踪 | 441 | //有检测框输入的跟踪 |
443 | - int objCount = tools->taskTrackers[i].tracker.update(/*tools->param.w*/width* tools->taskTrackers[i].ratioWidth, /*tools->param.h*/height* tools->taskTrackers[i].ratioHeight, true, detectResult[detectIndex], result[resIndex].obj, deleteObjectID[detectIndex]); | 442 | + int objCount = task_tracker.tracker.update(task_tracker.ratioWidth, task_tracker.ratioHeight, true, detectResult[detectIndex], result[resIndex].obj, deleteObjectID[detectIndex]); |
444 | result[resIndex].objCount = objCount; | 443 | result[resIndex].objCount = objCount; |
445 | vector<vector<float>>().swap(detectResult[detectIndex]); | 444 | vector<vector<float>>().swap(detectResult[detectIndex]); |
446 | detectResult[detectIndex].clear(); | 445 | detectResult[detectIndex].clear(); |
447 | 446 | ||
448 | // 记录帧序号 | 447 | // 记录帧序号 |
449 | - tools->taskTrackers[i].lastFrameIndex = vec_frameIndex[detectIndex]; | 448 | + task_tracker.lastFrameIndex = vec_frameIndex[detectIndex]; |
450 | 449 | ||
451 | check_VPT_Result(result[resIndex]); | 450 | check_VPT_Result(result[resIndex]); |
452 | 451 |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/FaceDetModule.cpp
@@ -102,15 +102,10 @@ int face_det_module::face_det_module_init(int gpuid, char* auth_license) | @@ -102,15 +102,10 @@ int face_det_module::face_det_module_init(int gpuid, char* auth_license) | ||
102 | 102 | ||
103 | int face_det_module::face_det_module_process(sy_img* img, int batchsize, fd_result *face_det_result, sy_point* original_size) | 103 | int face_det_module::face_det_module_process(sy_img* img, int batchsize, fd_result *face_det_result, sy_point* original_size) |
104 | { | 104 | { |
105 | - //static int framcount = 0; | ||
106 | - //printf("framcount: %d\n", framcount++); | ||
107 | if (sy_process_param_check(m_face_det_handle, img, batchsize) == FAILED) | 105 | if (sy_process_param_check(m_face_det_handle, img, batchsize) == FAILED) |
108 | return FAILED; | 106 | return FAILED; |
109 | 107 | ||
110 | sy_img *cpu_img = new sy_img[batchsize]; | 108 | sy_img *cpu_img = new sy_img[batchsize]; |
111 | - //unsigned char** data = new unsigned char*[batchsize]; | ||
112 | - cv::Mat *human_image = new cv::Mat[batchsize]; | ||
113 | - cv::Mat *human_image_ori = new cv::Mat[batchsize]; | ||
114 | 109 | ||
115 | for (int b = 0; b < batchsize; b++) { | 110 | for (int b = 0; b < batchsize; b++) { |
116 | cpu_img[b].c_ = 3; | 111 | cpu_img[b].c_ = 3; |
@@ -134,33 +129,16 @@ int face_det_module::face_det_module_process(sy_img* img, int batchsize, fd_resu | @@ -134,33 +129,16 @@ int face_det_module::face_det_module_process(sy_img* img, int batchsize, fd_resu | ||
134 | for (int b = 0; b < batchsize; b++) | 129 | for (int b = 0; b < batchsize; b++) |
135 | { | 130 | { |
136 | int real_count = 0; | 131 | int real_count = 0; |
137 | - // cv::Mat tmp_img(img[b].h_, img[b].w_, CV_8UC3, cpu_img[b].data_); | ||
138 | for (int c = 0; c < face_det_result[b].count; c++) | 132 | for (int c = 0; c < face_det_result[b].count; c++) |
139 | { | 133 | { |
140 | if (face_det_result[b].info[c].score >= 0.5) | 134 | if (face_det_result[b].info[c].score >= 0.5) |
141 | { | 135 | { |
142 | - /*printf("score: %f\n", face_det_result[b].info[c].score); | ||
143 | - cv::rectangle(tmp_img, cv::Rect(face_det_result[b].info[0].face_position.left_, | ||
144 | - face_det_result[b].info[0].face_position.top_, | ||
145 | - face_det_result[b].info[0].face_position.width_, | ||
146 | - face_det_result[b].info[0].face_position.height_), cv::Scalar(25, 250, 25), 2, 8, 0); | ||
147 | - cv::imshow("face", tmp_img); | ||
148 | - cv::waitKey(0);*/ | ||
149 | - | ||
150 | - /*printf("face det: %d %d %d %d %d %d\n", face_det_result[b].info[0].face_position.left_, | ||
151 | - face_det_result[b].info[0].face_position.top_, | ||
152 | - face_det_result[b].info[0].face_position.width_, | ||
153 | - face_det_result[b].info[0].face_position.height_, | ||
154 | - face_det_result[b].info[0].facial_fea_point[0].x_, | ||
155 | - face_det_result[b].info[0].facial_fea_point[0].y_);*/ | ||
156 | - | ||
157 | memcpy((void*)&face_det_result[b].info[real_count], (void*)&face_det_result[b].info[c], sizeof(fd_info)); | 136 | memcpy((void*)&face_det_result[b].info[real_count], (void*)&face_det_result[b].info[c], sizeof(fd_info)); |
158 | real_count++; | 137 | real_count++; |
159 | } | 138 | } |
160 | } | 139 | } |
161 | face_det_result[b].count = real_count; | 140 | face_det_result[b].count = real_count; |
162 | } | 141 | } |
163 | - | ||
164 | 142 | ||
165 | for (int b = 0; b < batchsize; b++) { | 143 | for (int b = 0; b < batchsize; b++) { |
166 | if(cpu_img[b].data_) { | 144 | if(cpu_img[b].data_) { |
@@ -168,8 +146,6 @@ int face_det_module::face_det_module_process(sy_img* img, int batchsize, fd_resu | @@ -168,8 +146,6 @@ int face_det_module::face_det_module_process(sy_img* img, int batchsize, fd_resu | ||
168 | } | 146 | } |
169 | } | 147 | } |
170 | if (cpu_img) delete[] cpu_img; | 148 | if (cpu_img) delete[] cpu_img; |
171 | - if (human_image) delete[] human_image; | ||
172 | - if (human_image_ori) delete[] human_image_ori; | ||
173 | 149 | ||
174 | return ret; | 150 | return ret; |
175 | } | 151 | } |