Commit 881ac79d6dbfbeb00569cab01b06110b745938e8
1 parent
3ca1c1d4
代码调通,结果正常输出
Showing
25 changed files
with
183 additions
and
1347 deletions
.vscode/launch.json
0 → 100644
1 | +{ | ||
2 | + "version": "0.2.0", | ||
3 | + "configurations": [ | ||
4 | + { | ||
5 | + "name": "test", | ||
6 | + "type": "cppdbg", | ||
7 | + "request": "launch", | ||
8 | + "program": "${workspaceFolder}/bin/mvpt_dq_demo", | ||
9 | + "args": [ | ||
10 | + "/mnt/data/cmhu/data/Street.uvf" | ||
11 | + ], | ||
12 | + "stopAtEntry": false, | ||
13 | + "cwd": "${workspaceFolder}/bin", | ||
14 | + "environment": [], | ||
15 | + "externalConsole": false, | ||
16 | + "MIMode": "gdb", | ||
17 | + "setupCommands": [ | ||
18 | + { | ||
19 | + "description": "Enable pretty-printing for gdb", | ||
20 | + "text": "-enable-pretty-printing", | ||
21 | + "ignoreFailures": true | ||
22 | + } | ||
23 | + ] | ||
24 | + } | ||
25 | + ] | ||
26 | + } | ||
0 | \ No newline at end of file | 27 | \ No newline at end of file |
.vscode/settings.json
0 → 100644
build/demo/Makefile
1 | XX = g++ | 1 | XX = g++ |
2 | 2 | ||
3 | 3 | ||
4 | -PROJECT_ROOT= /home/cmhu/vpt_ascend_arm | 4 | +PROJECT_ROOT= /home/cmhu/mvpt_dq_ascend_arm |
5 | 5 | ||
6 | DEPEND_DIR = $(PROJECT_ROOT)/bin | 6 | DEPEND_DIR = $(PROJECT_ROOT)/bin |
7 | SRC_ROOT = $(PROJECT_ROOT)/src | 7 | SRC_ROOT = $(PROJECT_ROOT)/src |
8 | 8 | ||
9 | -TARGET= $(PROJECT_ROOT)/bin/vpt_proj | 9 | +TARGET= $(PROJECT_ROOT)/bin/mvpt_dq_demo |
10 | 10 | ||
11 | THIRDPARTY_ROOT = $(PROJECT_ROOT)/3rdparty | 11 | THIRDPARTY_ROOT = $(PROJECT_ROOT)/3rdparty |
12 | SPDLOG_ROOT = $(THIRDPARTY_ROOT)/spdlog-1.9.2/release | 12 | SPDLOG_ROOT = $(THIRDPARTY_ROOT)/spdlog-1.9.2/release |
@@ -25,7 +25,7 @@ include_dir=-I/usr/local/Ascend/ascend-toolkit/latest/aarch64-linux/include \ | @@ -25,7 +25,7 @@ include_dir=-I/usr/local/Ascend/ascend-toolkit/latest/aarch64-linux/include \ | ||
25 | -I $(FFMPEG_ROOT)/include \ | 25 | -I $(FFMPEG_ROOT)/include \ |
26 | 26 | ||
27 | 27 | ||
28 | -LIBS= -L $(DEPEND_DIR) -lvpt_det_vdec -lsycheck -lface_det_vdec -lhs_tri_process -lhs_truck_process -lhs_motor_process -lphone_motor_det -lhcp_vdec -lmotor_rainshed_vdec -ltraffic_light_vdec -lvehicle_pose_vdec -lroad_seg_vdec -lroad_3clsseg_vdec -latlaslic -lvpt_ascend\ | 28 | +LIBS= -L $(DEPEND_DIR) -lmvpt_dq_ascend_arm -latlaslic -lsycheck -lhp -lhuman_reid -lvcolor -lvpr_det -lvpd_process -lvpt_det_vdec \ |
29 | -L $(OPENCV_ROOT)/lib -lopencv_world\ | 29 | -L $(OPENCV_ROOT)/lib -lopencv_world\ |
30 | -L $(JSON_ROOT)/lib -ljsoncpp \ | 30 | -L $(JSON_ROOT)/lib -ljsoncpp \ |
31 | -L $(RABBITMQ_CLIENT_ROOT)/lib/aarch64-linux-gnu -lrabbitmq \ | 31 | -L $(RABBITMQ_CLIENT_ROOT)/lib/aarch64-linux-gnu -lrabbitmq \ |
build/src/Makefile
@@ -19,8 +19,7 @@ BOOST_ROOT = $(THIRDPARTY_ROOT)/boost_1_81_0/release | @@ -19,8 +19,7 @@ BOOST_ROOT = $(THIRDPARTY_ROOT)/boost_1_81_0/release | ||
19 | 19 | ||
20 | JRTP_ROOT = $(THIRDPARTY_ROOT)/gb28181_3rd/jrtp_export | 20 | JRTP_ROOT = $(THIRDPARTY_ROOT)/gb28181_3rd/jrtp_export |
21 | 21 | ||
22 | -DEFS = -DENABLE_DVPP_INTERFACE -DWITH_FACE_DET_SS -DPOST_USE_RABBITMQ -DUSE_VILLAGE | ||
23 | -# DEFS = -DENABLE_DVPP_INTERFACE -DUSE_VILLAGE | 22 | +DEFS = -DENABLE_DVPP_INTERFACE |
24 | 23 | ||
25 | include_dir=-I/usr/local/Ascend/ascend-toolkit/latest/include \ | 24 | include_dir=-I/usr/local/Ascend/ascend-toolkit/latest/include \ |
26 | -I $(SRC_ROOT)/common \ | 25 | -I $(SRC_ROOT)/common \ |
@@ -35,7 +34,7 @@ include_dir=-I/usr/local/Ascend/ascend-toolkit/latest/include \ | @@ -35,7 +34,7 @@ include_dir=-I/usr/local/Ascend/ascend-toolkit/latest/include \ | ||
35 | 34 | ||
36 | 35 | ||
37 | LIBS= -L $(SPDLOG_ROOT)/lib -l:libspdlog.a \ | 36 | LIBS= -L $(SPDLOG_ROOT)/lib -l:libspdlog.a \ |
38 | - -L $(DEPEND_DIR) -lvpt_det_vdec -lsycheck \ | 37 | + -L $(DEPEND_DIR) -lvpt_det_vdec -latlaslic -lsycheck -lhp -lhuman_reid -lvcolor -lvpr_det -lvpd_process \ |
39 | -L $(OPENCV_ROOT)/lib -lopencv_world\ | 38 | -L $(OPENCV_ROOT)/lib -lopencv_world\ |
40 | -L $(JSON_ROOT)/lib -l:libjsoncpp.a \ | 39 | -L $(JSON_ROOT)/lib -l:libjsoncpp.a \ |
41 | -L $(FFMPEG_ROOT)/lib -l:libavformat.a -l:libavcodec.a -l:libswscale.a -l:libavutil.a -l:libavfilter.a -l:libswresample.a -l:libavdevice.a -l:libx264.a\ | 40 | -L $(FFMPEG_ROOT)/lib -l:libavformat.a -l:libavcodec.a -l:libswscale.a -l:libavutil.a -l:libavfilter.a -l:libswresample.a -l:libavdevice.a -l:libx264.a\ |
src/ai_engine_module/HumanFeature.cpp
@@ -37,6 +37,7 @@ int HumanFeature::init(int dev_id, string model_dir){ | @@ -37,6 +37,7 @@ int HumanFeature::init(int dev_id, string model_dir){ | ||
37 | } | 37 | } |
38 | 38 | ||
39 | vector<HFResult> HumanFeature::process(vector<DeviceMemory*> vec_gpuMem) { | 39 | vector<HFResult> HumanFeature::process(vector<DeviceMemory*> vec_gpuMem) { |
40 | + | ||
40 | int batchsize = vec_gpuMem.size(); | 41 | int batchsize = vec_gpuMem.size(); |
41 | 42 | ||
42 | vector<sy_img> batch_img; | 43 | vector<sy_img> batch_img; |
@@ -60,6 +61,8 @@ vector<HFResult> HumanFeature::process(vector<DeviceMemory*> vec_gpuMem) { | @@ -60,6 +61,8 @@ vector<HFResult> HumanFeature::process(vector<DeviceMemory*> vec_gpuMem) { | ||
60 | int ret = SY_SUCCESS; | 61 | int ret = SY_SUCCESS; |
61 | do | 62 | do |
62 | { | 63 | { |
64 | + ret = aclrtSetCurrentContext(m_algorthim_ctx); | ||
65 | + | ||
63 | ret = humanreid_batch(m_handle, batch_img.data(), batchsize, feature); | 66 | ret = humanreid_batch(m_handle, batch_img.data(), batchsize, feature); |
64 | if (SY_SUCCESS != ret) { | 67 | if (SY_SUCCESS != ret) { |
65 | printf("humanFeature process failed!"); | 68 | printf("humanFeature process failed!"); |
@@ -95,5 +98,6 @@ void HumanFeature::release(){ | @@ -95,5 +98,6 @@ void HumanFeature::release(){ | ||
95 | } | 98 | } |
96 | if(m_algorthim_ctx){ | 99 | if(m_algorthim_ctx){ |
97 | aclrtDestroyContext(m_algorthim_ctx); | 100 | aclrtDestroyContext(m_algorthim_ctx); |
101 | + m_algorthim_ctx = nullptr; | ||
98 | } | 102 | } |
99 | } | 103 | } |
100 | \ No newline at end of file | 104 | \ No newline at end of file |
src/ai_engine_module/HumanParsing.cpp
@@ -46,15 +46,16 @@ vector<hp_analysis_res> HumanParsing::process(vector<DeviceMemory*> vec_gpuMem) | @@ -46,15 +46,16 @@ vector<hp_analysis_res> HumanParsing::process(vector<DeviceMemory*> vec_gpuMem) | ||
46 | 46 | ||
47 | sy_img img; | 47 | sy_img img; |
48 | img.w_ = mem->getWidth(); | 48 | img.w_ = mem->getWidth(); |
49 | - img.h_ = mem->getHeight(); | ||
50 | - img.c_ = mem->getChannel(); | 49 | + img.h_ = mem->getHeight(); |
51 | img.data_ = mem->getMem(); | 50 | img.data_ = mem->getMem(); |
52 | batch_img.push_back(img); | 51 | batch_img.push_back(img); |
53 | } | 52 | } |
54 | 53 | ||
54 | + int ret = aclrtSetCurrentContext(m_algorthim_ctx); | ||
55 | + | ||
55 | vector<hp_analysis_res> vec_result; | 56 | vector<hp_analysis_res> vec_result; |
56 | vec_result.resize(batchsize); | 57 | vec_result.resize(batchsize); |
57 | - int ret = hp_batch(m_handle, batch_img.data(), batchsize, vec_result.data()); | 58 | + ret = hp_batch(m_handle, batch_img.data(), batchsize, vec_result.data()); |
58 | if (SY_SUCCESS != ret) { | 59 | if (SY_SUCCESS != ret) { |
59 | printf("HumanCarParse process failed!"); | 60 | printf("HumanCarParse process failed!"); |
60 | return vec_result; | 61 | return vec_result; |
@@ -70,5 +71,6 @@ void HumanParsing::release(){ | @@ -70,5 +71,6 @@ void HumanParsing::release(){ | ||
70 | } | 71 | } |
71 | if(m_algorthim_ctx){ | 72 | if(m_algorthim_ctx){ |
72 | aclrtDestroyContext(m_algorthim_ctx); | 73 | aclrtDestroyContext(m_algorthim_ctx); |
74 | + m_algorthim_ctx = nullptr; | ||
73 | } | 75 | } |
74 | } | 76 | } |
75 | \ No newline at end of file | 77 | \ No newline at end of file |
src/ai_engine_module/VPDProcess.cpp
@@ -38,7 +38,9 @@ int VPDProcess::init(int dev_id, string model_dir){ | @@ -38,7 +38,9 @@ int VPDProcess::init(int dev_id, string model_dir){ | ||
38 | return 0; | 38 | return 0; |
39 | } | 39 | } |
40 | 40 | ||
41 | -vector<VPDResult> VPDProcess::process(vector<DeviceMemory*> vec_gpuMem) { | 41 | +vector<VPDResult> VPDProcess::process(vector<DeviceMemory*> vec_gpuMem) |
42 | +{ | ||
43 | + int ret = aclrtSetCurrentContext(m_algorthim_ctx); | ||
42 | 44 | ||
43 | vector<VPDResult> vec_res; | 45 | vector<VPDResult> vec_res; |
44 | 46 | ||
@@ -61,7 +63,7 @@ vector<VPDResult> VPDProcess::process(vector<DeviceMemory*> vec_gpuMem) { | @@ -61,7 +63,7 @@ vector<VPDResult> VPDProcess::process(vector<DeviceMemory*> vec_gpuMem) { | ||
61 | results[b].vpd_res = new vpd_info[OBJ_MAX_COUNT]; | 63 | results[b].vpd_res = new vpd_info[OBJ_MAX_COUNT]; |
62 | } | 64 | } |
63 | 65 | ||
64 | - int ret = vpd_process(m_handle, batch_img.data(), batchsize, results); | 66 | + ret = vpd_process(m_handle, batch_img.data(), batchsize, results); |
65 | if (SY_SUCCESS != ret) { | 67 | if (SY_SUCCESS != ret) { |
66 | printf("vpd detection process failed!"); | 68 | printf("vpd detection process failed!"); |
67 | return vec_res; | 69 | return vec_res; |
@@ -102,5 +104,6 @@ void VPDProcess::release(){ | @@ -102,5 +104,6 @@ void VPDProcess::release(){ | ||
102 | } | 104 | } |
103 | if(m_algorthim_ctx){ | 105 | if(m_algorthim_ctx){ |
104 | aclrtDestroyContext(m_algorthim_ctx); | 106 | aclrtDestroyContext(m_algorthim_ctx); |
107 | + m_algorthim_ctx = nullptr; | ||
105 | } | 108 | } |
106 | } | 109 | } |
107 | \ No newline at end of file | 110 | \ No newline at end of file |
src/ai_engine_module/VPTProcess.cpp
@@ -196,6 +196,7 @@ void VPTProcess::release(){ | @@ -196,6 +196,7 @@ void VPTProcess::release(){ | ||
196 | } | 196 | } |
197 | if(m_algorthim_ctx){ | 197 | if(m_algorthim_ctx){ |
198 | aclrtDestroyContext(m_algorthim_ctx); | 198 | aclrtDestroyContext(m_algorthim_ctx); |
199 | + m_algorthim_ctx = nullptr; | ||
199 | } | 200 | } |
200 | } | 201 | } |
201 | 202 |
src/ai_engine_module/VehicleColor.cpp
@@ -38,6 +38,8 @@ int VehicleColor::init(int dev_id, string model_dir){ | @@ -38,6 +38,8 @@ int VehicleColor::init(int dev_id, string model_dir){ | ||
38 | } | 38 | } |
39 | 39 | ||
40 | vector<VehicleColorResult> VehicleColor::process(vector<DeviceMemory*> vec_gpuMem) { | 40 | vector<VehicleColorResult> VehicleColor::process(vector<DeviceMemory*> vec_gpuMem) { |
41 | + | ||
42 | + int ret = aclrtSetCurrentContext(m_algorthim_ctx); | ||
41 | 43 | ||
42 | int batchsize = vec_gpuMem.size(); | 44 | int batchsize = vec_gpuMem.size(); |
43 | 45 | ||
@@ -47,8 +49,7 @@ vector<VehicleColorResult> VehicleColor::process(vector<DeviceMemory*> vec_gpuMe | @@ -47,8 +49,7 @@ vector<VehicleColorResult> VehicleColor::process(vector<DeviceMemory*> vec_gpuMe | ||
47 | 49 | ||
48 | sy_img img; | 50 | sy_img img; |
49 | img.w_ = mem->getWidth(); | 51 | img.w_ = mem->getWidth(); |
50 | - img.h_ = mem->getHeight(); | ||
51 | - img.c_ = mem->getChannel(); | 52 | + img.h_ = mem->getHeight(); |
52 | img.data_ = mem->getMem(); | 53 | img.data_ = mem->getMem(); |
53 | batch_img.push_back(img); | 54 | batch_img.push_back(img); |
54 | } | 55 | } |
@@ -58,7 +59,7 @@ vector<VehicleColorResult> VehicleColor::process(vector<DeviceMemory*> vec_gpuMe | @@ -58,7 +59,7 @@ vector<VehicleColorResult> VehicleColor::process(vector<DeviceMemory*> vec_gpuMe | ||
58 | vector<vc_result> vec_result; | 59 | vector<vc_result> vec_result; |
59 | vec_result.resize(batchsize); | 60 | vec_result.resize(batchsize); |
60 | 61 | ||
61 | - int ret = vc_batch(m_handle, batch_img.data(), batchsize, vec_result.data()); | 62 | + ret = vc_batch(m_handle, batch_img.data(), batchsize, vec_result.data()); |
62 | if (SY_SUCCESS != ret) { | 63 | if (SY_SUCCESS != ret) { |
63 | printf("vehicleColorClassification process failed!"); | 64 | printf("vehicleColorClassification process failed!"); |
64 | return vec_vc_res; | 65 | return vec_vc_res; |
@@ -81,5 +82,6 @@ void VehicleColor::release(){ | @@ -81,5 +82,6 @@ void VehicleColor::release(){ | ||
81 | } | 82 | } |
82 | if(m_algorthim_ctx){ | 83 | if(m_algorthim_ctx){ |
83 | aclrtDestroyContext(m_algorthim_ctx); | 84 | aclrtDestroyContext(m_algorthim_ctx); |
85 | + m_algorthim_ctx = nullptr; | ||
84 | } | 86 | } |
85 | } | 87 | } |
86 | \ No newline at end of file | 88 | \ No newline at end of file |
src/ai_engine_module/VehiclePlate.cpp
@@ -47,8 +47,10 @@ int VehiclePlate::init(int dev_id, string model_dir){ | @@ -47,8 +47,10 @@ int VehiclePlate::init(int dev_id, string model_dir){ | ||
47 | return 0; | 47 | return 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | -vector<VehiclePlateResult> VehiclePlate::process(vector<DeviceMemory*> vec_gpuMem) { | ||
51 | - // 每个 DeviceMemory 只包含一辆车 | 50 | +vector<VehiclePlateResult> VehiclePlate::process(vector<DeviceMemory*> vec_gpuMem) |
51 | +{ // 每个 DeviceMemory 只包含一辆车 | ||
52 | + | ||
53 | + int ret = aclrtSetCurrentContext(m_algorthim_ctx); | ||
52 | 54 | ||
53 | vector<VehiclePlateResult> vec_res; | 55 | vector<VehiclePlateResult> vec_res; |
54 | 56 | ||
@@ -68,7 +70,7 @@ vector<VehiclePlateResult> VehiclePlate::process(vector<DeviceMemory*> vec_gpuMe | @@ -68,7 +70,7 @@ vector<VehiclePlateResult> VehiclePlate::process(vector<DeviceMemory*> vec_gpuMe | ||
68 | 70 | ||
69 | vector<vplates_result> vec_result; | 71 | vector<vplates_result> vec_result; |
70 | vec_result.resize(batchsize); | 72 | vec_result.resize(batchsize); |
71 | - int ret = vpdr_batch(m_handle, batch_img.data(), batchsize, vec_result.data()); | 73 | + ret = vpdr_batch(m_handle, batch_img.data(), batchsize, vec_result.data()); |
72 | if (SY_SUCCESS != ret) { | 74 | if (SY_SUCCESS != ret) { |
73 | printf("vpr detection process failed!"); | 75 | printf("vpr detection process failed!"); |
74 | return vec_res; | 76 | return vec_res; |
@@ -101,5 +103,6 @@ void VehiclePlate::release(){ | @@ -101,5 +103,6 @@ void VehiclePlate::release(){ | ||
101 | } | 103 | } |
102 | if(m_algorthim_ctx){ | 104 | if(m_algorthim_ctx){ |
103 | aclrtDestroyContext(m_algorthim_ctx); | 105 | aclrtDestroyContext(m_algorthim_ctx); |
106 | + m_algorthim_ctx = nullptr; | ||
104 | } | 107 | } |
105 | } | 108 | } |
106 | \ No newline at end of file | 109 | \ No newline at end of file |
src/ai_platform/FeatureAnalysis.h
@@ -34,5 +34,6 @@ private: | @@ -34,5 +34,6 @@ private: | ||
34 | VehicleColor m_vehicle_color; | 34 | VehicleColor m_vehicle_color; |
35 | VehiclePlate m_vehicle_plate; | 35 | VehiclePlate m_vehicle_plate; |
36 | VPDProcess m_vpd; | 36 | VPDProcess m_vpd; |
37 | + | ||
37 | int m_dev_id{0}; | 38 | int m_dev_id{0}; |
38 | }; | 39 | }; |
39 | \ No newline at end of file | 40 | \ No newline at end of file |
src/ai_platform/header.h
@@ -122,9 +122,8 @@ typedef struct ObjectData { | @@ -122,9 +122,8 @@ typedef struct ObjectData { | ||
122 | #define __TASK_PARAM__ | 122 | #define __TASK_PARAM__ |
123 | 123 | ||
124 | typedef struct task_param { | 124 | typedef struct task_param { |
125 | - const char *ipc_url; //rtsp流地址 | ||
126 | - const char *task_id; //外部传入任务id | ||
127 | - int dec_type; | 125 | + string ipc_url; //rtsp流地址 |
126 | + string task_id; //外部传入任务id | ||
128 | int skip_frame{0}; | 127 | int skip_frame{0}; |
129 | 128 | ||
130 | string result_folder_little; //目标快照抠图保存地址 | 129 | string result_folder_little; //目标快照抠图保存地址 |
src/ai_platform/mvpt.cpp
@@ -100,8 +100,6 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ | @@ -100,8 +100,6 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ | ||
100 | vparam.threshold = 0.4; | 100 | vparam.threshold = 0.4; |
101 | vparam.model_dir = models_dir; | 101 | vparam.model_dir = models_dir; |
102 | 102 | ||
103 | - aclrtSetDevice(m_devId); | ||
104 | - | ||
105 | int ret = vpt_process.init(vparam); | 103 | int ret = vpt_process.init(vparam); |
106 | if (ret < 0){ | 104 | if (ret < 0){ |
107 | return ret; | 105 | return ret; |
@@ -156,7 +154,7 @@ int CMultiSourceProcess::GetTaskStatus(const string taskID) { | @@ -156,7 +154,7 @@ int CMultiSourceProcess::GetTaskStatus(const string taskID) { | ||
156 | 154 | ||
157 | bool CMultiSourceProcess::AddTask(task_param _cur_task_param) | 155 | bool CMultiSourceProcess::AddTask(task_param _cur_task_param) |
158 | { | 156 | { |
159 | - const char* task_id = _cur_task_param.task_id; | 157 | + string task_id = _cur_task_param.task_id; |
160 | 158 | ||
161 | decode_cbk_userdata* userPtr = new decode_cbk_userdata; | 159 | decode_cbk_userdata* userPtr = new decode_cbk_userdata; |
162 | userPtr->task_id = task_id; | 160 | userPtr->task_id = task_id; |
@@ -394,10 +392,6 @@ bool CMultiSourceProcess::finish_task(const string taskID, const bool delete_sna | @@ -394,10 +392,6 @@ bool CMultiSourceProcess::finish_task(const string taskID, const bool delete_sna | ||
394 | int CMultiSourceProcess::algorthim_process_thread(){ | 392 | int CMultiSourceProcess::algorthim_process_thread(){ |
395 | LOG_INFO("algorthim_process_thread start..."); | 393 | LOG_INFO("algorthim_process_thread start..."); |
396 | 394 | ||
397 | - ACL_CALL(aclrtSetDevice(m_devId), ACL_SUCCESS, 1); | ||
398 | - aclrtContext ctx; | ||
399 | - ACL_CALL(aclrtCreateContext(&ctx, m_devId), ACL_SUCCESS, 1); | ||
400 | - | ||
401 | while (true){ | 395 | while (true){ |
402 | #ifndef AUTHORIZATION | 396 | #ifndef AUTHORIZATION |
403 | if (!CheckTime()) { //时间限制 | 397 | if (!CheckTime()) { //时间限制 |
@@ -443,7 +437,6 @@ int CMultiSourceProcess::algorthim_process_thread(){ | @@ -443,7 +437,6 @@ int CMultiSourceProcess::algorthim_process_thread(){ | ||
443 | continue; | 437 | continue; |
444 | } | 438 | } |
445 | 439 | ||
446 | - aclrtSetCurrentContext(ctx); | ||
447 | // auto record_t1 = std::chrono::system_clock::now(); | 440 | // auto record_t1 = std::chrono::system_clock::now(); |
448 | auto vptprocess1 = std::chrono::system_clock::now(); | 441 | auto vptprocess1 = std::chrono::system_clock::now(); |
449 | algorthim_vpt(vec_gpuMem); | 442 | algorthim_vpt(vec_gpuMem); |
@@ -466,8 +459,6 @@ int CMultiSourceProcess::algorthim_process_thread(){ | @@ -466,8 +459,6 @@ int CMultiSourceProcess::algorthim_process_thread(){ | ||
466 | vector<DeviceMemory*>().swap(vec_gpuMem); // free. | 459 | vector<DeviceMemory*>().swap(vec_gpuMem); // free. |
467 | } | 460 | } |
468 | 461 | ||
469 | - aclrtDestroyContext(ctx); | ||
470 | - aclrtResetDevice(m_devId); | ||
471 | LOG_INFO("algorthim_process_thread exit."); | 462 | LOG_INFO("algorthim_process_thread exit."); |
472 | 463 | ||
473 | return 0; | 464 | return 0; |
@@ -537,7 +528,7 @@ void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { | @@ -537,7 +528,7 @@ void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { | ||
537 | 528 | ||
538 | auto it = _total_snapshot_info.find(obj_key); | 529 | auto it = _total_snapshot_info.find(obj_key); |
539 | if (it == _total_snapshot_info.end()) { | 530 | if (it == _total_snapshot_info.end()) { |
540 | - LOG_WARN("object not found: {}, {}", obj_key.video_id, obj_key.obj_id); | 531 | + // LOG_WARN("object not found: {}, {}", obj_key.video_id, obj_key.obj_id); |
541 | return; | 532 | return; |
542 | } | 533 | } |
543 | 534 | ||
@@ -548,6 +539,20 @@ void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { | @@ -548,6 +539,20 @@ void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { | ||
548 | string result_folder = info->result_folder + "/snapshot";//todo | 539 | string result_folder = info->result_folder + "/snapshot";//todo |
549 | string result_folder_little = info->result_folder_little + "/snapshot_lite"; | 540 | string result_folder_little = info->result_folder_little + "/snapshot_lite"; |
550 | 541 | ||
542 | + if (!result_folder.empty()) { | ||
543 | + CreateResultFolder(result_folder.c_str(), ""); | ||
544 | + } else { | ||
545 | + LOG_ERROR("result_folder is empty!"); | ||
546 | + } | ||
547 | + | ||
548 | + if (!result_folder_little.empty()) { | ||
549 | + CreateResultFolder(result_folder_little.c_str(), ""); | ||
550 | + } else { | ||
551 | + LOG_ERROR("result_folder_little is empty!"); | ||
552 | + } | ||
553 | + | ||
554 | + LOG_DEBUG("update task_id {} obj_id {}", obj_key.video_id, obj_key.obj_id); | ||
555 | + | ||
551 | std::string cur_timestamp_ms = std::to_string(helpers::timer::get_cur_time_ms()); | 556 | std::string cur_timestamp_ms = std::to_string(helpers::timer::get_cur_time_ms()); |
552 | // 原图 | 557 | // 原图 |
553 | std::string ori_pic_path = result_folder + helpers::os::sep + obj_key.video_id + "_" + std::to_string(obj_key.obj_id) + "_" + cur_timestamp_ms + ".jpg"; | 558 | std::string ori_pic_path = result_folder + helpers::os::sep + obj_key.video_id + "_" + std::to_string(obj_key.obj_id) + "_" + cur_timestamp_ms + ".jpg"; |
@@ -575,10 +580,7 @@ void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { | @@ -575,10 +580,7 @@ void CMultiSourceProcess::vehicle_locus_finished(const OBJ_KEY obj_key) { | ||
575 | { | 580 | { |
576 | // todo 回调函数抛出结果给上层 | 581 | // todo 回调函数抛出结果给上层 |
577 | } | 582 | } |
578 | - | ||
579 | - | ||
580 | - LOG_DEBUG("仅删除记录,显存会在保存线程中删除"); | ||
581 | - // 仅删除记录,显存会在保存线程中删除 | 583 | + |
582 | m_snapshot_reprocessing->release_finished_locus_snapshot(obj_key.video_id, obj_key.obj_id, true); | 584 | m_snapshot_reprocessing->release_finished_locus_snapshot(obj_key.video_id, obj_key.obj_id, true); |
583 | 585 | ||
584 | } | 586 | } |
@@ -607,9 +609,6 @@ bool CMultiSourceProcess::save_obj_pic(ObjectInfo& res_obj) | @@ -607,9 +609,6 @@ bool CMultiSourceProcess::save_obj_pic(ObjectInfo& res_obj) | ||
607 | } | 609 | } |
608 | } while (0); | 610 | } while (0); |
609 | 611 | ||
610 | - VPCUtil::vpc_img_release(res_obj.ori_img_info); | ||
611 | - VPCUtil::vpc_img_release(res_obj.obj_img_info); | ||
612 | - | ||
613 | return bSaved; | 612 | return bSaved; |
614 | } | 613 | } |
615 | 614 | ||
@@ -622,7 +621,7 @@ bool CMultiSourceProcess::CheckTime() { | @@ -622,7 +621,7 @@ bool CMultiSourceProcess::CheckTime() { | ||
622 | nYear = info->tm_year + 1900; | 621 | nYear = info->tm_year + 1900; |
623 | nMonth = info->tm_mon + 1; | 622 | nMonth = info->tm_mon + 1; |
624 | nDay = info->tm_mday; | 623 | nDay = info->tm_mday; |
625 | - if (nYear == 2024 && nMonth <= 12) | 624 | + if (nYear == 2025 && nMonth <= 12) |
626 | { | 625 | { |
627 | return true; | 626 | return true; |
628 | } | 627 | } |
src/ai_platform/mvpt_process_assist.cpp
@@ -162,7 +162,7 @@ int CreateDir(char *pszDir) | @@ -162,7 +162,7 @@ int CreateDir(char *pszDir) | ||
162 | } | 162 | } |
163 | 163 | ||
164 | 164 | ||
165 | -void CreateResultFolder(char* resultFolder, const char* jointFolder) | 165 | +void CreateResultFolder(const char* resultFolder, const char* jointFolder) |
166 | { | 166 | { |
167 | if (strlen(resultFolder) > 240) //?too long | 167 | if (strlen(resultFolder) > 240) //?too long |
168 | { | 168 | { |
src/ai_platform/mvpt_process_assist.h
@@ -24,7 +24,7 @@ using namespace std; | @@ -24,7 +24,7 @@ using namespace std; | ||
24 | 24 | ||
25 | 25 | ||
26 | int CreateDir(char *pszDir); | 26 | int CreateDir(char *pszDir); |
27 | -void CreateResultFolder(char* resultFolder, const char* jointFolder); | 27 | +void CreateResultFolder(const char* resultFolder, const char* jointFolder); |
28 | //bool sy_legal_pos(bitset<EDGESIZE> flags, int left, int top, int right, int bottom, int imgHeight, int imgWidth); | 28 | //bool sy_legal_pos(bitset<EDGESIZE> flags, int left, int top, int right, int bottom, int imgHeight, int imgWidth); |
29 | bool LegalArea(int maxArea, int lastArea, int left, int top, int right, int bottom); | 29 | bool LegalArea(int maxArea, int lastArea, int left, int top, int right, int bottom); |
30 | bool LegalMinArea(int width, int height, sy_rect min_box); | 30 | bool LegalMinArea(int width, int height, sy_rect min_box); |
src/ai_platform/task_manager.cpp
@@ -15,7 +15,7 @@ task_manager::task_manager(/* args */) | @@ -15,7 +15,7 @@ task_manager::task_manager(/* args */) | ||
15 | 15 | ||
16 | task_manager::~task_manager() | 16 | task_manager::~task_manager() |
17 | { | 17 | { |
18 | - task_info_map.clear(); | 18 | + Release(); |
19 | } | 19 | } |
20 | 20 | ||
21 | bool task_manager::AddTask(const task_param& task_param, FFDecConfig& cfg) { | 21 | bool task_manager::AddTask(const task_param& task_param, FFDecConfig& cfg) { |
@@ -106,6 +106,11 @@ bool task_manager::FinishTask(const string& task_id){ | @@ -106,6 +106,11 @@ bool task_manager::FinishTask(const string& task_id){ | ||
106 | if(it == task_info_map.end()) { | 106 | if(it == task_info_map.end()) { |
107 | return false; | 107 | return false; |
108 | } | 108 | } |
109 | + | ||
110 | + TaskInfo& info = task_info_map[task_id]; | ||
111 | + info.dec->close(); | ||
112 | + delete info.dec; | ||
113 | + info.dec = nullptr; | ||
109 | 114 | ||
110 | task_info_map.erase(task_id); | 115 | task_info_map.erase(task_id); |
111 | 116 | ||
@@ -171,6 +176,14 @@ int task_manager::GetRunningTaskCount() { | @@ -171,6 +176,14 @@ int task_manager::GetRunningTaskCount() { | ||
171 | } | 176 | } |
172 | 177 | ||
173 | void task_manager::Release() { | 178 | void task_manager::Release() { |
179 | + for (auto it = task_info_map.begin(); it != task_info_map.end(); it++) | ||
180 | + { | ||
181 | + TaskInfo& info = it->second; | ||
182 | + info.dec->close(); | ||
183 | + delete info.dec; | ||
184 | + info.dec = nullptr; | ||
185 | + } | ||
186 | + | ||
174 | task_info_map.clear(); | 187 | task_info_map.clear(); |
175 | } | 188 | } |
176 | 189 |
src/ai_platform/task_manager.h
@@ -23,15 +23,6 @@ typedef struct TaskInfo | @@ -23,15 +23,6 @@ typedef struct TaskInfo | ||
23 | string result_folder_little; //目标快照抠图保存地址 | 23 | string result_folder_little; //目标快照抠图保存地址 |
24 | string result_folder; //目标快照大图保存地址 | 24 | string result_folder; //目标快照大图保存地址 |
25 | 25 | ||
26 | - TaskInfo(){} | ||
27 | - | ||
28 | - ~TaskInfo(){ | ||
29 | - if(dec){ | ||
30 | - dec->close(); | ||
31 | - delete dec; | ||
32 | - dec = nullptr; | ||
33 | - } | ||
34 | - } | ||
35 | } TaskInfo; | 26 | } TaskInfo; |
36 | 27 | ||
37 | class task_manager | 28 | class task_manager |
src/decoder/dvpp/DvppDecoder.cpp
@@ -534,8 +534,8 @@ void DvppDecoder::read_thread() { | @@ -534,8 +534,8 @@ void DvppDecoder::read_thread() { | ||
534 | CHECK_AND_BREAK(aclvdecSetChannelDescThreadId(vdecChannelDesc, report_thread), "aclvdecSetChannelDescThreadId failed"); | 534 | CHECK_AND_BREAK(aclvdecSetChannelDescThreadId(vdecChannelDesc, report_thread), "aclvdecSetChannelDescThreadId failed"); |
535 | CHECK_AND_BREAK(aclvdecSetChannelDescCallback(vdecChannelDesc, VdecCallback), "aclvdecSetChannelDescCallback failed"); | 535 | CHECK_AND_BREAK(aclvdecSetChannelDescCallback(vdecChannelDesc, VdecCallback), "aclvdecSetChannelDescCallback failed"); |
536 | CHECK_AND_BREAK(aclvdecSetChannelDescEnType(vdecChannelDesc, m_enType), "aclvdecSetChannelDescEnType failed"); | 536 | CHECK_AND_BREAK(aclvdecSetChannelDescEnType(vdecChannelDesc, m_enType), "aclvdecSetChannelDescEnType failed"); |
537 | - // CHECK_AND_BREAK(aclvdecSetChannelDescOutPicFormat(vdecChannelDesc, PIXEL_FORMAT_YUV_SEMIPLANAR_420), "aclvdecSetChannelDescOutPicFormat failed"); | ||
538 | - CHECK_AND_BREAK(aclvdecSetChannelDescOutPicFormat(vdecChannelDesc, PIXEL_FORMAT_BGR_888), "aclvdecSetChannelDescOutPicFormat failed"); | 537 | + CHECK_AND_BREAK(aclvdecSetChannelDescOutPicFormat(vdecChannelDesc, PIXEL_FORMAT_YUV_SEMIPLANAR_420), "aclvdecSetChannelDescOutPicFormat failed"); |
538 | + // CHECK_AND_BREAK(aclvdecSetChannelDescOutPicFormat(vdecChannelDesc, PIXEL_FORMAT_BGR_888), "aclvdecSetChannelDescOutPicFormat failed"); | ||
539 | CHECK_AND_BREAK(aclvdecCreateChannel(vdecChannelDesc), "aclvdecCreateChannel failed"); | 539 | CHECK_AND_BREAK(aclvdecCreateChannel(vdecChannelDesc), "aclvdecCreateChannel failed"); |
540 | 540 | ||
541 | AVPacket* pkt = av_packet_alloc(); | 541 | AVPacket* pkt = av_packet_alloc(); |
@@ -880,7 +880,7 @@ void DvppDecoder::doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *o | @@ -880,7 +880,7 @@ void DvppDecoder::doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *o | ||
880 | mem->setFrameNb(frame_nb); | 880 | mem->setFrameNb(frame_nb); |
881 | } | 881 | } |
882 | } else { | 882 | } else { |
883 | - mem = new DvppDataMemory(width, width_stride, height, height_stride, outputSize, m_dec_name, to_string(m_dvpp_deviceId), false, frame_nb, (unsigned char *)outputDataDev, m_cfg.auto_road_parse); | 883 | + mem = new DvppDataMemory(width, width_stride, height, height_stride, outputSize, m_dec_name, to_string(m_dvpp_deviceId), false, frame_nb, (unsigned char *)outputDataDev); |
884 | } | 884 | } |
885 | 885 | ||
886 | if(mem != nullptr){ | 886 | if(mem != nullptr){ |
src/decoder/dvpp/DvppSnapshot.cpp
@@ -684,7 +684,7 @@ void DvppSnapshot::doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc * | @@ -684,7 +684,7 @@ void DvppSnapshot::doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc * | ||
684 | mem->setFrameNb(frame_nb); | 684 | mem->setFrameNb(frame_nb); |
685 | } | 685 | } |
686 | } else { | 686 | } else { |
687 | - mem = new DvppDataMemory(width, width_stride, height, height_stride, outputSize, m_dec_name, to_string(m_dvpp_deviceId), false, frame_nb, (unsigned char *)outputDataDev, m_cfg.auto_road_parse); | 687 | + mem = new DvppDataMemory(width, width_stride, height, height_stride, outputSize, m_dec_name, to_string(m_dvpp_deviceId), false, frame_nb, (unsigned char *)outputDataDev); |
688 | } | 688 | } |
689 | 689 | ||
690 | if(mem != nullptr){ | 690 | if(mem != nullptr){ |
src/decoder/dvpp/VpcUtils.cpp
@@ -539,7 +539,7 @@ vector<DvppDataMemory*> VpcUtils::crop_batch(DvppDataMemory* devMem, const vecto | @@ -539,7 +539,7 @@ vector<DvppDataMemory*> VpcUtils::crop_batch(DvppDataMemory* devMem, const vecto | ||
539 | uint32_t height_stride = acldvppGetPicDescHeightStride(vpcOutputDesc); | 539 | uint32_t height_stride = acldvppGetPicDescHeightStride(vpcOutputDesc); |
540 | acldvppPixelFormat fmt = acldvppGetPicDescFormat(vpcOutputDesc); | 540 | acldvppPixelFormat fmt = acldvppGetPicDescFormat(vpcOutputDesc); |
541 | 541 | ||
542 | - DvppDataMemory* rgbMem = new DvppDataMemory(width, width_stride, height, height_stride, outputSize, devMem->getId(), devMem->getDeviceId(), false, devMem->getFrameNb(), (unsigned char *)outputDataDev, false); | 542 | + DvppDataMemory* rgbMem = new DvppDataMemory(width, width_stride, height, height_stride, outputSize, devMem->getId(), devMem->getDeviceId(), false, devMem->getFrameNb(), (unsigned char *)outputDataDev); |
543 | 543 | ||
544 | vec_img_info.push_back(rgbMem); | 544 | vec_img_info.push_back(rgbMem); |
545 | } | 545 | } |
src/decoder/interface/interface_headers.h
@@ -25,8 +25,6 @@ typedef void(*POST_DECODE_CALLBACK)(const void * userPtr, DeviceMemory* devFrame | @@ -25,8 +25,6 @@ typedef void(*POST_DECODE_CALLBACK)(const void * userPtr, DeviceMemory* devFrame | ||
25 | 25 | ||
26 | typedef void(*DECODE_FINISHED_CALLBACK)(const void* userPtr); | 26 | typedef void(*DECODE_FINISHED_CALLBACK)(const void* userPtr); |
27 | 27 | ||
28 | -typedef bool(*DECODE_REQUEST_STREAM_CALLBACK)(const char* deviceId); | ||
29 | - | ||
30 | struct FFDecConfig{ | 28 | struct FFDecConfig{ |
31 | string uri; // 视频地址 | 29 | string uri; // 视频地址 |
32 | void * postDecArg {nullptr}; | 30 | void * postDecArg {nullptr}; |
@@ -38,10 +36,6 @@ struct FFDecConfig{ | @@ -38,10 +36,6 @@ struct FFDecConfig{ | ||
38 | int skip_frame{1}; // 跳帧数 | 36 | int skip_frame{1}; // 跳帧数 |
39 | string dec_name; | 37 | string dec_name; |
40 | bool resize{false}; // 是否resize到1920,1080 | 38 | bool resize{false}; // 是否resize到1920,1080 |
41 | - bool auto_road_parse{true} ; // 外部需要的 | ||
42 | - | ||
43 | - int port; // gb28181接收数据的端口号 | ||
44 | - DECODE_REQUEST_STREAM_CALLBACK request_stream_cbk; // gb28181请求流 | ||
45 | }; | 39 | }; |
46 | 40 | ||
47 | enum DECODER_TYPE{ | 41 | enum DECODER_TYPE{ |
src/demo/demo.cpp
@@ -8,899 +8,6 @@ | @@ -8,899 +8,6 @@ | ||
8 | 8 | ||
9 | using namespace std; | 9 | using namespace std; |
10 | 10 | ||
11 | -#ifdef POST_USE_RABBITMQ | ||
12 | - | ||
13 | -void init_mq_conn(void *handle) { | ||
14 | - for (auto key : {mq_type_t::ALARM_MQ, mq_type_t::GET_TASK_MQ, mq_type_t::HEART_BEAT_MQ, mq_type_t::SCREENSHORT_TASK_MQ, mq_type_t::TIMING_SCREENSHORT_TASK_MQ}) { | ||
15 | - rabbitmq_conn_params_t mq_conn_params; | ||
16 | - mq_conn_params.port = 5672; | ||
17 | - | ||
18 | - strcpy(mq_conn_params.ip, "192.168.60.126"); | ||
19 | - strcpy(mq_conn_params.uname, "admin"); | ||
20 | - strcpy(mq_conn_params.passwd, "123456"); | ||
21 | - strcpy(mq_conn_params.vhost, "/"); | ||
22 | - strcpy(mq_conn_params.exchange, "topExchange"); | ||
23 | - strcpy(mq_conn_params.exchange_type, "topic"); | ||
24 | - | ||
25 | - // mq_conn_params.port = 5673; | ||
26 | - // strcpy(mq_conn_params.ip, "192.168.10.187"); | ||
27 | - // strcpy(mq_conn_params.uname, "admin"); | ||
28 | - // strcpy(mq_conn_params.passwd, "admin123456"); | ||
29 | - // strcpy(mq_conn_params.vhost, "/"); | ||
30 | - // strcpy(mq_conn_params.exchange, "topExchange"); | ||
31 | - // strcpy(mq_conn_params.exchange_type, "topic"); | ||
32 | - | ||
33 | - switch (key) { | ||
34 | - case mq_type_t::ALARM_MQ: { | ||
35 | - strcpy(mq_conn_params.queue, "topic.queue.alarm"); | ||
36 | - strcpy(mq_conn_params.routing_key, "topic.queue.alarm.key"); | ||
37 | - } break; | ||
38 | - case mq_type_t::GET_TASK_MQ: { | ||
39 | - strcpy(mq_conn_params.queue, "tsl.test.queue.get"); | ||
40 | - strcpy(mq_conn_params.routing_key, "tsl.test.queue.get.key"); | ||
41 | - } break; | ||
42 | - case mq_type_t::HEART_BEAT_MQ: { | ||
43 | - strcpy(mq_conn_params.queue, "tsl.test.queue.hb"); | ||
44 | - strcpy(mq_conn_params.routing_key, "tsl.test.queue.hb.key"); | ||
45 | - } break; | ||
46 | - case mq_type_t::SCREENSHORT_TASK_MQ: { | ||
47 | - strcpy(mq_conn_params.queue, "video.screenshort.queue.get"); | ||
48 | - strcpy(mq_conn_params.routing_key, "video.screenshort.queue.key"); | ||
49 | - } break; | ||
50 | - case mq_type_t::TIMING_SCREENSHORT_TASK_MQ: { | ||
51 | - strcpy(mq_conn_params.queue, "video.timingscreenshort.queue.get"); | ||
52 | - strcpy(mq_conn_params.routing_key, "video.timingscreenshort.queue.key"); | ||
53 | - } break; | ||
54 | - } | ||
55 | - | ||
56 | - mq_conn_params.durable_exchange = true; | ||
57 | - mq_conn_params.durable_queue = true; | ||
58 | - | ||
59 | - if (0 != add_mq_conn(handle, key, mq_conn_params)) // 队列走接口创建 | ||
60 | - fprintf(stderr, "ip is %s port is %d\n", mq_conn_params.ip, mq_conn_params.port); | ||
61 | - } | ||
62 | -} | ||
63 | - | ||
64 | -#endif // #ifdef POST_USE_RABBITMQ | ||
65 | - | ||
66 | -void set_task_params(task_param &tparam, const unsigned &idx, const algorithm_type_t &algor_type) { | ||
67 | - auto algor_init_params = new algor_init_config_param_t; | ||
68 | - | ||
69 | - switch (algor_type) { | ||
70 | - | ||
71 | - case algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET: { | ||
72 | - auto algor_params = new algor_config_param_manned_incident; | ||
73 | - { | ||
74 | - algor_params->m = 10; | ||
75 | - algor_params->n = 8; | ||
76 | - algor_params->obj_confidence_threshold = 0.5f; | ||
77 | - algor_params->obj_min_height = 6; | ||
78 | - algor_params->obj_min_width = 32; | ||
79 | - } | ||
80 | - | ||
81 | - auto basic_params = new algor_basic_config_param_t; | ||
82 | - { | ||
83 | - // basic_params->algor_valid_rect.top_ = 0; | ||
84 | - // basic_params->algor_valid_rect.left_ = 0; | ||
85 | - // basic_params->algor_valid_rect.width_ = 1920; | ||
86 | - // basic_params->algor_valid_rect.height_ = 1080; | ||
87 | - basic_params->video_folder = "res/video_recode"; | ||
88 | - basic_params->result_folder = "res/motor_nohelmet"; | ||
89 | - basic_params->result_folder_little = "res/motor_nohelmet_little"; | ||
90 | - } | ||
91 | - | ||
92 | - algor_init_params->algor_param = algor_params; | ||
93 | - algor_init_params->basic_param = basic_params; | ||
94 | - } break; | ||
95 | - | ||
96 | - case algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN: { | ||
97 | - auto algor_params = new algor_config_param_manned_incident; | ||
98 | - { | ||
99 | - algor_params->m = 10; | ||
100 | - algor_params->n = 8; | ||
101 | - algor_params->hs_count_threshold = 2; | ||
102 | - algor_params->obj_confidence_threshold = 0.5f; | ||
103 | - algor_params->obj_min_height = 6; | ||
104 | - algor_params->obj_min_width = 32; | ||
105 | - } | ||
106 | - | ||
107 | - auto basic_params = new algor_basic_config_param_t; | ||
108 | - { | ||
109 | - // basic_params->algor_valid_rect.top_ = 0; | ||
110 | - // basic_params->algor_valid_rect.left_ = 0; | ||
111 | - // basic_params->algor_valid_rect.width_ = 1920; | ||
112 | - // basic_params->algor_valid_rect.height_ = 1080; | ||
113 | - basic_params->video_folder = "res/video_recode"; | ||
114 | - basic_params->result_folder = "res/motor_overman"; | ||
115 | - basic_params->result_folder_little = "res/motor_overman_little"; | ||
116 | - } | ||
117 | - | ||
118 | - algor_init_params->algor_param = algor_params; | ||
119 | - algor_init_params->basic_param = basic_params; | ||
120 | - } break; | ||
121 | - | ||
122 | - case algorithm_type_t::TRICYCLE_MANNED: { | ||
123 | - auto algor_params = new algor_config_param_manned_incident; | ||
124 | - { | ||
125 | - algor_params->m = 10; | ||
126 | - algor_params->n = 8; | ||
127 | - algor_params->hs_count_threshold = 1; | ||
128 | - algor_params->obj_confidence_threshold = 0.5f; | ||
129 | - algor_params->obj_min_height = 6; | ||
130 | - algor_params->obj_min_width = 32; | ||
131 | - } | ||
132 | - | ||
133 | - auto basic_params = new algor_basic_config_param_t; | ||
134 | - { | ||
135 | - basic_params->video_folder = "res/video_recode"; | ||
136 | - basic_params->result_folder = "res/tricycle_manned"; | ||
137 | - basic_params->result_folder_little = "res/tricycle_manned_little"; | ||
138 | - } | ||
139 | - | ||
140 | - algor_init_params->algor_param = algor_params; | ||
141 | - algor_init_params->basic_param = basic_params; | ||
142 | - } break; | ||
143 | - | ||
144 | - case algorithm_type_t::TRUCK_MANNED: { | ||
145 | - auto algor_params = new algor_config_param_manned_incident; | ||
146 | - { | ||
147 | - // algor_params->m = 10; | ||
148 | - // algor_params->n = 8; | ||
149 | - algor_params->m = 5; | ||
150 | - algor_params->n = 5; | ||
151 | - algor_params->hs_count_threshold = 1; | ||
152 | - algor_params->obj_confidence_threshold = 0.5f; | ||
153 | - algor_params->obj_min_height = 6; | ||
154 | - algor_params->obj_min_width = 32; | ||
155 | - } | ||
156 | - | ||
157 | - auto basic_params = new algor_basic_config_param_t; | ||
158 | - { | ||
159 | - basic_params->video_folder = "res/video_recode"; | ||
160 | - basic_params->result_folder = "res/truck_manned"; | ||
161 | - basic_params->result_folder_little = "res/truck_manned_little"; | ||
162 | - } | ||
163 | - | ||
164 | - algor_init_params->algor_param = algor_params; | ||
165 | - algor_init_params->basic_param = basic_params; | ||
166 | - } break; | ||
167 | - | ||
168 | - case algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE: { | ||
169 | - auto algor_params = new algor_config_param_manned_incident; | ||
170 | - { | ||
171 | - algor_params->m = 10; | ||
172 | - algor_params->n = 8; | ||
173 | - algor_params->obj_confidence_threshold = 0.5f; | ||
174 | - algor_params->obj_min_height = 75; | ||
175 | - algor_params->obj_min_width = 51; | ||
176 | - } | ||
177 | - | ||
178 | - auto basic_params = new algor_basic_config_param_t; | ||
179 | - { | ||
180 | - basic_params->video_folder = "res/video_recode"; | ||
181 | - basic_params->result_folder = "res/motor_usephone"; | ||
182 | - basic_params->result_folder_little = "res/motor_usephone_little"; | ||
183 | - } | ||
184 | - | ||
185 | - algor_init_params->algor_param = algor_params; | ||
186 | - algor_init_params->basic_param = basic_params; | ||
187 | - } break; | ||
188 | - | ||
189 | - case algorithm_type_t::NONMOTOR_VEHICLE_REFIT: { | ||
190 | - auto algor_params = new algor_config_param_manned_incident; | ||
191 | - { | ||
192 | - algor_params->m = 10; | ||
193 | - algor_params->n = 8; | ||
194 | - algor_params->obj_confidence_threshold = 0.5f; | ||
195 | - algor_params->obj_min_height = 75; | ||
196 | - algor_params->obj_min_width = 51; | ||
197 | - } | ||
198 | - | ||
199 | - auto basic_params = new algor_basic_config_param_t; | ||
200 | - { | ||
201 | - basic_params->video_folder = "res/video_recode"; | ||
202 | - basic_params->result_folder = "res/motor_refit"; | ||
203 | - basic_params->result_folder_little = "res/motor_refit_little"; | ||
204 | - } | ||
205 | - | ||
206 | - algor_init_params->algor_param = algor_params; | ||
207 | - algor_init_params->basic_param = basic_params; | ||
208 | - } break; | ||
209 | - | ||
210 | - case algorithm_type_t::PERSON_RUNNING_REDLIGHTS: { | ||
211 | - auto algor_params = new algor_config_param_manned_incident; | ||
212 | - { | ||
213 | - algor_params->m = 10; | ||
214 | - algor_params->n = 8; | ||
215 | - algor_params->hs_count_threshold = 1; | ||
216 | - algor_params->obj_confidence_threshold = 0.5f; | ||
217 | - algor_params->obj_min_height = 6; | ||
218 | - algor_params->obj_min_width = 32; | ||
219 | - } | ||
220 | - | ||
221 | - auto basic_params = new algor_basic_config_param_t; | ||
222 | - { | ||
223 | - basic_params->video_folder = "res/video_recode"; | ||
224 | - basic_params->result_folder = "res/person_runred"; | ||
225 | - basic_params->result_folder_little = "res/person_runred_little"; | ||
226 | - } | ||
227 | - | ||
228 | - algor_init_params->algor_param = algor_params; | ||
229 | - algor_init_params->basic_param = basic_params; | ||
230 | - } break; | ||
231 | - | ||
232 | - case algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS: { | ||
233 | - auto algor_params = new algor_config_param_manned_incident; | ||
234 | - { | ||
235 | - algor_params->m = 10; | ||
236 | - algor_params->n = 8; | ||
237 | - algor_params->hs_count_threshold = 0; | ||
238 | - algor_params->obj_confidence_threshold = 0.5f; | ||
239 | - algor_params->obj_min_height = 6; | ||
240 | - algor_params->obj_min_width = 32; | ||
241 | - } | ||
242 | - | ||
243 | - auto basic_params = new algor_basic_config_param_t; | ||
244 | - { | ||
245 | - basic_params->video_folder = "res/video_recode"; | ||
246 | - basic_params->result_folder = "res/motor_runred"; | ||
247 | - basic_params->result_folder_little = "res/motor_runred_little"; | ||
248 | - } | ||
249 | - | ||
250 | - algor_init_params->algor_param = algor_params; | ||
251 | - algor_init_params->basic_param = basic_params; | ||
252 | - } break; | ||
253 | - | ||
254 | - case algorithm_type_t::PERSON_IN_VEHICLELANE: { | ||
255 | - auto algor_params = new algor_config_param_manned_incident; | ||
256 | - { | ||
257 | - algor_params->m = 10; | ||
258 | - algor_params->n = 8; | ||
259 | - algor_params->obj_confidence_threshold = 0.5f; | ||
260 | - algor_params->obj_min_height = 6; | ||
261 | - algor_params->obj_min_width = 32; | ||
262 | - } | ||
263 | - | ||
264 | - auto basic_params = new algor_basic_config_param_t; | ||
265 | - { | ||
266 | - basic_params->video_folder = "res/video_recode"; | ||
267 | - basic_params->result_folder = "res/person_vehiclelane"; | ||
268 | - basic_params->result_folder_little = "res/person_vehiclelane_little"; | ||
269 | - } | ||
270 | - | ||
271 | - algor_init_params->algor_param = algor_params; | ||
272 | - algor_init_params->basic_param = basic_params; | ||
273 | - } break; | ||
274 | - | ||
275 | - case algorithm_type_t::NONMOTOR_IN_VEHICLELANE: { | ||
276 | - auto algor_params = new algor_config_param_manned_incident; | ||
277 | - { | ||
278 | - algor_params->m = 10; | ||
279 | - algor_params->n = 8; | ||
280 | - algor_params->obj_confidence_threshold = 0.5f; | ||
281 | - algor_params->obj_min_height = 6; | ||
282 | - algor_params->obj_min_width = 32; | ||
283 | - } | ||
284 | - | ||
285 | - auto basic_params = new algor_basic_config_param_t; | ||
286 | - { | ||
287 | - basic_params->video_folder = "res/video_recode"; | ||
288 | - basic_params->result_folder = "res/motor_vehiclelane"; | ||
289 | - basic_params->result_folder_little = "res/motor_vehiclelane_little"; | ||
290 | - } | ||
291 | - | ||
292 | - algor_init_params->algor_param = algor_params; | ||
293 | - algor_init_params->basic_param = basic_params; | ||
294 | - } break; | ||
295 | - | ||
296 | - case algorithm_type_t::NONMOTOR_CEOSSPARKLINE: { | ||
297 | - auto algor_params = new algor_config_param_manned_incident; | ||
298 | - { | ||
299 | - algor_params->m = 10; | ||
300 | - algor_params->n = 8; | ||
301 | - algor_params->obj_confidence_threshold = 0.5f; | ||
302 | - algor_params->obj_min_height = 6; | ||
303 | - algor_params->obj_min_width = 32; | ||
304 | - } | ||
305 | - | ||
306 | - auto basic_params = new algor_basic_config_param_t; | ||
307 | - { | ||
308 | - basic_params->video_folder = "res/video_recode"; | ||
309 | - basic_params->result_folder = "res/motor_crossparkline"; | ||
310 | - basic_params->result_folder_little = "res/motor_crossparkline_little"; | ||
311 | - } | ||
312 | - | ||
313 | - algor_init_params->algor_param = algor_params; | ||
314 | - algor_init_params->basic_param = basic_params; | ||
315 | - } break; | ||
316 | - | ||
317 | - case algorithm_type_t::PERSON_CROSS: { | ||
318 | - auto algor_params = new algor_config_param_manned_incident; | ||
319 | - { | ||
320 | - algor_params->m = 10; | ||
321 | - algor_params->n = 8; | ||
322 | - algor_params->obj_confidence_threshold = 0.5f; | ||
323 | - algor_params->obj_min_height = 6; | ||
324 | - algor_params->obj_min_width = 32; | ||
325 | - } | ||
326 | - | ||
327 | - auto basic_params = new algor_basic_config_param_t; | ||
328 | - { | ||
329 | - basic_params->video_folder = "res/video_recode"; | ||
330 | - basic_params->result_folder = "res/person_cross"; | ||
331 | - basic_params->result_folder_little = "res/person_cross_little"; | ||
332 | - } | ||
333 | - | ||
334 | - algor_init_params->algor_param = algor_params; | ||
335 | - algor_init_params->basic_param = basic_params; | ||
336 | - } break; | ||
337 | - | ||
338 | - case algorithm_type_t::NONMOTOR_WRONGDIRECTION: { | ||
339 | - auto algor_params = new algor_config_param_manned_incident; | ||
340 | - { | ||
341 | - algor_params->m = 10; | ||
342 | - algor_params->n = 8; | ||
343 | - algor_params->obj_confidence_threshold = 0.5f; | ||
344 | - algor_params->obj_min_height = 6; | ||
345 | - algor_params->obj_min_width = 32; | ||
346 | - } | ||
347 | - | ||
348 | - auto basic_params = new algor_basic_config_param_t; | ||
349 | - { | ||
350 | - basic_params->video_folder = "res/video_recode"; | ||
351 | - basic_params->result_folder = "res/motor_wrongdirection"; | ||
352 | - basic_params->result_folder_little = "res/motor_wrongdirection_little"; | ||
353 | - } | ||
354 | - | ||
355 | - algor_init_params->algor_param = algor_params; | ||
356 | - algor_init_params->basic_param = basic_params; | ||
357 | - } break; | ||
358 | - | ||
359 | - case algorithm_type_t::VEHICLE_WRONGDIRECTION: { | ||
360 | - auto algor_params = new algor_config_param_manned_incident; | ||
361 | - { | ||
362 | - algor_params->m = 5; | ||
363 | - algor_params->n = 5; | ||
364 | - algor_params->obj_confidence_threshold = 0.5f; | ||
365 | - algor_params->obj_min_height = 60; | ||
366 | - algor_params->obj_min_width = 60; | ||
367 | - } | ||
368 | - | ||
369 | - auto basic_params = new algor_basic_config_param_t; | ||
370 | - { | ||
371 | - basic_params->video_folder = "res/video_recode"; | ||
372 | - basic_params->result_folder = "res/vehicle_wrongdirection"; | ||
373 | - basic_params->result_folder_little = "res/vehicle_wrongdirection_little"; | ||
374 | - } | ||
375 | - | ||
376 | - algor_init_params->algor_param = algor_params; | ||
377 | - algor_init_params->basic_param = basic_params; | ||
378 | - } break; | ||
379 | - | ||
380 | - case algorithm_type_t::VEHICLE_NOTGIVEWAY: { | ||
381 | - auto algor_params = new algor_config_param_manned_incident; | ||
382 | - { | ||
383 | - algor_params->m = 10; | ||
384 | - algor_params->n = 8; | ||
385 | - algor_params->obj_confidence_threshold = 0.5f; | ||
386 | - algor_params->obj_min_height = 40; | ||
387 | - algor_params->obj_min_width = 40; | ||
388 | - } | ||
389 | - | ||
390 | - auto basic_params = new algor_basic_config_param_t; | ||
391 | - { | ||
392 | - basic_params->video_folder = "res/video_recode"; | ||
393 | - basic_params->result_folder = "res/vehicle_notgiveway"; | ||
394 | - basic_params->result_folder_little = "res/vehicle_notgiveway_little"; | ||
395 | - } | ||
396 | - | ||
397 | - algor_init_params->algor_param = algor_params; | ||
398 | - algor_init_params->basic_param = basic_params; | ||
399 | - } break; | ||
400 | - | ||
401 | - case algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND: { | ||
402 | - auto algor_params = new algor_config_param_manned_incident; | ||
403 | - { | ||
404 | - algor_params->m = 10; | ||
405 | - algor_params->n = 8; | ||
406 | - algor_params->obj_confidence_threshold = 0.5f; | ||
407 | - algor_params->obj_min_height = 40; | ||
408 | - algor_params->obj_min_width = 40; | ||
409 | - } | ||
410 | - | ||
411 | - auto basic_params = new algor_basic_config_param_t; | ||
412 | - { | ||
413 | - basic_params->video_folder = "res/video_recode"; | ||
414 | - basic_params->result_folder = "res/vehicle_solid_turnaround"; | ||
415 | - basic_params->result_folder_little = "res/vehicle_solid_turnaround_little"; | ||
416 | - } | ||
417 | - | ||
418 | - algor_init_params->algor_param = algor_params; | ||
419 | - algor_init_params->basic_param = basic_params; | ||
420 | - } break; | ||
421 | - | ||
422 | - case algorithm_type_t::VEHICLE_NOTDECELERATION: { | ||
423 | - auto algor_params = new algor_config_param_manned_incident; | ||
424 | - { | ||
425 | - algor_params->m = 10; | ||
426 | - algor_params->n = 8; | ||
427 | - algor_params->obj_confidence_threshold = 0.5f; | ||
428 | - algor_params->obj_min_height = 40; | ||
429 | - algor_params->obj_min_width = 40; | ||
430 | - } | ||
431 | - | ||
432 | - auto basic_params = new algor_basic_config_param_t; | ||
433 | - { | ||
434 | - basic_params->video_folder = "res/video_recode"; | ||
435 | - basic_params->result_folder = "res/vehicle_not_deceleration"; | ||
436 | - basic_params->result_folder_little = "res/vehicle_not_deceleration_little"; | ||
437 | - } | ||
438 | - | ||
439 | - algor_init_params->algor_param = algor_params; | ||
440 | - algor_init_params->basic_param = basic_params; | ||
441 | - } break; | ||
442 | - | ||
443 | - | ||
444 | - case algorithm_type_t::FACE_SNAPSHOT: { | ||
445 | - auto basic_params = new algor_basic_config_param_t; | ||
446 | - { | ||
447 | - basic_params->algor_valid_rect.top_ = 0; | ||
448 | - basic_params->algor_valid_rect.left_ = 0; | ||
449 | - basic_params->algor_valid_rect.width_ = 1920; | ||
450 | - basic_params->algor_valid_rect.height_ = 1080; | ||
451 | - | ||
452 | - basic_params->result_folder = "res/face"; | ||
453 | - basic_params->result_folder_little = "res/face_little"; | ||
454 | - } | ||
455 | - auto algor_params = new algor_config_param_snapshot; | ||
456 | - { algor_params->threshold = 0.5f; } | ||
457 | - | ||
458 | - algor_init_params->algor_param = algor_params; | ||
459 | - algor_init_params->basic_param = basic_params; | ||
460 | - } break; | ||
461 | - | ||
462 | - case algorithm_type_t::HUMAN_SNAPSHOT: { | ||
463 | - auto basic_params = new algor_basic_config_param_t; | ||
464 | - { | ||
465 | - basic_params->algor_valid_rect.top_ = 0; | ||
466 | - basic_params->algor_valid_rect.left_ = 0; | ||
467 | - basic_params->algor_valid_rect.width_ = 1920; | ||
468 | - basic_params->algor_valid_rect.height_ = 1080; | ||
469 | - | ||
470 | - basic_params->result_folder = "res/human"; | ||
471 | - basic_params->result_folder_little = "res/human_little"; | ||
472 | - } | ||
473 | - auto algor_params = new algor_config_param_snapshot; | ||
474 | - { algor_params->threshold = 0.5f; } | ||
475 | - | ||
476 | - algor_init_params->algor_param = algor_params; | ||
477 | - algor_init_params->basic_param = basic_params; | ||
478 | - } break; | ||
479 | - | ||
480 | - case algorithm_type_t::PEDESTRIAN_FALL: { | ||
481 | - auto algor_params = new algor_config_param_pedestrian_fall; | ||
482 | - { algor_params->threshold = 0.7f; } | ||
483 | - | ||
484 | - auto basic_params = new algor_basic_config_param_t; | ||
485 | - { | ||
486 | - basic_params->algor_valid_rect.top_ = 0; | ||
487 | - basic_params->algor_valid_rect.left_ = 0; | ||
488 | - basic_params->algor_valid_rect.width_ = 1920; | ||
489 | - basic_params->algor_valid_rect.height_ = 1080; | ||
490 | - | ||
491 | - basic_params->result_folder = "res/fall"; | ||
492 | - basic_params->result_folder_little = "res/fall_little"; | ||
493 | - } | ||
494 | - | ||
495 | - algor_init_params->algor_param = algor_params; | ||
496 | - algor_init_params->basic_param = basic_params; | ||
497 | - } break; | ||
498 | - | ||
499 | - case algorithm_type_t::PEDESTRIAN_FIGHT: { | ||
500 | - auto algor_params = new algor_config_param_pedestrian_fight; | ||
501 | - { | ||
502 | - algor_params->threshold = 0.7f; | ||
503 | - algor_params->iou_threshold = 0.1f; | ||
504 | - } | ||
505 | - | ||
506 | - auto basic_params = new algor_basic_config_param_t; | ||
507 | - { | ||
508 | - | ||
509 | - basic_params->algor_valid_rect.top_ = 0; | ||
510 | - basic_params->algor_valid_rect.left_ = 0; | ||
511 | - basic_params->algor_valid_rect.width_ = 1920; | ||
512 | - basic_params->algor_valid_rect.height_ = 1080; | ||
513 | - basic_params->result_folder = "res/fight"; | ||
514 | - basic_params->result_folder_little = "res/fight_little"; | ||
515 | - } | ||
516 | - | ||
517 | - algor_init_params->algor_param = algor_params; | ||
518 | - algor_init_params->basic_param = basic_params; | ||
519 | - } break; | ||
520 | - | ||
521 | - case algorithm_type_t::HUMAN_GATHER: { | ||
522 | - | ||
523 | - auto algor_params = new algor_config_param_human_gather; | ||
524 | - { | ||
525 | - algor_params->frame_stride = 1; | ||
526 | - // algor_params->human_count_threshold = 3; | ||
527 | - algor_params->human_count_threshold = 1; | ||
528 | - } | ||
529 | - | ||
530 | - auto basic_params = new algor_basic_config_param_t; | ||
531 | - { | ||
532 | - basic_params->algor_valid_rect.top_ = 0; | ||
533 | - basic_params->algor_valid_rect.left_ = 0; | ||
534 | - basic_params->algor_valid_rect.width_ = 1920; | ||
535 | - basic_params->algor_valid_rect.height_ = 1080; | ||
536 | - basic_params->result_folder = "res/gather"; | ||
537 | - basic_params->result_folder_little = "res/gather_little"; | ||
538 | - } | ||
539 | - | ||
540 | - algor_init_params->algor_param = algor_params; | ||
541 | - algor_init_params->basic_param = basic_params; | ||
542 | - } break; | ||
543 | - | ||
544 | - case algorithm_type_t::NO_REFLECTIVE_CLOTHING: { | ||
545 | - auto algor_params = new algor_config_param_no_reflective_clothing; | ||
546 | - { | ||
547 | - algor_params->conf_threshold = 0.3f; | ||
548 | - algor_params->m = 10; | ||
549 | - algor_params->n = 6; | ||
550 | - algor_params->pedestrian_confidence_threshold = 0.3f; | ||
551 | - algor_params->pedestrian_min_height = 0; | ||
552 | - algor_params->pedestrian_min_width = 0; | ||
553 | - } | ||
554 | - | ||
555 | - auto basic_params = new algor_basic_config_param_t; | ||
556 | - { | ||
557 | - basic_params->algor_valid_rect.top_ = 0; | ||
558 | - basic_params->algor_valid_rect.left_ = 0; | ||
559 | - basic_params->algor_valid_rect.width_ = 1920; | ||
560 | - basic_params->algor_valid_rect.height_ = 1080; | ||
561 | - basic_params->result_folder = "res/no_reflective_clothing"; | ||
562 | - basic_params->result_folder_little = "res/no_reflective_clothing_little"; | ||
563 | - } | ||
564 | - | ||
565 | - algor_init_params->algor_param = algor_params; | ||
566 | - algor_init_params->basic_param = basic_params; | ||
567 | - } break; | ||
568 | - | ||
569 | - case algorithm_type_t::NO_SAFETY_HELMET: { | ||
570 | - auto algor_params = new algor_config_param_no_safety_helmet; | ||
571 | - { | ||
572 | - algor_params->conf_threshold = 0.3f; | ||
573 | - algor_params->m = 10; | ||
574 | - algor_params->n = 6; | ||
575 | - algor_params->pedestrian_confidence_threshold = 0.3f; | ||
576 | - algor_params->pedestrian_min_height = 0; | ||
577 | - algor_params->pedestrian_min_width = 0; | ||
578 | - } | ||
579 | - | ||
580 | - auto basic_params = new algor_basic_config_param_t; | ||
581 | - { | ||
582 | - basic_params->algor_valid_rect.top_ = 0; | ||
583 | - basic_params->algor_valid_rect.left_ = 0; | ||
584 | - basic_params->algor_valid_rect.width_ = 1920; | ||
585 | - basic_params->algor_valid_rect.height_ = 1080; | ||
586 | - basic_params->result_folder = "res/no_safety_helmet"; | ||
587 | - basic_params->result_folder_little = "res/no_safety_helmet_little"; | ||
588 | - } | ||
589 | - | ||
590 | - algor_init_params->algor_param = algor_params; | ||
591 | - algor_init_params->basic_param = basic_params; | ||
592 | - } break; | ||
593 | - | ||
594 | - case algorithm_type_t::CALL_PHONE_DET: { | ||
595 | - auto algor_params = new algor_config_param_call_phone; | ||
596 | - { | ||
597 | - algor_params->conf_threshold = 0.3f; | ||
598 | - algor_params->m = 2; | ||
599 | - algor_params->n = 1; | ||
600 | - algor_params->pedestrian_confidence_threshold = 0.1f; | ||
601 | - algor_params->pedestrian_min_height = 0; | ||
602 | - algor_params->pedestrian_min_width = 0; | ||
603 | - } | ||
604 | - | ||
605 | - auto basic_params = new algor_basic_config_param_t; | ||
606 | - { | ||
607 | - basic_params->algor_valid_rect.top_ = 0; | ||
608 | - basic_params->algor_valid_rect.left_ = 0; | ||
609 | - basic_params->algor_valid_rect.width_ = 1920; | ||
610 | - basic_params->algor_valid_rect.height_ = 1080; | ||
611 | - basic_params->result_folder = "res/call_phone"; | ||
612 | - basic_params->result_folder_little = "res/call_phone_little"; | ||
613 | - } | ||
614 | - | ||
615 | - algor_init_params->algor_param = algor_params; | ||
616 | - algor_init_params->basic_param = basic_params; | ||
617 | - } break; | ||
618 | - | ||
619 | - case algorithm_type_t::SMOKING_DET: { | ||
620 | - auto algor_params = new algor_config_param_smoking; | ||
621 | - { | ||
622 | - algor_params->conf_threshold = 0.3f; | ||
623 | - algor_params->m = 10; | ||
624 | - algor_params->n = 1; | ||
625 | - algor_params->pedestrian_confidence_threshold = 0.3f; | ||
626 | - algor_params->pedestrian_min_height = 0; | ||
627 | - algor_params->pedestrian_min_width = 0; | ||
628 | - } | ||
629 | - | ||
630 | - auto basic_params = new algor_basic_config_param_t; | ||
631 | - { | ||
632 | - basic_params->algor_valid_rect.top_ = 0; | ||
633 | - basic_params->algor_valid_rect.left_ = 0; | ||
634 | - basic_params->algor_valid_rect.width_ = 1920; | ||
635 | - basic_params->algor_valid_rect.height_ = 1080; | ||
636 | - basic_params->result_folder = "res/smoking"; | ||
637 | - basic_params->result_folder_little = "res/smoking_little"; | ||
638 | - } | ||
639 | - | ||
640 | - algor_init_params->algor_param = algor_params; | ||
641 | - algor_init_params->basic_param = basic_params; | ||
642 | - } break; | ||
643 | - | ||
644 | - case algorithm_type_t::VEHICLE_SNAPSHOT: { | ||
645 | - | ||
646 | - auto basic_params = new algor_basic_config_param_t; | ||
647 | - { | ||
648 | - basic_params->algor_valid_rect.top_ = 0; | ||
649 | - basic_params->algor_valid_rect.left_ = 0; | ||
650 | - basic_params->algor_valid_rect.width_ = 1920; | ||
651 | - basic_params->algor_valid_rect.height_ = 1080; | ||
652 | - basic_params->result_folder = "res/vehicle"; | ||
653 | - basic_params->result_folder_little = "res/vehicle_little"; | ||
654 | - } | ||
655 | - | ||
656 | - auto algor_params = new algor_config_param_snapshot; | ||
657 | - algor_params->threshold = 0.5f; | ||
658 | - algor_params->snap_frame_interval = 5; | ||
659 | - | ||
660 | - algor_init_params->algor_param = algor_params; | ||
661 | - algor_init_params->basic_param = basic_params; | ||
662 | - } break; | ||
663 | - | ||
664 | - case algorithm_type_t::NONMOTOR_VEHICLE_SNAPSHOT: { | ||
665 | - | ||
666 | - auto basic_params = new algor_basic_config_param_t; | ||
667 | - { | ||
668 | - basic_params->algor_valid_rect.top_ = 0; | ||
669 | - basic_params->algor_valid_rect.left_ = 0; | ||
670 | - basic_params->algor_valid_rect.width_ = 1920; | ||
671 | - basic_params->algor_valid_rect.height_ = 1080; | ||
672 | - basic_params->result_folder = "res/nonmotor"; | ||
673 | - basic_params->result_folder_little = "res/nonmotor_little"; | ||
674 | - } | ||
675 | - | ||
676 | - auto algor_params = new algor_config_param_snapshot; | ||
677 | - { algor_params->threshold = 0.5f; } | ||
678 | - | ||
679 | - algor_init_params->algor_param = algor_params; | ||
680 | - algor_init_params->basic_param = basic_params; | ||
681 | - } break; | ||
682 | - | ||
683 | - case algorithm_type_t::TAKEAWAY_MEMBER_CLASSIFICATION: { | ||
684 | - auto algor_params = new algor_config_param_takeaway_member_classification; | ||
685 | - { | ||
686 | - algor_params->m = 10; | ||
687 | - algor_params->n = 2; | ||
688 | - algor_params->threshold = 0.7f; | ||
689 | - } | ||
690 | - | ||
691 | - auto basic_params = new algor_basic_config_param_t; | ||
692 | - { | ||
693 | - basic_params->algor_valid_rect.top_ = 0; | ||
694 | - basic_params->algor_valid_rect.left_ = 0; | ||
695 | - basic_params->algor_valid_rect.width_ = 1920; | ||
696 | - basic_params->algor_valid_rect.height_ = 1080; | ||
697 | - basic_params->result_folder = "res/takeaway"; | ||
698 | - basic_params->result_folder_little = "res/takeaway_little"; | ||
699 | - } | ||
700 | - | ||
701 | - algor_init_params->algor_param = algor_params; | ||
702 | - algor_init_params->basic_param = basic_params; | ||
703 | - } break; | ||
704 | - | ||
705 | - case algorithm_type_t::PEDESTRIAN_RETROGRADE: { | ||
706 | - // 578 1300 600 | ||
707 | - auto algor_params = new algor_config_param_pedestrian_retrograde; | ||
708 | - { | ||
709 | - algor_params->conf_threshold = 0.5f; | ||
710 | - algor_params->minmum_height = 10; | ||
711 | - algor_params->minmum_width = 10; | ||
712 | - algor_params->direction = 0; | ||
713 | - | ||
714 | - algor_params->px1 = 578; | ||
715 | - algor_params->py1 = 600; | ||
716 | - | ||
717 | - algor_params->px2 = 1300; | ||
718 | - algor_params->py2 = 600; | ||
719 | - } | ||
720 | - | ||
721 | - auto basic_params = new algor_basic_config_param_t; | ||
722 | - { | ||
723 | - basic_params->algor_valid_rect.top_ = 0; | ||
724 | - basic_params->algor_valid_rect.left_ = 0; | ||
725 | - basic_params->algor_valid_rect.width_ = 1920; | ||
726 | - basic_params->algor_valid_rect.height_ = 1080; | ||
727 | - basic_params->result_folder = "res/pedestrian_retrograde"; | ||
728 | - basic_params->result_folder_little = "res/pedestrian_retrograde_little"; | ||
729 | - } | ||
730 | - | ||
731 | - algor_init_params->algor_param = algor_params; | ||
732 | - algor_init_params->basic_param = basic_params; | ||
733 | - | ||
734 | - } break; | ||
735 | - | ||
736 | - case algorithm_type_t::VEHICLE_RETROGRADE: { | ||
737 | - // 578 1300 600 | ||
738 | - auto algor_params = new algor_config_param_pedestrian_retrograde; | ||
739 | - { | ||
740 | - algor_params->conf_threshold = 0.5f; | ||
741 | - algor_params->minmum_height = 10; | ||
742 | - algor_params->minmum_width = 10; | ||
743 | - algor_params->direction = 0; | ||
744 | - | ||
745 | - algor_params->px1 = 578; | ||
746 | - algor_params->py1 = 600; | ||
747 | - | ||
748 | - algor_params->px2 = 1300; | ||
749 | - algor_params->py2 = 600; | ||
750 | - } | ||
751 | - | ||
752 | - auto basic_params = new algor_basic_config_param_t; | ||
753 | - { | ||
754 | - basic_params->algor_valid_rect.top_ = 0; | ||
755 | - | ||
756 | - basic_params->algor_valid_rect.left_ = 0; | ||
757 | - basic_params->algor_valid_rect.width_ = 1920; | ||
758 | - basic_params->algor_valid_rect.height_ = 1080; | ||
759 | - basic_params->result_folder = "res/vehicle_retrograde"; | ||
760 | - basic_params->result_folder_little = "res/vehicle_retrograde_little"; | ||
761 | - } | ||
762 | - | ||
763 | - algor_init_params->algor_param = algor_params; | ||
764 | - algor_init_params->basic_param = basic_params; | ||
765 | - | ||
766 | - } break; | ||
767 | - | ||
768 | - case algorithm_type_t::PEDESTRIAN_TRESPASS: { | ||
769 | - // 578 1300 600 | ||
770 | - auto algor_params = new algor_config_param_pedestrian_trespass; | ||
771 | - { | ||
772 | - algor_params->conf_threshold = 0.5f; | ||
773 | - algor_params->minmum_height = 64; | ||
774 | - algor_params->minmum_width = 32; | ||
775 | - algor_params->points_count = 4; | ||
776 | - | ||
777 | - algor_params->points[0].x_ = 200; | ||
778 | - algor_params->points[0].y_ = 200; | ||
779 | - | ||
780 | - algor_params->points[1].x_ = 600; | ||
781 | - algor_params->points[1].y_ = 200; | ||
782 | - | ||
783 | - algor_params->points[2].x_ = 600; | ||
784 | - algor_params->points[2].y_ = 500; | ||
785 | - | ||
786 | - algor_params->points[3].x_ = 200; | ||
787 | - algor_params->points[3].y_ = 500; | ||
788 | - } | ||
789 | - | ||
790 | - auto basic_params = new algor_basic_config_param_t; | ||
791 | - { | ||
792 | - basic_params->algor_valid_rect.top_ = 0; | ||
793 | - basic_params->algor_valid_rect.left_ = 0; | ||
794 | - basic_params->algor_valid_rect.width_ = 1920; | ||
795 | - basic_params->algor_valid_rect.height_ = 1080; | ||
796 | - basic_params->result_folder = "res/pedestrian_trespass"; | ||
797 | - basic_params->result_folder_little = "res/pedestrian_trespass_little"; | ||
798 | - } | ||
799 | - | ||
800 | - algor_init_params->algor_param = algor_params; | ||
801 | - algor_init_params->basic_param = basic_params; | ||
802 | - | ||
803 | - } break; | ||
804 | - | ||
805 | - case algorithm_type_t::VEHICLE_TRESPASS: { | ||
806 | - // 578 1300 600 | ||
807 | - auto algor_params = new algor_config_param_vehicle_trespass; | ||
808 | - { | ||
809 | - algor_params->conf_threshold = 0.5f; | ||
810 | - algor_params->minmum_height = 64; | ||
811 | - algor_params->minmum_width = 64; | ||
812 | - algor_params->points_count = 4; | ||
813 | - | ||
814 | - algor_params->points[0].x_ = 500; | ||
815 | - algor_params->points[0].y_ = 500; | ||
816 | - | ||
817 | - algor_params->points[1].x_ = 1500; | ||
818 | - algor_params->points[1].y_ = 500; | ||
819 | - | ||
820 | - algor_params->points[2].x_ = 1500; | ||
821 | - algor_params->points[2].y_ = 900; | ||
822 | - | ||
823 | - algor_params->points[3].x_ = 500; | ||
824 | - algor_params->points[3].y_ = 900; | ||
825 | - } | ||
826 | - | ||
827 | - auto basic_params = new algor_basic_config_param_t; | ||
828 | - { | ||
829 | - basic_params->algor_valid_rect.top_ = 0; | ||
830 | - basic_params->algor_valid_rect.left_ = 0; | ||
831 | - basic_params->algor_valid_rect.width_ = 1920; | ||
832 | - basic_params->algor_valid_rect.height_ = 1080; | ||
833 | - basic_params->result_folder = "res/vehicle_trespass"; | ||
834 | - basic_params->result_folder_little = "res/vehicle_trespass_little"; | ||
835 | - } | ||
836 | - | ||
837 | - algor_init_params->algor_param = algor_params; | ||
838 | - algor_init_params->basic_param = basic_params; | ||
839 | - | ||
840 | - } break; | ||
841 | - | ||
842 | - case algorithm_type_t::VIDEO_SNAPSHOT: { | ||
843 | - auto basic_params = new algor_basic_config_param_t; | ||
844 | - { basic_params->result_folder = "res/video_snapshot"; } | ||
845 | - algor_init_params->basic_param = basic_params; | ||
846 | - } break; | ||
847 | - | ||
848 | - | ||
849 | - case algorithm_type_t::ROAD_WORK_DET: { | ||
850 | - | ||
851 | - auto algor_params = new algor_config_param_road_work; | ||
852 | - { | ||
853 | - algor_params->frame_stride = 5; | ||
854 | - algor_params->rblock_count_threshold = 3; | ||
855 | - // algor_params->frame_stride = 1; | ||
856 | - // algor_params->rblock_count_threshold = 1; | ||
857 | - } | ||
858 | - | ||
859 | - auto basic_params = new algor_basic_config_param_t; | ||
860 | - { | ||
861 | - basic_params->algor_valid_rect.top_ = 0; | ||
862 | - basic_params->algor_valid_rect.left_ = 0; | ||
863 | - // basic_params->algor_valid_rect.width_ = 1920; | ||
864 | - // basic_params->algor_valid_rect.height_ = 1080; | ||
865 | - basic_params->algor_valid_rect.width_ = 2560; | ||
866 | - basic_params->algor_valid_rect.height_ = 1440; | ||
867 | - basic_params->result_folder = "res/road_work"; | ||
868 | - basic_params->result_folder_little = "res/road_work_little"; | ||
869 | - } | ||
870 | - | ||
871 | - algor_init_params->algor_param = algor_params; | ||
872 | - algor_init_params->basic_param = basic_params; | ||
873 | - } break; | ||
874 | - | ||
875 | - case algorithm_type_t::VIDEO_TIMING_SNAPSHOT: { | ||
876 | - | ||
877 | - auto algor_params = new algor_config_param_road_work; | ||
878 | - { | ||
879 | - algor_params->frame_stride = 1; | ||
880 | - } | ||
881 | - | ||
882 | - auto basic_params = new algor_basic_config_param_t; | ||
883 | - { | ||
884 | - basic_params->result_folder = "res/video_timing_snapshot"; | ||
885 | - } | ||
886 | - | ||
887 | - algor_init_params->algor_param = algor_params; | ||
888 | - algor_init_params->basic_param = basic_params; | ||
889 | - } break; | ||
890 | - | ||
891 | - default: { | ||
892 | - if (algor_init_params != nullptr) { | ||
893 | - delete algor_init_params; | ||
894 | - algor_init_params = nullptr; | ||
895 | - } | ||
896 | - return; | ||
897 | - } break; | ||
898 | - } | ||
899 | - | ||
900 | - tparam.algor_config_params[idx].algor_type = algor_type; | ||
901 | - tparam.algor_config_params[idx].algor_init_config_param = algor_init_params; | ||
902 | - | ||
903 | -} | ||
904 | 11 | ||
905 | static long long get_cur_time(){ | 12 | static long long get_cur_time(){ |
906 | chrono::time_point<chrono::system_clock, chrono::milliseconds> tpMicro | 13 | chrono::time_point<chrono::system_clock, chrono::milliseconds> tpMicro |
@@ -908,285 +15,162 @@ static long long get_cur_time(){ | @@ -908,285 +15,162 @@ static long long get_cur_time(){ | ||
908 | return tpMicro.time_since_epoch().count(); | 15 | return tpMicro.time_since_epoch().count(); |
909 | } | 16 | } |
910 | 17 | ||
911 | -static int nTaskId = 0; | ||
912 | - | ||
913 | -string createTask(void *handle, std::vector<algorithm_type_t> algor_vec, int gi, bool bFlag = true){ | ||
914 | - task_param tparam; | ||
915 | - | 18 | +string get_ipc_url(int gi){ |
19 | + string ipc_url = "/data/share/data/Street.uvf"; | ||
916 | switch(gi){ | 20 | switch(gi){ |
917 | case 0: | 21 | case 0: |
918 | - tparam.ipc_url = "rtsp://admin:admin@123456@192.168.60.176:554/cam/realmonitor?channel=1&subtype=0"; | 22 | + ipc_url = "rtsp://admin:admin@123456@192.168.60.176:554/cam/realmonitor?channel=1&subtype=0"; |
919 | break; | 23 | break; |
920 | case 1: | 24 | case 1: |
921 | - tparam.ipc_url = "rtsp://122.97.218.170:8604/openUrl/V5nXRHa?params=eyJwcm90b2NhbCI6InJ0c3AiLCJjbGllbnRUeXBlIjoib3Blbl9hcGkiLCJleHByaWVUaW1lIjotMSwicHJvdG9jb2wiOiJydHNwIiwiZXhwaXJlVGltZSI6MzAwLCJlbmFibGVNR0MiOnRydWUsImV4cGFuZCI6InN0YW5kYXJkPXJ0c3Amc3RyZWFtZm9ybT1ydHAiLCJhIjoiMTBjZjM4N2JjY2Y5NDg3YzhjNWYzNjE2M2ViMWUyNTJ8MXwwfDEiLCJ0IjoxfQ=="; | 25 | + ipc_url = "rtsp://122.97.218.170:8604/openUrl/V5nXRHa?params=eyJwcm90b2NhbCI6InJ0c3AiLCJjbGllbnRUeXBlIjoib3Blbl9hcGkiLCJleHByaWVUaW1lIjotMSwicHJvdG9jb2wiOiJydHNwIiwiZXhwaXJlVGltZSI6MzAwLCJlbmFibGVNR0MiOnRydWUsImV4cGFuZCI6InN0YW5kYXJkPXJ0c3Amc3RyZWFtZm9ybT1ydHAiLCJhIjoiMTBjZjM4N2JjY2Y5NDg3YzhjNWYzNjE2M2ViMWUyNTJ8MXwwfDEiLCJ0IjoxfQ=="; |
922 | break; | 26 | break; |
923 | case 2: | 27 | case 2: |
924 | - tparam.ipc_url = "rtsp://admin:ad123456@192.168.10.166:554/cam/realmonitor?channel=1&subtype=0"; | 28 | + ipc_url = "rtsp://admin:ad123456@192.168.10.166:554/cam/realmonitor?channel=1&subtype=0"; |
925 | break; | 29 | break; |
926 | case 3: | 30 | case 3: |
927 | - tparam.ipc_url = "rtsp://122.97.218.170:8604/openUrl/LBBYTra?params=eyJwcm90b2NhbCI6InJ0c3AiLCJjbGllbnRUeXBlIjoib3Blbl9hcGkiLCJleHByaWVUaW1lIjotMSwicHJvdG9jb2wiOiJydHNwIiwiZXhwaXJlVGltZSI6MzAwLCJlbmFibGVNR0MiOnRydWUsImV4cGFuZCI6InN0YW5kYXJkPXJ0c3Amc3RyZWFtZm9ybT1ydHAiLCJhIjoiOTgzYjRjMmUxMThlNGU1OTlkYThmMTI3NTkyMGViODV8MXwwfDEiLCJ0IjoxfQ=="; | ||
928 | - // tparam.ipc_url = "rtsp://122.97.218.170:8604/openUrl/V5nXRHa?params=eyJwcm90b2NhbCI6InJ0c3AiLCJjbGllbnRUeXBlIjoib3Blbl9hcGkiLCJleHByaWVUaW1lIjotMSwicHJvdG9jb2wiOiJydHNwIiwiZXhwaXJlVGltZSI6MzAwLCJlbmFibGVNR0MiOnRydWUsImV4cGFuZCI6InN0YW5kYXJkPXJ0c3Amc3RyZWFtZm9ybT1ydHAiLCJhIjoiMTBjZjM4N2JjY2Y5NDg3YzhjNWYzNjE2M2ViMWUyNTJ8MXwwfDEiLCJ0IjoxfQ=="; | 31 | + ipc_url = "rtsp://122.97.218.170:8604/openUrl/LBBYTra?params=eyJwcm90b2NhbCI6InJ0c3AiLCJjbGllbnRUeXBlIjoib3Blbl9hcGkiLCJleHByaWVUaW1lIjotMSwicHJvdG9jb2wiOiJydHNwIiwiZXhwaXJlVGltZSI6MzAwLCJlbmFibGVNR0MiOnRydWUsImV4cGFuZCI6InN0YW5kYXJkPXJ0c3Amc3RyZWFtZm9ybT1ydHAiLCJhIjoiOTgzYjRjMmUxMThlNGU1OTlkYThmMTI3NTkyMGViODV8MXwwfDEiLCJ0IjoxfQ=="; |
32 | + // ipc_url = "rtsp://122.97.218.170:8604/openUrl/V5nXRHa?params=eyJwcm90b2NhbCI6InJ0c3AiLCJjbGllbnRUeXBlIjoib3Blbl9hcGkiLCJleHByaWVUaW1lIjotMSwicHJvdG9jb2wiOiJydHNwIiwiZXhwaXJlVGltZSI6MzAwLCJlbmFibGVNR0MiOnRydWUsImV4cGFuZCI6InN0YW5kYXJkPXJ0c3Amc3RyZWFtZm9ybT1ydHAiLCJhIjoiMTBjZjM4N2JjY2Y5NDg3YzhjNWYzNjE2M2ViMWUyNTJ8MXwwfDEiLCJ0IjoxfQ=="; | ||
929 | break; | 33 | break; |
930 | case 4: | 34 | case 4: |
931 | - tparam.ipc_url = "/data/share/data/Street.uvf"; | 35 | + ipc_url = "/data/share/data/Street.uvf"; |
932 | break; | 36 | break; |
933 | case 5: | 37 | case 5: |
934 | - tparam.ipc_url = "/data/share/data/公安局老桥头_CVR15F89410_1465819864_1B.mp4"; | 38 | + ipc_url = "/data/share/data/公安局老桥头_CVR15F89410_1465819864_1B.mp4"; |
935 | break; | 39 | break; |
936 | case 6: | 40 | case 6: |
937 | - tparam.ipc_url = "/data/share/data/不带头盔2.mp4"; | 41 | + ipc_url = "/data/share/data/不带头盔2.mp4"; |
938 | break; | 42 | break; |
939 | case 7: | 43 | case 7: |
940 | - tparam.ipc_url = "/data/share/data/hczr1.mp4"; | 44 | + ipc_url = "/data/share/data/hczr1.mp4"; |
941 | break; | 45 | break; |
942 | case 8: | 46 | case 8: |
943 | - tparam.ipc_url = "/data/share/data/燕高路口高点_CVR_2015-12-30_09-00-00_2015-12-30.mp4"; | 47 | + ipc_url = "/data/share/data/燕高路口高点_CVR_2015-12-30_09-00-00_2015-12-30.mp4"; |
944 | break; | 48 | break; |
945 | case 9: | 49 | case 9: |
946 | - // tparam.ipc_url = "/opt/share/data/1-00000002d55_h265.mp4"; | ||
947 | - tparam.ipc_url = "/data/share/data/duan1.mp4"; | 50 | + // ipc_url = "/opt/share/data/1-00000002d55_h265.mp4"; |
51 | + ipc_url = "/data/share/data/duan1.mp4"; | ||
948 | break; | 52 | break; |
949 | case 10: | 53 | case 10: |
950 | - tparam.ipc_url = "/data/share/data/gs1-00000001.mp4"; | 54 | + ipc_url = "/data/share/data/gs1-00000001.mp4"; |
951 | break; | 55 | break; |
952 | case 11: | 56 | case 11: |
953 | - tparam.ipc_url = "/data/share/data/98.mp4"; | 57 | + ipc_url = "/data/share/data/98.mp4"; |
954 | break; | 58 | break; |
955 | case 12: | 59 | case 12: |
956 | - tparam.ipc_url = "/data/share/data/AV_12345_1_20230108110849847_D_1673147329847729.mp4"; | 60 | + ipc_url = "/data/share/data/AV_12345_1_20230108110849847_D_1673147329847729.mp4"; |
957 | break; | 61 | break; |
958 | case 13: | 62 | case 13: |
959 | - tparam.ipc_url = "/data/share/data/nx_1-00000002.mp4"; | 63 | + ipc_url = "/data/share/data/nx_1-00000002.mp4"; |
960 | break; | 64 | break; |
961 | case 14: | 65 | case 14: |
962 | - tparam.ipc_url = "/data/share/data/nx1-0000001.mp4"; | 66 | + ipc_url = "/data/share/data/nx1-0000001.mp4"; |
963 | break; | 67 | break; |
964 | case 15: | 68 | case 15: |
965 | - tparam.ipc_url = "/data/share/data/nx1-00000002.mp4"; | 69 | + ipc_url = "/data/share/data/nx1-00000002.mp4"; |
966 | break; | 70 | break; |
967 | case 16: | 71 | case 16: |
968 | - tparam.ipc_url = "/data/share/data/Street.uvf"; | 72 | + ipc_url = "/data/share/data/Street.uvf"; |
969 | break; | 73 | break; |
970 | case 17: | 74 | case 17: |
971 | - tparam.ipc_url = "/data/share/data/xiancun.mp4"; | 75 | + ipc_url = "/data/share/data/xiancun.mp4"; |
972 | break; | 76 | break; |
973 | case 18: | 77 | case 18: |
974 | - tparam.ipc_url = "rtsp://192.168.60.146:8554/w_1_out"; | 78 | + ipc_url = "rtsp://192.168.60.146:8554/w_1_out"; |
975 | break; | 79 | break; |
976 | case 19: | 80 | case 19: |
977 | - tparam.ipc_url = "/data/share/data/42_44.avi"; | 81 | + ipc_url = "/data/share/data/42_44.avi"; |
978 | break; | 82 | break; |
979 | case 20: | 83 | case 20: |
980 | - tparam.ipc_url = "/data/share/data/37_70.avi"; | 84 | + ipc_url = "/data/share/data/37_70.avi"; |
981 | break; | 85 | break; |
982 | case 21: | 86 | case 21: |
983 | - tparam.ipc_url = "/data/share/data/192_25.avi"; | 87 | + ipc_url = "/data/share/data/192_25.avi"; |
984 | break; | 88 | break; |
985 | case 22: | 89 | case 22: |
986 | - tparam.ipc_url = "/data/share/data/31_4.avi"; | 90 | + ipc_url = "/data/share/data/31_4.avi"; |
987 | break; | 91 | break; |
988 | case 23: | 92 | case 23: |
989 | - tparam.ipc_url = "/data/share/data/146_192.avi"; | 93 | + ipc_url = "/data/share/data/146_192.avi"; |
990 | break; | 94 | break; |
991 | case 24: | 95 | case 24: |
992 | - tparam.ipc_url = "/data/share/data/146_187.mp4"; | 96 | + ipc_url = "/data/share/data/146_187.mp4"; |
993 | break; | 97 | break; |
994 | case 25: | 98 | case 25: |
995 | // 公安内网 | 99 | // 公安内网 |
996 | - tparam.ipc_url = "rtsp://192.168.51.200:8554/320202202308231001001002"; | 100 | + ipc_url = "rtsp://192.168.51.200:8554/320202202308231001001002"; |
997 | break; | 101 | break; |
998 | case 26: | 102 | case 26: |
999 | // FFmpeg生成的解码错误数据流 | 103 | // FFmpeg生成的解码错误数据流 |
1000 | - tparam.ipc_url = "rtsp://192.168.10.4:8554/street"; | 104 | + ipc_url = "rtsp://192.168.10.4:8554/street"; |
1001 | break; | 105 | break; |
1002 | case 27: | 106 | case 27: |
1003 | - tparam.ipc_url = "/data/share/data/Street_4k_265.mp4"; | 107 | + ipc_url = "/data/share/data/Street_4k_265.mp4"; |
1004 | break; | 108 | break; |
1005 | case 28: | 109 | case 28: |
1006 | - tparam.ipc_url = "http://192.168.60.179:10016/公安局老桥头_CVR15F89410_1465819864_1B.mp4"; | 110 | + ipc_url = "http://192.168.60.179:10016/公安局老桥头_CVR15F89410_1465819864_1B.mp4"; |
1007 | break; | 111 | break; |
1008 | case 29: | 112 | case 29: |
1009 | - tparam.ipc_url = "http://192.168.60.179:10016/不带头盔2.mp4"; | 113 | + ipc_url = "http://192.168.60.179:10016/不带头盔2.mp4"; |
1010 | break; | 114 | break; |
1011 | case 30: | 115 | case 30: |
1012 | - tparam.ipc_url = "/data/share/data/149_45.avi"; | 116 | + ipc_url = "/data/share/data/149_45.avi"; |
1013 | break; | 117 | break; |
1014 | case 31: | 118 | case 31: |
1015 | - tparam.ipc_url = "/data/share/data/146_88.avi"; | 119 | + ipc_url = "/data/share/data/146_88.avi"; |
1016 | break; | 120 | break; |
1017 | case 32: | 121 | case 32: |
1018 | - tparam.ipc_url = "/data/share/data/141_74.avi"; | 122 | + ipc_url = "/data/share/data/141_74.avi"; |
1019 | break; | 123 | break; |
1020 | default: | 124 | default: |
1021 | - tparam.ipc_url = "/opt/share/data/Street.uvf"; | 125 | + ipc_url = "/data/share/data/Street.uvf"; |
1022 | break; | 126 | break; |
1023 | } | 127 | } |
1024 | - | ||
1025 | - tparam.algor_counts = algor_vec.size(); | ||
1026 | - tparam.dec_type = 2; | ||
1027 | - | ||
1028 | - if (bFlag){ | ||
1029 | - nTaskId = gi; | ||
1030 | - } | ||
1031 | - | ||
1032 | - std::string task_id_str = "test_task_id_" + std::to_string(nTaskId); | ||
1033 | - tparam.task_id = task_id_str.c_str(); | ||
1034 | - | ||
1035 | - nTaskId++; | ||
1036 | - | ||
1037 | - tparam.algor_config_params = new algor_config_param[tparam.algor_counts]; | ||
1038 | - | ||
1039 | - for (size_t idx = 0; idx < algor_vec.size(); ++idx) | ||
1040 | - set_task_params(tparam, idx, algor_vec.at(idx)); | ||
1041 | - | ||
1042 | - const int result_code = add_task(handle, tparam); | ||
1043 | - if (result_code != 0) | ||
1044 | - printf("[Error]: "); | ||
1045 | - printf("--- task_id: %s result code: %d\n", tparam.task_id, result_code); | ||
1046 | - | ||
1047 | - | ||
1048 | - // 释放参数 | ||
1049 | - for (size_t idx = 0; idx < algor_vec.size(); ++idx) { | ||
1050 | - if(tparam.algor_config_params[idx].algor_type == algorithm_type_t::VIDEO_TIMING_SNAPSHOT) { | ||
1051 | - algor_config_param_road_work* algor_param = (algor_config_param_road_work*)tparam.algor_config_params[idx].algor_init_config_param->algor_param; | ||
1052 | - delete algor_param; | ||
1053 | - algor_basic_config_param_t* basic_param = (algor_basic_config_param_t*)tparam.algor_config_params[idx].algor_init_config_param->basic_param; | ||
1054 | - delete basic_param; | ||
1055 | - | ||
1056 | - algor_init_config_param_t* config_param = tparam.algor_config_params[idx].algor_init_config_param; | ||
1057 | - delete config_param; | ||
1058 | - } else if(tparam.algor_config_params[idx].algor_type == algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND) { | ||
1059 | - algor_config_param_manned_incident* algor_param = (algor_config_param_manned_incident*)tparam.algor_config_params[idx].algor_init_config_param->algor_param; | ||
1060 | - delete algor_param; | ||
1061 | - algor_basic_config_param_t* basic_param = (algor_basic_config_param_t*)tparam.algor_config_params[idx].algor_init_config_param->basic_param; | ||
1062 | - delete basic_param; | ||
1063 | - | ||
1064 | - algor_init_config_param_t* config_param = tparam.algor_config_params[idx].algor_init_config_param; | ||
1065 | - delete config_param; | ||
1066 | - }else if(tparam.algor_config_params[idx].algor_type == algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND) { | ||
1067 | - algor_config_param_manned_incident* algor_param = (algor_config_param_manned_incident*)tparam.algor_config_params[idx].algor_init_config_param->algor_param; | ||
1068 | - delete algor_param; | ||
1069 | - algor_basic_config_param_t* basic_param = (algor_basic_config_param_t*)tparam.algor_config_params[idx].algor_init_config_param->basic_param; | ||
1070 | - delete basic_param; | ||
1071 | - | ||
1072 | - algor_init_config_param_t* config_param = tparam.algor_config_params[idx].algor_init_config_param; | ||
1073 | - delete config_param; | ||
1074 | - } | ||
1075 | - } | ||
1076 | - delete[] tparam.algor_config_params; | ||
1077 | 128 | ||
1078 | - return task_id_str; | 129 | + return ipc_url; |
1079 | } | 130 | } |
1080 | 131 | ||
132 | +static int nTaskId = 0; | ||
1081 | 133 | ||
1082 | -string createTask_dvpp28181(void *handle, std::vector<algorithm_type_t> algor_vec, int gi, bool bFlag = true){ | 134 | +string createTask(void *handle, int gi, bool bFlag = true){ |
1083 | task_param tparam; | 135 | task_param tparam; |
1084 | 136 | ||
1085 | - switch(gi){ | ||
1086 | - case 0: | ||
1087 | - tparam.ipc_url = "34020000001310004065"; | ||
1088 | - break; | ||
1089 | - case 1: | ||
1090 | - tparam.ipc_url = "34020000001310000001"; | ||
1091 | - break; | ||
1092 | - case 2: | ||
1093 | - tparam.ipc_url = "34020000001320000166"; | ||
1094 | - break; | ||
1095 | - case 3: | ||
1096 | - tparam.ipc_url = "32120200002160000077"; | ||
1097 | - break; | ||
1098 | - case 4: | ||
1099 | - tparam.ipc_url = "34020000001320000207"; | ||
1100 | - break; | ||
1101 | - case 5: | ||
1102 | - tparam.ipc_url = "34020000001310000176"; | ||
1103 | - break; | ||
1104 | - default: | ||
1105 | - tparam.ipc_url = "34020000001310004065"; | ||
1106 | - break; | ||
1107 | - } | ||
1108 | - | ||
1109 | - tparam.algor_counts = algor_vec.size(); | ||
1110 | - tparam.dec_type = 3; | ||
1111 | - tparam.protocal = 0; | 137 | + tparam.ipc_url = get_ipc_url(gi); |
1112 | 138 | ||
1113 | if (bFlag){ | 139 | if (bFlag){ |
1114 | nTaskId = gi; | 140 | nTaskId = gi; |
1115 | } | 141 | } |
1116 | - | ||
1117 | std::string task_id_str = "test_task_id_" + std::to_string(nTaskId); | 142 | std::string task_id_str = "test_task_id_" + std::to_string(nTaskId); |
1118 | tparam.task_id = task_id_str.c_str(); | 143 | tparam.task_id = task_id_str.c_str(); |
1119 | - | ||
1120 | nTaskId++; | 144 | nTaskId++; |
1121 | 145 | ||
1122 | - tparam.algor_config_params = new algor_config_param[tparam.algor_counts]; | ||
1123 | - | ||
1124 | - for (size_t idx = 0; idx < algor_vec.size(); ++idx) | ||
1125 | - set_task_params(tparam, idx, algor_vec.at(idx)); | 146 | + tparam.result_folder_little = "./res"; //目标快照抠图保存地址 |
147 | + tparam.result_folder = "./res"; //目标快照大图保存地址 | ||
1126 | 148 | ||
1127 | const int result_code = add_task(handle, tparam); | 149 | const int result_code = add_task(handle, tparam); |
1128 | if (result_code != 0) | 150 | if (result_code != 0) |
1129 | printf("[Error]: "); | 151 | printf("[Error]: "); |
1130 | printf("--- task_id: %s result code: %d\n", tparam.task_id, result_code); | 152 | printf("--- task_id: %s result code: %d\n", tparam.task_id, result_code); |
1131 | 153 | ||
1132 | - | ||
1133 | - // 释放参数 | ||
1134 | - for (size_t idx = 0; idx < algor_vec.size(); ++idx) { | ||
1135 | - if(tparam.algor_config_params[idx].algor_type == algorithm_type_t::VIDEO_TIMING_SNAPSHOT) { | ||
1136 | - algor_config_param_road_work* algor_param = (algor_config_param_road_work*)tparam.algor_config_params[idx].algor_init_config_param->algor_param; | ||
1137 | - delete algor_param; | ||
1138 | - algor_basic_config_param_t* basic_param = (algor_basic_config_param_t*)tparam.algor_config_params[idx].algor_init_config_param->basic_param; | ||
1139 | - delete basic_param; | ||
1140 | - | ||
1141 | - algor_init_config_param_t* config_param = tparam.algor_config_params[idx].algor_init_config_param; | ||
1142 | - delete config_param; | ||
1143 | - } else if(tparam.algor_config_params[idx].algor_type == algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND) { | ||
1144 | - algor_config_param_manned_incident* algor_param = (algor_config_param_manned_incident*)tparam.algor_config_params[idx].algor_init_config_param->algor_param; | ||
1145 | - delete algor_param; | ||
1146 | - algor_basic_config_param_t* basic_param = (algor_basic_config_param_t*)tparam.algor_config_params[idx].algor_init_config_param->basic_param; | ||
1147 | - delete basic_param; | ||
1148 | - | ||
1149 | - algor_init_config_param_t* config_param = tparam.algor_config_params[idx].algor_init_config_param; | ||
1150 | - delete config_param; | ||
1151 | - } else if(tparam.algor_config_params[idx].algor_type == algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND) { | ||
1152 | - algor_config_param_manned_incident* algor_param = (algor_config_param_manned_incident*)tparam.algor_config_params[idx].algor_init_config_param->algor_param; | ||
1153 | - delete algor_param; | ||
1154 | - algor_basic_config_param_t* basic_param = (algor_basic_config_param_t*)tparam.algor_config_params[idx].algor_init_config_param->basic_param; | ||
1155 | - delete basic_param; | ||
1156 | - | ||
1157 | - algor_init_config_param_t* config_param = tparam.algor_config_params[idx].algor_init_config_param; | ||
1158 | - delete config_param; | ||
1159 | - } | ||
1160 | - } | ||
1161 | - delete[] tparam.algor_config_params; | ||
1162 | - | ||
1163 | return task_id_str; | 154 | return task_id_str; |
1164 | } | 155 | } |
1165 | 156 | ||
1166 | -void test_snapshot(void *handle){ | ||
1167 | - task_param tparam; | ||
1168 | - tparam.ipc_url = "rtsp://admin:ad123456@192.168.60.165:554/cam/realmonitor?channel=1&subtype=0"; | ||
1169 | - | ||
1170 | - tparam.algor_counts = 1; | ||
1171 | - tparam.dec_type = 2; | ||
1172 | 157 | ||
1173 | - std::string task_id_str = "test_task_id_default" ; | ||
1174 | - tparam.task_id = task_id_str.c_str(); | 158 | +// void test_snapshot(void *handle){ |
159 | +// task_param tparam; | ||
160 | +// tparam.ipc_url = "rtsp://admin:ad123456@192.168.60.165:554/cam/realmonitor?channel=1&subtype=0"; | ||
161 | +// std::string task_id_str = "test_task_id_default" ; | ||
162 | +// tparam.task_id = task_id_str.c_str(); | ||
1175 | 163 | ||
1176 | - tparam.algor_config_params = new algor_config_param[tparam.algor_counts]; | ||
1177 | 164 | ||
1178 | - set_task_params(tparam, 0, algorithm_type_t::VIDEO_SNAPSHOT); | ||
1179 | - | ||
1180 | - const int result_code = screenshot_task(handle, tparam); | ||
1181 | - if (result_code != 0) | ||
1182 | - printf("[Error]: "); | ||
1183 | - printf("--- task_id: %s result code: %d\n", tparam.task_id, result_code); | ||
1184 | -} | 165 | +// const int result_code = screenshot_task(handle, tparam); |
166 | +// if (result_code != 0) | ||
167 | +// printf("[Error]: "); | ||
168 | +// printf("--- task_id: %s result code: %d\n", tparam.task_id, result_code); | ||
169 | +// } | ||
1185 | 170 | ||
1186 | void test_gpu(int gpuID){ | 171 | void test_gpu(int gpuID){ |
1187 | tsl_aiplatform_param vptParam; | 172 | tsl_aiplatform_param vptParam; |
1188 | vptParam.gpuid = gpuID; | 173 | vptParam.gpuid = gpuID; |
1189 | - vptParam.trt_serialize_file = ""; | ||
1190 | vptParam.models_dir = "."; | 174 | vptParam.models_dir = "."; |
1191 | 175 | ||
1192 | vptParam.log_days = 1; | 176 | vptParam.log_days = 1; |
@@ -1204,46 +188,6 @@ void test_gpu(int gpuID){ | @@ -1204,46 +188,6 @@ void test_gpu(int gpuID){ | ||
1204 | printf("Init Success\n"); | 188 | printf("Init Success\n"); |
1205 | } | 189 | } |
1206 | 190 | ||
1207 | -#ifdef POST_USE_RABBITMQ | ||
1208 | - init_mq_conn(handle); | ||
1209 | -#endif // #ifdef POST_USE_RABBITMQ | ||
1210 | - | ||
1211 | - std::vector<algorithm_type_t> algor_vec = {algorithm_type_t::FACE_SNAPSHOT, algorithm_type_t::HUMAN_SNAPSHOT,algorithm_type_t::ROAD_WORK_DET, algorithm_type_t::PEDESTRIAN_RETROGRADE, algorithm_type_t::VEHICLE_RETROGRADE, | ||
1212 | - algorithm_type_t::PEDESTRIAN_TRESPASS, algorithm_type_t::VEHICLE_TRESPASS, algorithm_type_t::VEHICLE_SNAPSHOT, algorithm_type_t::NONMOTOR_VEHICLE_SNAPSHOT, algorithm_type_t::VIDEO_TIMING_SNAPSHOT | ||
1213 | - , algorithm_type_t::VIDEO_SNAPSHOT, algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN, algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::TRUCK_MANNED}; | ||
1214 | - | ||
1215 | - | ||
1216 | - 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, | ||
1217 | - 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, | ||
1218 | - 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, | ||
1219 | - algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND, algorithm_type_t::VEHICLE_NOTDECELERATION}; | ||
1220 | - // 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, | ||
1221 | - // algorithm_type_t::NONMOTOR_VEHICLE_REFIT, algorithm_type_t::PERSON_RUNNING_REDLIGHTS, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS}; | ||
1222 | - std::vector<algorithm_type_t> algor_vec3 = {algorithm_type_t::PERSON_CROSS, algorithm_type_t::NONMOTOR_WRONGDIRECTION, algorithm_type_t::VEHICLE_WRONGDIRECTION, algorithm_type_t::VEHICLE_NOTGIVEWAY, | ||
1223 | - algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND}; | ||
1224 | - | ||
1225 | - | ||
1226 | - // int repeat_num = 1000; | ||
1227 | - // createTask(handle, algor_vec2, 0, false); | ||
1228 | - // createTask(handle, algor_vec2, 2, false); | ||
1229 | - // while(repeat_num--) { | ||
1230 | - // printf("============================:%d\n",repeat_num); | ||
1231 | - // vector<string> task_ids; | ||
1232 | - // for (int i = 4; i < 10; i ++) { | ||
1233 | - // string task_id = createTask(handle, algor_vec2, i, false); | ||
1234 | - // task_ids.push_back(task_id); | ||
1235 | - // } | ||
1236 | - | ||
1237 | - // // test_snapshot(handle); | ||
1238 | - // sleep(60); //60s | ||
1239 | - // close_all_task(handle); | ||
1240 | - // for (auto& task_id : task_ids) { | ||
1241 | - // finish_task(handle, (char*)task_id.data(), 0); | ||
1242 | - // sleep(5); | ||
1243 | - // } | ||
1244 | - | ||
1245 | - // } | ||
1246 | - | ||
1247 | // createTask(handle, algor_vec2, 19, false); | 191 | // createTask(handle, algor_vec2, 19, false); |
1248 | // createTask(handle, algor_vec2, 20, false); | 192 | // createTask(handle, algor_vec2, 20, false); |
1249 | // createTask(handle, algor_vec2, 21, false); | 193 | // createTask(handle, algor_vec2, 21, false); |
@@ -1252,164 +196,13 @@ void test_gpu(int gpuID){ | @@ -1252,164 +196,13 @@ void test_gpu(int gpuID){ | ||
1252 | // createTask(handle, algor_vec2, 24, false); | 196 | // createTask(handle, algor_vec2, 24, false); |
1253 | // createTask(handle, algor_vec2, 30, false); | 197 | // createTask(handle, algor_vec2, 30, false); |
1254 | // createTask(handle, algor_vec2, 31, false); | 198 | // createTask(handle, algor_vec2, 31, false); |
1255 | - createTask(handle, algor_vec2, 32, false); | ||
1256 | - | ||
1257 | - // int task_index = 0; | ||
1258 | - // while (true) | ||
1259 | - // { | ||
1260 | - // int task_count = count_running_task(handle); | ||
1261 | - // if (task_count < 1) | ||
1262 | - // { | ||
1263 | - // // if (task_index > 7) | ||
1264 | - // // { | ||
1265 | - // // task_index = 0; | ||
1266 | - // // break; | ||
1267 | - // // } | ||
1268 | - | ||
1269 | - // createTask(handle, algor_vec2, 19, false); | ||
1270 | - // task_index++; | ||
1271 | - // // createTask(handle, algor_vec2, 29, false); | ||
1272 | - // // task_index++; | ||
1273 | - // } | ||
1274 | - | ||
1275 | - // std::this_thread::sleep_for(std::chrono::seconds(5)); | ||
1276 | - // } | ||
1277 | - | ||
1278 | - | ||
1279 | - | ||
1280 | - // char ch = 'a'; | ||
1281 | - // while (ch != 'q') { | ||
1282 | - // ch = getchar(); | ||
1283 | - // switch (ch) | ||
1284 | - // { | ||
1285 | - // case 'a': | ||
1286 | - // createTask(handle, algor_vec2, 28, false); | ||
1287 | - // break; | ||
1288 | - // case 'c': | ||
1289 | - // close_all_task(handle); | ||
1290 | - // break; | ||
1291 | - // default: | ||
1292 | - // break; | ||
1293 | - // } | ||
1294 | - | ||
1295 | - // } | ||
1296 | - | ||
1297 | - // finish_task(handle, (char*)task_id.data(), 0); | ||
1298 | - | ||
1299 | - // finish_task(handle, (char*)task_id1.data(), 0); | 199 | + createTask(handle, 4, false); |
1300 | 200 | ||
1301 | while (getchar() != 'q'); | 201 | while (getchar() != 'q'); |
1302 | 202 | ||
1303 | tsl_aiplatform_release(&handle); | 203 | tsl_aiplatform_release(&handle); |
1304 | } | 204 | } |
1305 | 205 | ||
1306 | -void test_dvpp28181(int gpuID) { | ||
1307 | - tsl_aiplatform_param vptParam; | ||
1308 | - vptParam.gpuid = gpuID; | ||
1309 | - vptParam.sip_server_port = 15080; | ||
1310 | - vptParam.trt_serialize_file = ""; | ||
1311 | - vptParam.models_dir = "."; | ||
1312 | - | ||
1313 | - vptParam.log_days = 1; | ||
1314 | - vptParam.log_level = AI_LOG_LEVEL_TRACE; | ||
1315 | - // vptParam.log_level = AI_LOG_LEVEL_DEBUG; | ||
1316 | - vptParam.log_mem = 64 * 1024 * 1024; // 64MB. | ||
1317 | - vptParam.log_path = "logs/main.log"; | ||
1318 | - | ||
1319 | - void *handle; | ||
1320 | - int flag = tsl_aiplatform_init(&handle, vptParam); | ||
1321 | - if (0 != flag) { | ||
1322 | - printf("Init Failed! Error Code: %d\n", flag); | ||
1323 | - return; | ||
1324 | - } else { | ||
1325 | - printf("Init Success\n"); | ||
1326 | - } | ||
1327 | - | ||
1328 | -#ifdef POST_USE_RABBITMQ | ||
1329 | -init_mq_conn(handle); | ||
1330 | -#endif // #ifdef POST_USE_RABBITMQ | ||
1331 | - | ||
1332 | - std::vector<algorithm_type_t> algor_vec = {algorithm_type_t::FACE_SNAPSHOT, algorithm_type_t::HUMAN_SNAPSHOT,algorithm_type_t::ROAD_WORK_DET, algorithm_type_t::PEDESTRIAN_RETROGRADE, algorithm_type_t::VEHICLE_RETROGRADE, | ||
1333 | - algorithm_type_t::PEDESTRIAN_TRESPASS, algorithm_type_t::VEHICLE_TRESPASS, algorithm_type_t::VEHICLE_SNAPSHOT, algorithm_type_t::NONMOTOR_VEHICLE_SNAPSHOT, algorithm_type_t::VIDEO_TIMING_SNAPSHOT | ||
1334 | - , algorithm_type_t::VIDEO_SNAPSHOT, algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET, algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN, algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::TRUCK_MANNED}; | ||
1335 | - | ||
1336 | - | ||
1337 | - 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, | ||
1338 | - 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, | ||
1339 | - 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, | ||
1340 | - algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND, algorithm_type_t::VEHICLE_NOTDECELERATION}; | ||
1341 | - // 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, | ||
1342 | - // algorithm_type_t::NONMOTOR_VEHICLE_REFIT, algorithm_type_t::PERSON_RUNNING_REDLIGHTS, algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS}; | ||
1343 | - std::vector<algorithm_type_t> algor_vec3 = {algorithm_type_t::PERSON_CROSS, algorithm_type_t::NONMOTOR_WRONGDIRECTION, algorithm_type_t::VEHICLE_WRONGDIRECTION, algorithm_type_t::VEHICLE_NOTGIVEWAY, | ||
1344 | - algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND}; | ||
1345 | - | ||
1346 | - | ||
1347 | - | ||
1348 | - int status = -1; | ||
1349 | - while (true) | ||
1350 | - { | ||
1351 | - status = get_task_status(handle,"34020000001320000207"); | ||
1352 | - if (status == 0) | ||
1353 | - { | ||
1354 | - createTask_dvpp28181(handle, algor_vec, 4, false); | ||
1355 | - } | ||
1356 | - | ||
1357 | - status = get_task_status(handle,"34020000001310000176"); | ||
1358 | - if (status == 0) | ||
1359 | - { | ||
1360 | - createTask_dvpp28181(handle, algor_vec, 5, false); | ||
1361 | - } | ||
1362 | - | ||
1363 | - std::this_thread::sleep_for(std::chrono::seconds(5)); | ||
1364 | - } | ||
1365 | - | ||
1366 | - | ||
1367 | - | ||
1368 | -char ch = 'a'; | ||
1369 | -while (ch != 'q') { | ||
1370 | - ch = getchar(); | ||
1371 | - switch (ch) | ||
1372 | - { | ||
1373 | - case '0': | ||
1374 | - createTask_dvpp28181(handle, algor_vec, 0, false); | ||
1375 | - break; | ||
1376 | - case '1': | ||
1377 | - createTask_dvpp28181(handle, algor_vec, 1, false); | ||
1378 | - break; | ||
1379 | - case '2': | ||
1380 | - createTask_dvpp28181(handle, algor_vec, 2, false); | ||
1381 | - break; | ||
1382 | - case '3': | ||
1383 | - createTask_dvpp28181(handle, algor_vec, 3, false); | ||
1384 | - break; | ||
1385 | - case '4': | ||
1386 | - createTask_dvpp28181(handle, algor_vec, 4, false); | ||
1387 | - break; | ||
1388 | - case '5': | ||
1389 | - createTask_dvpp28181(handle, algor_vec, 5, false); | ||
1390 | - break; | ||
1391 | - case '6': | ||
1392 | - createTask(handle, algor_vec2, 2, false); | ||
1393 | - break; | ||
1394 | - case '7': | ||
1395 | - createTask(handle, algor_vec2, 0, false); | ||
1396 | - break; | ||
1397 | - case 'c': | ||
1398 | - close_all_task(handle); | ||
1399 | - break; | ||
1400 | - default: | ||
1401 | - break; | ||
1402 | - } | ||
1403 | - | ||
1404 | -} | ||
1405 | - | ||
1406 | - // finish_task(handle, (char*)task_id.data(), 0); | ||
1407 | - | ||
1408 | - // finish_task(handle, (char*)task_id1.data(), 0); | ||
1409 | - | ||
1410 | - tsl_aiplatform_release(&handle); | ||
1411 | -} | ||
1412 | - | ||
1413 | int main(int argc, char *argv[]) { | 206 | int main(int argc, char *argv[]) { |
1414 | printf("new test\n"); | 207 | printf("new test\n"); |
1415 | 208 | ||
@@ -1429,7 +222,6 @@ int main(int argc, char *argv[]) { | @@ -1429,7 +222,6 @@ int main(int argc, char *argv[]) { | ||
1429 | // test_gpu(2); | 222 | // test_gpu(2); |
1430 | // test_gpu(3); | 223 | // test_gpu(3); |
1431 | 224 | ||
1432 | - // test_dvpp28181(0); | ||
1433 | 225 | ||
1434 | printf("Done.\n"); | 226 | printf("Done.\n"); |
1435 | 227 |
src/reprocessing_module/snapshot_reprocessing.cpp
@@ -110,6 +110,8 @@ void snapshot_reprocessing::update_bestsnapshot(vector<DeviceMemory*> vec_devMem | @@ -110,6 +110,8 @@ void snapshot_reprocessing::update_bestsnapshot(vector<DeviceMemory*> vec_devMem | ||
110 | continue; | 110 | continue; |
111 | } | 111 | } |
112 | 112 | ||
113 | + LOG_DEBUG("add task_id {} obj_id {}", task_id, obj_info.id); | ||
114 | + | ||
113 | /* 存入当前抠图目标参数 flags用于判断目标从画面什么位置出现 方便之后排除出画面边缘的快照图 */ | 115 | /* 存入当前抠图目标参数 flags用于判断目标从画面什么位置出现 方便之后排除出画面边缘的快照图 */ |
114 | total_snapshot_info[new_obj].index.count++; | 116 | total_snapshot_info[new_obj].index.count++; |
115 | total_snapshot_info[new_obj].index.index = cur_real_index; | 117 | total_snapshot_info[new_obj].index.index = cur_real_index; |
@@ -217,7 +219,7 @@ bool snapshot_reprocessing::best_snapshot_judge_algor(const OBJ_KEY& obj_key, co | @@ -217,7 +219,7 @@ bool snapshot_reprocessing::best_snapshot_judge_algor(const OBJ_KEY& obj_key, co | ||
217 | /* 删除指定快照 清空资源占用(使用场景:任务结束删除该路任务所有缓存快照;目标轨迹结束,分析保存完,删除该目标快照缓存)*/ | 219 | /* 删除指定快照 清空资源占用(使用场景:任务结束删除该路任务所有缓存快照;目标轨迹结束,分析保存完,删除该目标快照缓存)*/ |
218 | void snapshot_reprocessing::release_finished_locus_snapshot(const string taskid, const int obj_id, bool bRelease) | 220 | void snapshot_reprocessing::release_finished_locus_snapshot(const string taskid, const int obj_id, bool bRelease) |
219 | { | 221 | { |
220 | - LOG_DEBUG("[info] task_id {} delete obj_id {}", taskid, obj_id); //221026 | 222 | + LOG_DEBUG("task_id {} delete obj_id {}", taskid, obj_id); //221026 |
221 | if (obj_id != -1) | 223 | if (obj_id != -1) |
222 | { | 224 | { |
223 | OBJ_KEY cur_key = { taskid , obj_id }; | 225 | OBJ_KEY cur_key = { taskid , obj_id }; |
@@ -249,5 +251,4 @@ void snapshot_reprocessing::release_finished_locus_snapshot(const string taskid, | @@ -249,5 +251,4 @@ void snapshot_reprocessing::release_finished_locus_snapshot(const string taskid, | ||
249 | } | 251 | } |
250 | else ss++; | 252 | else ss++; |
251 | } | 253 | } |
252 | - return; | ||
253 | } | 254 | } |
254 | \ No newline at end of file | 255 | \ No newline at end of file |
src/util/vpc_util.cpp
@@ -18,6 +18,13 @@ | @@ -18,6 +18,13 @@ | ||
18 | #include "../decoder/interface/DeviceMemory.hpp" | 18 | #include "../decoder/interface/DeviceMemory.hpp" |
19 | #include "../common/logger.hpp" | 19 | #include "../common/logger.hpp" |
20 | 20 | ||
21 | +#define ALIGN_UP(num, align) (((num) + (align) - 1) & ~((align) - 1)) | ||
22 | +#define ALIGN_UP2(num) ALIGN_UP(num, 2) | ||
23 | +#define ALIGN_UP16(num) ALIGN_UP(num, 16) | ||
24 | +#define ALIGN_UP64(num) ALIGN_UP(num, 64) //230316added | ||
25 | +#define ALIGN_UP128(num) ALIGN_UP(num, 128) | ||
26 | + | ||
27 | + | ||
21 | static uint32_t AlignSize(uint32_t origSize, uint32_t alignment){ | 28 | static uint32_t AlignSize(uint32_t origSize, uint32_t alignment){ |
22 | if (alignment == 0) { | 29 | if (alignment == 0) { |
23 | return 0; | 30 | return 0; |
@@ -35,6 +42,10 @@ void VPCUtil::release() | @@ -35,6 +42,10 @@ void VPCUtil::release() | ||
35 | ret = acldvppDestroyChannel(dvppChannelDesc_); | 42 | ret = acldvppDestroyChannel(dvppChannelDesc_); |
36 | ret = acldvppDestroyChannelDesc(dvppChannelDesc_); | 43 | ret = acldvppDestroyChannelDesc(dvppChannelDesc_); |
37 | 44 | ||
45 | + if (stream_ != nullptr) { | ||
46 | + aclrtDestroyStream(stream_); | ||
47 | + } | ||
48 | + | ||
38 | if (context_ != nullptr) { | 49 | if (context_ != nullptr) { |
39 | ret = aclrtDestroyContext(context_); | 50 | ret = aclrtDestroyContext(context_); |
40 | if (ret != ACL_SUCCESS) { | 51 | if (ret != ACL_SUCCESS) { |
@@ -141,8 +152,6 @@ vpc_img_info VPCUtil::crop(DeviceMemory *devMem, video_object_info obj) { | @@ -141,8 +152,6 @@ vpc_img_info VPCUtil::crop(DeviceMemory *devMem, video_object_info obj) { | ||
141 | acldvppSetPicDescHeightStride(vpcOutputDesc_, cropSizeHeight); | 152 | acldvppSetPicDescHeightStride(vpcOutputDesc_, cropSizeHeight); |
142 | acldvppSetPicDescSize(vpcOutputDesc_, vpcOutBufferSize_); | 153 | acldvppSetPicDescSize(vpcOutputDesc_, vpcOutBufferSize_); |
143 | 154 | ||
144 | - aclrtStream stream_; | ||
145 | - aclrtCreateStream(&stream_); | ||
146 | bool bRet = false; | 155 | bool bRet = false; |
147 | do | 156 | do |
148 | { | 157 | { |
@@ -166,10 +175,6 @@ vpc_img_info VPCUtil::crop(DeviceMemory *devMem, video_object_info obj) { | @@ -166,10 +175,6 @@ vpc_img_info VPCUtil::crop(DeviceMemory *devMem, video_object_info obj) { | ||
166 | 175 | ||
167 | bRet = true; | 176 | bRet = true; |
168 | } while (0); | 177 | } while (0); |
169 | - | ||
170 | - if (stream_ != nullptr) { | ||
171 | - aclrtDestroyStream(stream_); | ||
172 | - } | ||
173 | 178 | ||
174 | acldvppDestroyPicDesc(vpcInputDesc_); | 179 | acldvppDestroyPicDesc(vpcInputDesc_); |
175 | 180 | ||
@@ -197,6 +202,8 @@ int VPCUtil::init(int32_t devId){ | @@ -197,6 +202,8 @@ int VPCUtil::init(int32_t devId){ | ||
197 | aclrtSetDevice(deviceId_); | 202 | aclrtSetDevice(deviceId_); |
198 | aclrtCreateContext(&context_, deviceId_); | 203 | aclrtCreateContext(&context_, deviceId_); |
199 | 204 | ||
205 | + aclrtCreateStream(&stream_); | ||
206 | + | ||
200 | // channel 准备 | 207 | // channel 准备 |
201 | dvppChannelDesc_ = acldvppCreateChannelDesc(); | 208 | dvppChannelDesc_ = acldvppCreateChannelDesc(); |
202 | ret = acldvppCreateChannel(dvppChannelDesc_); | 209 | ret = acldvppCreateChannel(dvppChannelDesc_); |
@@ -218,7 +225,6 @@ vector<vpc_img_info> VPCUtil::crop_batch(DeviceMemory *devMem, vector<video_obje | @@ -218,7 +225,6 @@ vector<vpc_img_info> VPCUtil::crop_batch(DeviceMemory *devMem, vector<video_obje | ||
218 | } | 225 | } |
219 | 226 | ||
220 | aclError ret; | 227 | aclError ret; |
221 | - aclrtSetDevice(deviceId_); | ||
222 | ret = aclrtSetCurrentContext(context_); | 228 | ret = aclrtSetCurrentContext(context_); |
223 | 229 | ||
224 | // 输入 | 230 | // 输入 |
@@ -282,7 +288,7 @@ vector<vpc_img_info> VPCUtil::crop_batch(DeviceMemory *devMem, vector<video_obje | @@ -282,7 +288,7 @@ vector<vpc_img_info> VPCUtil::crop_batch(DeviceMemory *devMem, vector<video_obje | ||
282 | 288 | ||
283 | cropAreas[i] = acldvppCreateRoiConfig(cropLeftOffset, cropRightOffset, cropTopOffset, cropBottomOffset); | 289 | cropAreas[i] = acldvppCreateRoiConfig(cropLeftOffset, cropRightOffset, cropTopOffset, cropBottomOffset); |
284 | 290 | ||
285 | - uint32_t vpcOutBufferSize_ = cropSizeWidth * cropSizeHeight * 3 / 2; | 291 | + uint32_t vpcOutBufferSize_ = ALIGN_UP64(cropSizeWidth) * ALIGN_UP16(cropSizeHeight) * 3 / 2; |
286 | void *vpcBatchOutputBufferDev = nullptr; | 292 | void *vpcBatchOutputBufferDev = nullptr; |
287 | auto ret = acldvppMalloc(&vpcBatchOutputBufferDev, vpcOutBufferSize_); | 293 | auto ret = acldvppMalloc(&vpcBatchOutputBufferDev, vpcOutBufferSize_); |
288 | if (ret != ACL_SUCCESS) { | 294 | if (ret != ACL_SUCCESS) { |
@@ -299,20 +305,18 @@ vector<vpc_img_info> VPCUtil::crop_batch(DeviceMemory *devMem, vector<video_obje | @@ -299,20 +305,18 @@ vector<vpc_img_info> VPCUtil::crop_batch(DeviceMemory *devMem, vector<video_obje | ||
299 | } | 305 | } |
300 | return vec_img_info; | 306 | return vec_img_info; |
301 | } | 307 | } |
308 | + | ||
302 | vecOutPtr_.push_back(vpcBatchOutputBufferDev); | 309 | vecOutPtr_.push_back(vpcBatchOutputBufferDev); |
303 | vpcOutputDesc = acldvppGetPicDesc(outputBatchPicDesc_, i); | 310 | vpcOutputDesc = acldvppGetPicDesc(outputBatchPicDesc_, i); |
304 | (void)acldvppSetPicDescData(vpcOutputDesc, vpcBatchOutputBufferDev); | 311 | (void)acldvppSetPicDescData(vpcOutputDesc, vpcBatchOutputBufferDev); |
305 | (void)acldvppSetPicDescFormat(vpcOutputDesc, PIXEL_FORMAT_YUV_SEMIPLANAR_420); | 312 | (void)acldvppSetPicDescFormat(vpcOutputDesc, PIXEL_FORMAT_YUV_SEMIPLANAR_420); |
306 | (void)acldvppSetPicDescWidth(vpcOutputDesc, cropSizeWidth); | 313 | (void)acldvppSetPicDescWidth(vpcOutputDesc, cropSizeWidth); |
307 | (void)acldvppSetPicDescHeight(vpcOutputDesc, cropSizeHeight); | 314 | (void)acldvppSetPicDescHeight(vpcOutputDesc, cropSizeHeight); |
308 | - (void)acldvppSetPicDescWidthStride(vpcOutputDesc, cropSizeWidth); | ||
309 | - (void)acldvppSetPicDescHeightStride(vpcOutputDesc, cropSizeHeight); | 315 | + (void)acldvppSetPicDescWidthStride(vpcOutputDesc, ALIGN_UP64(cropSizeWidth)); |
316 | + (void)acldvppSetPicDescHeightStride(vpcOutputDesc, ALIGN_UP16(cropSizeHeight)); | ||
310 | (void)acldvppSetPicDescSize(vpcOutputDesc, vpcOutBufferSize_); | 317 | (void)acldvppSetPicDescSize(vpcOutputDesc, vpcOutBufferSize_); |
311 | } | 318 | } |
312 | 319 | ||
313 | - aclrtStream stream_; | ||
314 | - aclrtCreateStream(&stream_); | ||
315 | - | ||
316 | bool bRet = false; | 320 | bool bRet = false; |
317 | do { | 321 | do { |
318 | uint32_t roiNums[] = { outputBatchSize_ }; | 322 | uint32_t roiNums[] = { outputBatchSize_ }; |
@@ -364,12 +368,6 @@ vector<vpc_img_info> VPCUtil::crop_batch(DeviceMemory *devMem, vector<video_obje | @@ -364,12 +368,6 @@ vector<vpc_img_info> VPCUtil::crop_batch(DeviceMemory *devMem, vector<video_obje | ||
364 | 368 | ||
365 | bRet = true; | 369 | bRet = true; |
366 | } while (0); | 370 | } while (0); |
367 | - | ||
368 | - if (stream_ != nullptr) { | ||
369 | - aclrtDestroyStream(stream_); | ||
370 | - } | ||
371 | - | ||
372 | - aclrtSetCurrentContext(context_); | ||
373 | 371 | ||
374 | if (vpcInputBatchDesc_ != nullptr) { | 372 | if (vpcInputBatchDesc_ != nullptr) { |
375 | (void)acldvppDestroyBatchPicDesc(vpcInputBatchDesc_); | 373 | (void)acldvppDestroyBatchPicDesc(vpcInputBatchDesc_); |
@@ -452,6 +450,7 @@ void VPCUtil::vpc_img_release(vpc_img_info img_info){ | @@ -452,6 +450,7 @@ void VPCUtil::vpc_img_release(vpc_img_info img_info){ | ||
452 | void *outputDataDev = acldvppGetPicDescData(img_info.pic_desc); | 450 | void *outputDataDev = acldvppGetPicDescData(img_info.pic_desc); |
453 | acldvppFree(outputDataDev); | 451 | acldvppFree(outputDataDev); |
454 | acldvppDestroyPicDesc(img_info.pic_desc); | 452 | acldvppDestroyPicDesc(img_info.pic_desc); |
453 | + img_info.pic_desc = nullptr; | ||
455 | } | 454 | } |
456 | } | 455 | } |
457 | 456 |
src/util/vpc_util.h
@@ -57,7 +57,8 @@ public: | @@ -57,7 +57,8 @@ public: | ||
57 | 57 | ||
58 | private: | 58 | private: |
59 | int32_t deviceId_; | 59 | int32_t deviceId_; |
60 | - aclrtContext context_; | 60 | + aclrtContext context_ {nullptr}; |
61 | + aclrtStream stream_ {nullptr}; | ||
61 | 62 | ||
62 | acldvppChannelDesc *dvppChannelDesc_; | 63 | acldvppChannelDesc *dvppChannelDesc_; |
63 | }; | 64 | }; |