diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..c2098a2 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "linux-gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "/usr/bin/gcc", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "linux-gcc-x64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index b7aff4f..bee2d20 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,78 +1,120 @@ { - "version": "0.2.0", - "configurations": [ - { - "name": "mvpt", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/test", - "args": ["file:///home/cmhu/data/video/Street.uvf","2","0","./db/mvpt.bin"], - "stopAtEntry": false, - "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512", - "environment": [], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - },{ - "name": "test_face", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/test_face", - "args": ["file:///home/cmhu/data/video/Street.uvf?fastdecode=on","6","0","./db/mvpt.bin"], - "stopAtEntry": false, - "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512", - "environment": [], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - },{ - "name": "DxDecoderTest", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/DxDecoderTest", - "args": ["file:///home/cmhu/data/video/Street.uvf?fastdecode=on","6","0","./db/mvpt.bin"], - "stopAtEntry": false, - "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512", - "environment": [], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - },{ - "name": "vpdr_test", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/vpdr_test", - "args": ["file:///home/cmhu/data/video/Street.uvf?fastdecode=on","6","0","./db/mvpt.bin"], - "stopAtEntry": false, - "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512", - "environment": [], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - } - ] - } \ No newline at end of file + "version": "0.2.0", + "configurations": [ + { + "name": "mvpt", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/test", + "args": [ + "file:///home/cmhu/data/video/dongba.mp4", + "2", + "0", + "./db/mvpt.bin" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, + { + "name": "test_face", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/test_face", + "args": [ + "file:///home/cmhu/data/video/Street.uvf?fastdecode=on", + "6", + "0", + "./db/mvpt.bin" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, + { + "name": "DxDecoderTest", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/DxDecoderTest", + "args": [ + "file:///home/cmhu/data/video/Street.uvf?fastdecode=on", + "6", + "0", + "./db/mvpt.bin" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, + { + "name": "vpdr_test", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512/vpdr_test", + "args": [ + "file:///home/cmhu/data/video/Street.uvf?fastdecode=on", + "6", + "0", + "./db/mvpt.bin" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/Linux_3rdparty/video_structure_sdk_20220512", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": false, + "cwd": "/home/cmhu/Project_VideoStructure/vehicle_structure_platform.git0708-3080-trt-face/src/VPT", + "program": "/home/cmhu/Project_VideoStructure/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index e553057..87cb0d0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,85 +1,142 @@ { - "files.associations": { - "*.tcc": "cpp", - "fstream": "cpp", - "system_error": "cpp", - "thread": "cpp", - "chrono": "cpp", - "cctype": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "csignal": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "*.ipp": "cpp", - "array": "cpp", - "atomic": "cpp", - "hash_map": "cpp", - "hash_set": "cpp", - "strstream": "cpp", - "bitset": "cpp", - "complex": "cpp", - "condition_variable": "cpp", - "cstdint": "cpp", - "deque": "cpp", - "forward_list": "cpp", - "list": "cpp", - "unordered_map": "cpp", - "unordered_set": "cpp", - "vector": "cpp", - "exception": "cpp", - "rope": "cpp", - "slist": "cpp", - "functional": "cpp", - "future": "cpp", - "initializer_list": "cpp", - "iomanip": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "limits": "cpp", - "mutex": "cpp", - "new": "cpp", - "ostream": "cpp", - "numeric": "cpp", - "ratio": "cpp", - "sstream": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "cfenv": "cpp", - "cinttypes": "cpp", - "regex": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "utility": "cpp", - "typeindex": "cpp", - "typeinfo": "cpp", - "valarray": "cpp", - "bit": "cpp", - "codecvt": "cpp", - "compare": "cpp", - "concepts": "cpp", - "map": "cpp", - "set": "cpp", - "string": "cpp", - "algorithm": "cpp", - "iterator": "cpp", - "memory": "cpp", - "memory_resource": "cpp", - "optional": "cpp", - "random": "cpp", - "string_view": "cpp", - "numbers": "cpp", - "semaphore": "cpp", - "stop_token": "cpp", - "variant": "cpp", - "*.inc": "cpp" - }, - "git.ignoreLimitWarning": true + "files.associations": { + "*.tcc": "cpp", + "fstream": "cpp", + "system_error": "cpp", + "thread": "cpp", + "chrono": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "csignal": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "*.ipp": "cpp", + "array": "cpp", + "atomic": "cpp", + "hash_map": "cpp", + "hash_set": "cpp", + "strstream": "cpp", + "bitset": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "cstdint": "cpp", + "deque": "cpp", + "forward_list": "cpp", + "list": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "rope": "cpp", + "slist": "cpp", + "functional": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "ostream": "cpp", + "numeric": "cpp", + "ratio": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "cfenv": "cpp", + "cinttypes": "cpp", + "regex": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "typeindex": "cpp", + "typeinfo": "cpp", + "valarray": "cpp", + "bit": "cpp", + "codecvt": "cpp", + "compare": "cpp", + "concepts": "cpp", + "map": "cpp", + "set": "cpp", + "string": "cpp", + "algorithm": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "optional": "cpp", + "random": "cpp", + "string_view": "cpp", + "numbers": "cpp", + "semaphore": "cpp", + "stop_token": "cpp", + "variant": "cpp", + "*.inc": "cpp" + }, + "git.ignoreLimitWarning": true, + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false } \ No newline at end of file diff --git a/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.cpp b/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.cpp index 37a2bde..b7df98d 100644 --- a/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.cpp +++ b/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.cpp @@ -6,10 +6,6 @@ #include "sfx_depend_inc.h" -#include "cuda_kernels.h" -#include -#include - using namespace std; SfxDecoder::SfxDecoder( ) @@ -47,30 +43,30 @@ bool SfxDecoder::OpenDecoder(DxDecoderConfig& cfg) sfx_cfg->flags.useFastDecode = 0; sfx_cfg->flags.accelId = m_cfg.devId; sfx_cfg->flags.frameNumber = 1; - // sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_NV12U8; - sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_C3BGRU8; + sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_NV12U8; + //sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_C3BGRU8; m_handler = SfxStreamHandlerInterface::SfxGetInstance(sfx_cfg); m_dec_name = m_cfg.dec_name; - cout << "open: " << m_cfg.uri << endl; - int nRet = m_handler->SfxOpenStreamHandler( m_cfg.uri.c_str() ); if (nRet != 0) { m_bRun = false; - - LOG_INFO( "[{}]-OpenDecoder failed!", m_dec_name); + LOG_ERROR( "[{}]-OpenDecoder failed: {}", m_dec_name, m_cfg.uri); return false; } m_bRun = true; + + LOG_DEBUG("[{}]-OpenDecoder succeed: {}", m_dec_name, m_cfg.uri); + return true; } int SfxDecoder::CloseDecoder() { - if (sfx_null != m_handler) { // linux待同步 + if (sfx_null != m_handler) { m_handler->SfxCloseStreamHandler(); while (m_bRun) { @@ -137,7 +133,7 @@ sfx_32 SfxDecoder::SfxLogDefaultHandler( sfx_u32 logLen ) { - SfxDecoder * pThis = ( SfxDecoder * )userPtr; + SfxDecoder * pThis = (SfxDecoder*)userPtr; if ( SFX_LOG_LEVEL_IMPORTANT == level) //modify by zsh 220602 { @@ -147,13 +143,15 @@ sfx_32 SfxDecoder::SfxLogDefaultHandler( if ( SFX_LOG_LEVEL_CLEANUP == level ) { + pThis->m_handler = sfx_null; pThis->m_bRun = sfx_false; if ( pThis->m_cfg.logcbk ) { + //LOG_DEBUG("[{}]- DX_LOG_LEVEL_CLEANUP {}", pThis->m_dec_name, reinterpret_cast(pThis)); pThis->m_cfg.logcbk( pThis->m_cfg.userPtr, DX_LOG_LEVEL_CLEANUP, "DxDecoder[CUDA] module exited..", 0 ); } } - else if (pThis->m_cfg.log_all) + else if (pThis->m_cfg.log_all) { pThis->m_cfg.log_all(pThis->m_cfg.log_user_ptr, (int)level, log, logLen); } diff --git a/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.h b/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.h index 439c03c..d33db1e 100644 --- a/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.h +++ b/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.h @@ -30,7 +30,7 @@ typedef void (*DXDECODER_CALLBACK)( const void * userPtr, void * buf, unsigned i typedef struct DxDecoderConfig { DxLogHandler logcbk; // 日志回调接口 - LOG_ALL_CALLBACK log_all{nullptr}; + LOG_ALL_CALLBACK log_all{ nullptr }; void* log_user_ptr{nullptr}; const void * userPtr; // 用户数据 DXDECODER_CALLBACK escbk; // 解码后帧数据回调接口 @@ -69,6 +69,8 @@ public: DxVideoConfig m_video; SfxStreamHandlerInterface * m_handler; + string m_dec_name; + private: static sfx_32 sfx_stdcall SfxStreamCallback( const sfx_void * userPtr, @@ -91,7 +93,6 @@ private: sfx_bool m_bRun; bool m_bReal{false}; - string m_dec_name; }; diff --git a/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp b/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp index d35fab9..671c82c 100644 --- a/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp +++ b/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp @@ -352,7 +352,7 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh return false; } - LOG_INFO("[{}] - finish add codec.", cfg.name.c_str()); + LOG_INFO("[{}] - add codec succeed.", cfg.name.c_str()); new_task.taskState = PLAY; new_task.taskFrameCount = 0; diff --git a/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VPTProcess.cpp b/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VPTProcess.cpp index d3d2ac0..f19ec0a 100644 --- a/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VPTProcess.cpp +++ b/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/VPTProcess.cpp @@ -157,7 +157,7 @@ int VPTProcess::init(int gpuid, int max_batch_size) param.device_type_ = DEVICE_GPU; param.device_id_ = gpuid; param.engine_type_ = ENGINE_TENSORRT; - param.trt_serialize_file_ = "./serialize_file/V_VPT"; + param.trt_serialize_file_ = "./serialize_file/VPT"; m_max_batch_size = max_batch_size; diff --git a/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.cpp b/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.cpp index d3edbf9..5e85a0e 100644 --- a/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.cpp +++ b/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.cpp @@ -1,14 +1,15 @@ #include "opencv2/opencv.hpp" #include "opencv2/highgui/highgui.hpp" #include "snapshot_helper.h" -#include "CropImg.h" #include +#include #include "depend_inc.h" #include "../mvpt_process_assist.h" #include "../common.h" -#include "../cuda_src/ImageSaveGPU.h" +#include "../../cuda_src/ImageSaveGPU.h" +#include "../../cuda_src/CropImg.h" using namespace std; @@ -565,22 +566,26 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是 if (hcp_batch_count == 0) continue; - sy_img finish_hcp_img[hcp_batch_count]; + vector vec_hcp_img; + //sy_img finish_hcp_img[hcp_batch_count]; for (int j = 0; j < hcp_batch_count; j++) { OBJ_KEY cur_obj_key = hcp_keys[j]; - // printf() - finish_hcp_img[j].set_data(HCP_WIDTH, HCP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + sy_img finish_hcp_img; + finish_hcp_img.set_data(HCP_WIDTH, HCP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + vec_hcp_img.push_back(finish_hcp_img); } - hcp_analysis_result result[hcp_batch_count]; + //hcp_analysis_result result[hcp_batch_count]; + vector< hcp_analysis_result> result(hcp_batch_count); if (hcp_analysis_cf == SY_CONFIG_OPEN) { - m_human_car_parsing.process(finish_hcp_img, hcp_batch_count, result); + m_human_car_parsing.process(vec_hcp_img.data(), hcp_batch_count, result.data()); } - human_fea_result result_f[hcp_batch_count]; + //human_fea_result result_f[hcp_batch_count]; + vector< human_fea_result> result_f(hcp_batch_count); if (hcf_recg_cf == SY_CONFIG_OPEN) { - m_human_fea.process(finish_hcp_img, hcp_batch_count, result_f); + m_human_fea.process(vec_hcp_img.data(), hcp_batch_count, result_f.data()); } int resIndex = 0; @@ -646,13 +651,17 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是 det_batch_size = vehicle_keys.size(); } - sy_img finish_vehicle_img[det_batch_size]; + vector< sy_img> vec_vehicle_img; vector det_vehicle_keys; for (int j = 0; j < det_batch_size; j++) { OBJ_KEY cur_obj_key = vehicle_keys.front(); det_vehicle_keys.push_back(cur_obj_key); - finish_vehicle_img[j].set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + + sy_img finish_vehicle_img; + finish_vehicle_img.set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + vec_vehicle_img.push_back(finish_vehicle_img); + vehicle_keys.pop(); } @@ -660,9 +669,9 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是 vehicle_plate_result *vp_result = new vehicle_plate_result[det_batch_size]{}; vr_result *vrresult = new vr_result[det_batch_size]{}; if (vehicle_analysis_cf == SY_CONFIG_OPEN) { - m_vehicle_color.process(finish_vehicle_img, det_batch_size, vcresult); - m_vehicle_plate.process(finish_vehicle_img, det_batch_size, vp_result); - VehicleRecog_Process(finish_vehicle_img, det_batch_size, vrresult, det_vehicle_keys.data()); + m_vehicle_color.process(vec_vehicle_img.data(), det_batch_size, vcresult); + m_vehicle_plate.process(vec_vehicle_img.data(), det_batch_size, vp_result); + VehicleRecog_Process(vec_vehicle_img.data(), det_batch_size, vrresult, det_vehicle_keys.data()); } int8 ** fea = nullptr; @@ -672,7 +681,7 @@ void snapshot_helper::finish_task_ss_analysis(int task_id) //是 fea[ii] = new int8[FEATURESIZE]{}; } - m_vehicle_feature.process_vf(finish_vehicle_img, det_batch_size, fea); + m_vehicle_feature.process_vf(vec_vehicle_img.data(), det_batch_size, fea); } int feaIndex = 0; @@ -797,7 +806,7 @@ void snapshot_helper::hp_analysis() int cur_batchsize = index == 0 ? per_batchsize : OBJ_BATCH_COUNT - per_batchsize; - sy_img batch_hp[cur_batchsize]; + vector vec_hp_img; for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT / OBJ_SCALE*/; i++) { OBJ_KEY cur_obj_key = count_person.front(); @@ -820,19 +829,23 @@ void snapshot_helper::hp_analysis() } //printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~count_person = %d\n", count_person.size()); erase_obj_key.push_back(cur_obj_key); - batch_hp[i].set_data(HP_WIDTH, HP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + + sy_img hp_img; + hp_img.set_data(HP_WIDTH, HP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + vec_hp_img.push_back(hp_img); + ++obj_batch_count; } //算法分析 if (hp_analysis_cf == SY_CONFIG_OPEN) { result = new hp_analysis_res[obj_batch_count]{}; - m_human_parsing.process(batch_hp, obj_batch_count, result); + m_human_parsing.process(vec_hp_img.data(), obj_batch_count, result); } if (hf_recg_cf == SY_CONFIG_OPEN) { result_f = new human_fea_result[obj_batch_count]{}; - m_human_fea.process(batch_hp, obj_batch_count, result_f); + m_human_fea.process(vec_hp_img.data(), obj_batch_count, result_f); } //删除已经进行保存和二次属性分析的目标 @@ -906,7 +919,7 @@ void snapshot_helper::hcp_analysis() human_fea_result * result_f = nullptr; int cur_batchsize = index == 0 ? per_batchsize : OBJ_BATCH_COUNT - per_batchsize; - sy_img batch_hcp[cur_batchsize]; + vector vec_hcp_img; for (int i = 0; i < cur_batchsize; i++) { OBJ_KEY cur_obj_key = count_bike.front(); @@ -930,18 +943,21 @@ void snapshot_helper::hcp_analysis() } erase_obj_key.push_back(cur_obj_key); - batch_hcp[i].set_data(HCP_WIDTH, HCP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + sy_img hcp_img; + hcp_img.set_data(HCP_WIDTH, HCP_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + vec_hcp_img.push_back(hcp_img); + ++obj_batch_count; } //printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~count_bike = %d\n", count_bike.size()); if (hcp_analysis_cf == SY_CONFIG_OPEN) { result = new hcp_analysis_result[obj_batch_count]{}; - m_human_car_parsing.process(batch_hcp, obj_batch_count, result); + m_human_car_parsing.process(vec_hcp_img.data(), obj_batch_count, result); } if (hcf_recg_cf == SY_CONFIG_OPEN) { result_f = new human_fea_result[obj_batch_count]{}; - m_human_fea.process(batch_hcp, obj_batch_count, result_f); + m_human_fea.process(vec_hcp_img.data(), obj_batch_count, result_f); } int resIndex = 0; @@ -1018,7 +1034,7 @@ bool snapshot_helper::vehicle_color_analysis() int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count; - sy_img batch_vehicle[cur_batchsize]; + vector< sy_img> vec_vehicle_img; for (int i = 0; i < /*OBJ_BATCH_COUNT_VEHICLE/ OBJ_SCALE*/cur_batchsize; i++) { @@ -1044,11 +1060,13 @@ bool snapshot_helper::vehicle_color_analysis() return false; } - batch_vehicle[i].set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + sy_img batch_vehicle; + batch_vehicle.set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + vec_vehicle_img.push_back(batch_vehicle); } vc_result *vcresult = new vc_result[cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/]{}; - m_vehicle_color.process(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vcresult); + m_vehicle_color.process(vec_vehicle_img.data(), cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vcresult); for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++) { @@ -1100,7 +1118,7 @@ bool snapshot_helper::vehicle_plate_dr_analysis() int start_idx = cur_iter_count * index; int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count; - sy_img batch_vehicle[cur_batchsize]; + vector< sy_img> vec_vehicle_img; for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++) { OBJ_KEY cur_obj_key = count_vehicle_v[i+ start_idx]; @@ -1125,10 +1143,13 @@ bool snapshot_helper::vehicle_plate_dr_analysis() return false; } - batch_vehicle[i].set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + + sy_img batch_vehicle; + batch_vehicle.set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + vec_vehicle_img.push_back(batch_vehicle); } vehicle_plate_result *vp_result = new vehicle_plate_result[cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/]{}; - m_vehicle_plate.process(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vp_result); + m_vehicle_plate.process(vec_vehicle_img.data(), cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vp_result); int resIndex = 0; for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++) @@ -1141,7 +1162,7 @@ bool snapshot_helper::vehicle_plate_dr_analysis() { vehicle_result &curRes = vehicle_result_v[i + start_idx]; - memcpy(&curRes.vp_res, &vp_result[resIndex], sizeof(vehicle_plate_result)); + memcpy(&curRes.vp_res, &vp_result[resIndex], sizeof(vplate_result)); resIndex++; } } @@ -1337,7 +1358,7 @@ bool snapshot_helper::vehicle_recg_analysis() { int cur_batchsize = index == 0 ? cur_iter_count : OBJ_BATCH_COUNT_VEHICLE - cur_iter_count; - sy_img batch_vehicle[cur_batchsize]; + vector vec_vehicle_img; for (int i = 0; i < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; i++) { OBJ_KEY cur_obj_key = count_vehicle_v[i]; @@ -1361,7 +1382,10 @@ bool snapshot_helper::vehicle_recg_analysis() erase_snapshotImage(cur_obj_key); return false; } - batch_vehicle[i].set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + + sy_img batch_vehicle; + batch_vehicle.set_data(VEHICLE_WIDTH, VEHICLE_HEIGHT, IMG_CHANNELS, (unsigned char*)snapShotInfo[cur_obj_key].snapShotLittle.frame); + vec_vehicle_img.push_back(batch_vehicle); } @@ -1382,7 +1406,7 @@ bool snapshot_helper::vehicle_recg_analysis() vhd_res[b].vpd_res = new vpd_info[OBJ_MAX_COUNT]; } - m_vehicle_feature.process_vpd(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vhd_res); + m_vehicle_feature.process_vpd(vec_vehicle_img.data(), cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, vhd_res); for (int vc_idx = 0; vc_idx < cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/; vc_idx++) { @@ -1544,7 +1568,7 @@ bool snapshot_helper::vehicle_recg_analysis() memset(fea[i], 0, sizeof(int8) * FEATURESIZE); } - m_vehicle_feature.process_vf(batch_vehicle, cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, fea); + m_vehicle_feature.process_vf(vec_vehicle_img.data(), cur_batchsize/*OBJ_BATCH_COUNT_VEHICLE / OBJ_SCALE*/, fea); int resIndex = 0; @@ -1803,7 +1827,6 @@ void snapshot_helper:: snapshot_imagewrite_thread_process() std::this_thread::sleep_for(std::chrono::milliseconds(10)); } } - return ; } void snapshot_helper::snapshot_thread_process() @@ -2101,8 +2124,8 @@ CropInfo snapshot_helper::cacheSnapShotInfo(OBJ_KEY newObj, VPT_ObjInfo obj, sy_ //--------------------- 保存快照抠图 -----------------------------/ int vLeft = max(0, obj.left - boundary); int vTop = max(0, obj.top - boundary); - int vRight = min({ frameWidth - 1, obj.right + boundary }); - int vBottom = min({ frameHeight - 1, obj.bottom + boundary }); + int vRight = min(frameWidth - 1, obj.right + boundary ); + int vBottom = min(frameHeight - 1, obj.bottom + boundary); if (bCacheLittle) { int cur_width = 0; diff --git a/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.h b/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.h index d0c4904..fa4f874 100644 --- a/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.h +++ b/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.h @@ -1,6 +1,6 @@ #include -#include "../../FFNvDecoder/DxDecoderWrap.h" -#include "common.h" +#include "../../SfxDecoder/DxDecoderWrap.h" +#include "../common.h" #include #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "ImageSaveCache.h" +#include "../ImageSaveCache.h" #include "HumanCarParsing.h" #include "HumanParsing.h" #include "HumanFea.h"