Commit 193bf0d843f5928668ac7a7874e29158a8314859
Merge branch 'master' into dev-cmhu
Showing
18 changed files
with
347 additions
and
65 deletions
3rdparty/atlas_lic-aarch64-20220112/atlas_lic/demo/main.cpp
0 → 100644
1 | +// | ||
2 | +// Created by Administrator on 2021-12-29. | ||
3 | +// | ||
4 | + | ||
5 | +#include <stdio.h> | ||
6 | +#include <iostream> | ||
7 | +#include <cstring> | ||
8 | +#include <unistd.h> | ||
9 | +#include "../src/atlas_licence.h" | ||
10 | + | ||
11 | +int main() { | ||
12 | + | ||
13 | + for (int i = 0; i <10 ; ++i) { | ||
14 | + const char *token_password = "shiyu2018"; | ||
15 | + std::string guid = std::string("ae454e83af41ac8eff3e9f6f")+std::to_string(i); | ||
16 | + void *skt_handle = NULL; | ||
17 | + atlas_licence_param param; | ||
18 | + memset(¶m, 0, sizeof(atlas_licence_param)); | ||
19 | + sprintf(param.product_id, "%s", "68B0B0EBB33C4359BE226543F2DBB653"); | ||
20 | + sprintf(param.guid, "%s",guid.c_str()); | ||
21 | + sprintf(param.token_pwd, "%s", token_password); | ||
22 | + param.channel_num = 2; | ||
23 | + atlas_licence_token param_token; | ||
24 | + memset(¶m_token, 0, sizeof(atlas_licence_token)); | ||
25 | + | ||
26 | + int result = atlas_licence_connect(&skt_handle, param, ¶m_token); | ||
27 | + printf("result:%d,code:%d,msg:%s \n", result, param_token.code, param_token.msg); | ||
28 | + printf("token:%s\n", param_token.token); | ||
29 | + std::string recv_token = std::string(param_token.token); | ||
30 | + | ||
31 | + atlas_licence_check_result check_result; | ||
32 | + memset(&check_result, 0, sizeof(atlas_licence_check_result)); | ||
33 | + | ||
34 | + atlas_licence_check_param check_param; | ||
35 | + memset(&check_param, 0, sizeof(atlas_licence_check_param)); | ||
36 | + sprintf(check_param.token_pwd, "%s", token_password); | ||
37 | + sprintf(check_param.time, "%s", "2022-01-10 20:00:00"); | ||
38 | + sprintf(check_param.token, "%s", recv_token.c_str()); | ||
39 | + check_param.consume = 2; | ||
40 | + atlas_licence_check(skt_handle, check_param, &check_result); | ||
41 | + std::cout << "code:" << check_result.code << ",msg:" << check_result.msg << std::endl; | ||
42 | + | ||
43 | + atlas_licence_close(&skt_handle); | ||
44 | + | ||
45 | + usleep(1000*1000); | ||
46 | + } | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + return 0; | ||
51 | +} | ||
52 | + |
3rdparty/atlas_lic-aarch64-20220112/atlas_lic/include/atlas_licence.h
0 → 100644
1 | +#ifndef ATLASLIC_ATLAS_LICENCE_H | ||
2 | +#define ATLASLIC_ATLAS_LICENCE_H | ||
3 | + | ||
4 | + | ||
5 | +#ifdef _MSC_VER | ||
6 | +#ifdef ATLAS_LICENCE_EXPORTS | ||
7 | +#define ATLAS_LICENCE_API __declspec(dllexport) | ||
8 | +#else | ||
9 | +#define ATLAS_LICENCE_API __declspec(dllimport) | ||
10 | +#endif | ||
11 | +#else | ||
12 | +#define ATLAS_LICENCE_API __attribute__ ((visibility ("default"))) | ||
13 | +#endif | ||
14 | + | ||
15 | +#define STATUS_SUCCESS 0 /* Success */ | ||
16 | +#define STATUS_ERROR -1 /* Generic error */ | ||
17 | + | ||
18 | +#ifndef __ATLAS_LICENCE_PARAM__ | ||
19 | +#define __ATLAS_LICENCE_PARAM__ | ||
20 | +#define MAX_LENGTH 128 | ||
21 | + | ||
22 | +typedef struct atlas_licence_param { | ||
23 | + char product_id[MAX_LENGTH]; | ||
24 | + char guid[MAX_LENGTH]; | ||
25 | + char token_pwd[MAX_LENGTH]; | ||
26 | + int channel_num; | ||
27 | +} atlas_licence_param; | ||
28 | + | ||
29 | +typedef struct atlas_licence_token { | ||
30 | + int code; | ||
31 | + char msg[MAX_LENGTH]; | ||
32 | + char token[2048]; | ||
33 | +} atlas_licence_token; | ||
34 | + | ||
35 | + | ||
36 | +typedef struct atlas_licence_check_param { | ||
37 | + char token[2048]; | ||
38 | + char token_pwd[MAX_LENGTH]; | ||
39 | + char time[MAX_LENGTH]; | ||
40 | + int consume; | ||
41 | +} atlas_licence_check_param; | ||
42 | + | ||
43 | +typedef struct atlas_licence_check_result{ | ||
44 | + int code; | ||
45 | + char msg[MAX_LENGTH]; | ||
46 | +}atlas_licence_check_result; | ||
47 | + | ||
48 | + | ||
49 | +#endif | ||
50 | + | ||
51 | +extern "C" | ||
52 | +{ | ||
53 | +/************************************************************************* | ||
54 | +* FUNCTION: atlas_licence_init | ||
55 | +* PURPOSE: 打开连接 | ||
56 | +* PARAM: | ||
57 | +[out] skt_handle - 句柄 | ||
58 | +[in] param - 初始化参数 | ||
59 | +* RETURN: | ||
60 | +[out] int - 初始化是否成功0表示成功,-1表示失败 | ||
61 | +* NOTES: | ||
62 | +*************************************************************************/ | ||
63 | +ATLAS_LICENCE_API int atlas_licence_connect(void **skt_handle, atlas_licence_param param, atlas_licence_token *param_token); | ||
64 | + | ||
65 | +/************************************************************************* | ||
66 | +* FUNCTION: atlas_licence_check | ||
67 | +* PURPOSE: 验证 | ||
68 | +* PARAM: | ||
69 | +[in] skt_handle - 句柄 | ||
70 | +[in] token - token | ||
71 | +[in] time - 时间 | ||
72 | +[in] consume - 消费数 | ||
73 | +[out] result - 校验结果 | ||
74 | +* RETURN: | ||
75 | +[out] int - 是否成功0表示成功,-1表示失败 | ||
76 | +* NOTES: | ||
77 | +*************************************************************************/ | ||
78 | +ATLAS_LICENCE_API int atlas_licence_check(void *skt_handle, atlas_licence_check_param check_param, atlas_licence_check_result *result); | ||
79 | + | ||
80 | +/************************************************************************* | ||
81 | +* FUNCTION: atlas_licence_close | ||
82 | +* PURPOSE: 关闭连接 | ||
83 | +* PARAM: | ||
84 | +[in] skt_handle - 句柄 | ||
85 | +* RETURN: | ||
86 | +[out] int - 是否成功0表示成功,-1表示失败 | ||
87 | +* NOTES: | ||
88 | +*************************************************************************/ | ||
89 | +ATLAS_LICENCE_API int atlas_licence_close(void **skt_handle); | ||
90 | +} | ||
91 | + | ||
92 | +#endif //ATLASLIC_ATLAS_LICENCE_H |
3rdparty/atlas_lic-aarch64-20220112/atlas_lic/lib/libatlaslic.so
0 → 100644
No preview for this file type
3rdparty/atlas_lic-aarch64-20220112/atlas_lic/lib/libatlaslic_static.a
0 → 100644
No preview for this file type
3rdparty/spdlog-1.9.2/CMakeLists.txt
@@ -48,7 +48,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR CMAKE_SYSTEM_NAME MATCHES "MSYS") | @@ -48,7 +48,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR CMAKE_SYSTEM_NAME MATCHES "MSYS") | ||
48 | set(CMAKE_CXX_EXTENSIONS ON) | 48 | set(CMAKE_CXX_EXTENSIONS ON) |
49 | endif() | 49 | endif() |
50 | 50 | ||
51 | -add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) | 51 | +add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) |
52 | # --------------------------------------------------------------------------------------- | 52 | # --------------------------------------------------------------------------------------- |
53 | # Set SPDLOG_MASTER_PROJECT to ON if we are building spdlog | 53 | # Set SPDLOG_MASTER_PROJECT to ON if we are building spdlog |
54 | # --------------------------------------------------------------------------------------- | 54 | # --------------------------------------------------------------------------------------- |
bin/libSYTSLSystemInfoNativeJNI.so
No preview for this file type
bin/libatlaslic.so
0 → 100644
No preview for this file type
src/Makefile
@@ -14,8 +14,10 @@ OPENCV_ROOT = $(THIRDPARTY_ROOT)/opencv_4_1 | @@ -14,8 +14,10 @@ OPENCV_ROOT = $(THIRDPARTY_ROOT)/opencv_4_1 | ||
14 | JSON_ROOT = $(THIRDPARTY_ROOT)/jsoncpp-1.9.5/release | 14 | JSON_ROOT = $(THIRDPARTY_ROOT)/jsoncpp-1.9.5/release |
15 | FFMPEG_ROOT = $(THIRDPARTY_ROOT)/ffmpeg-4.4.4/release | 15 | FFMPEG_ROOT = $(THIRDPARTY_ROOT)/ffmpeg-4.4.4/release |
16 | RABBITMQ_CLIENT_ROOT = $(THIRDPARTY_ROOT)/rabbitmq-c-0.11.0/release | 16 | RABBITMQ_CLIENT_ROOT = $(THIRDPARTY_ROOT)/rabbitmq-c-0.11.0/release |
17 | +AUTHORITY_DIR = $(THIRDPARTY_ROOT)/atlas_lic-aarch64-20220112/atlas_lic | ||
17 | 18 | ||
18 | DEFS = -DENABLE_DVPP_INTERFACE -DWITH_FACE_DET_SS -DPOST_USE_RABBITMQ -DUSE_VILLAGE | 19 | DEFS = -DENABLE_DVPP_INTERFACE -DWITH_FACE_DET_SS -DPOST_USE_RABBITMQ -DUSE_VILLAGE |
20 | +# DEFS = -DENABLE_DVPP_INTERFACE -DWITH_FACE_DET_SS -DPOST_USE_RABBITMQ | ||
19 | 21 | ||
20 | include_dir=-I/usr/local/Ascend/ascend-toolkit/6.3.RC1/aarch64-linux/include \ | 22 | include_dir=-I/usr/local/Ascend/ascend-toolkit/6.3.RC1/aarch64-linux/include \ |
21 | -I $(SPDLOG_ROOT)/include \ | 23 | -I $(SPDLOG_ROOT)/include \ |
@@ -24,6 +26,7 @@ include_dir=-I/usr/local/Ascend/ascend-toolkit/6.3.RC1/aarch64-linux/include \ | @@ -24,6 +26,7 @@ include_dir=-I/usr/local/Ascend/ascend-toolkit/6.3.RC1/aarch64-linux/include \ | ||
24 | -I $(JSON_ROOT)/include \ | 26 | -I $(JSON_ROOT)/include \ |
25 | -I $(FFMPEG_ROOT)/include \ | 27 | -I $(FFMPEG_ROOT)/include \ |
26 | -I $(RABBITMQ_CLIENT_ROOT)/include \ | 28 | -I $(RABBITMQ_CLIENT_ROOT)/include \ |
29 | + -I $(AUTHORITY_DIR)/include \ | ||
27 | 30 | ||
28 | lib_dir=-L/usr/local/Ascend/ascend-toolkit/6.3.RC1/runtime/lib64 \ | 31 | lib_dir=-L/usr/local/Ascend/ascend-toolkit/6.3.RC1/runtime/lib64 \ |
29 | -L/usr/local/Ascend/ascend-toolkit/latest/lib64 \ | 32 | -L/usr/local/Ascend/ascend-toolkit/latest/lib64 \ |
@@ -40,6 +43,7 @@ LIBS= -L $(SPDLOG_ROOT)/lib -l:libspdlog.a \ | @@ -40,6 +43,7 @@ LIBS= -L $(SPDLOG_ROOT)/lib -l:libspdlog.a \ | ||
40 | -L $(JSON_ROOT)/lib -ljsoncpp \ | 43 | -L $(JSON_ROOT)/lib -ljsoncpp \ |
41 | -L $(FFMPEG_ROOT)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \ | 44 | -L $(FFMPEG_ROOT)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \ |
42 | -L $(RABBITMQ_CLIENT_ROOT)/lib/aarch64-linux-gnu -lrabbitmq \ | 45 | -L $(RABBITMQ_CLIENT_ROOT)/lib/aarch64-linux-gnu -lrabbitmq \ |
46 | + -L $(AUTHORITY_DIR)/lib -latlaslic \ | ||
43 | 47 | ||
44 | CXXFLAGS= -g -O0 -fPIC $(include_dir) $(lib_dir) $(lib) $(LIBS) $(DEFS) -lpthread -lrt -lz -fexceptions -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -fvisibility=hidden -Wall -Wno-deprecated -Wdeprecated-declarations -Wl,-Bsymbolic -ldl | 48 | CXXFLAGS= -g -O0 -fPIC $(include_dir) $(lib_dir) $(lib) $(LIBS) $(DEFS) -lpthread -lrt -lz -fexceptions -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -fvisibility=hidden -Wall -Wno-deprecated -Wdeprecated-declarations -Wl,-Bsymbolic -ldl |
45 | 49 |
src/ai_engine_module/pedestrian_vehicle_retrograde.cpp
@@ -395,4 +395,4 @@ bool PedestrianVehicleRetrograde::update_mstreams(const std::vector<task_id_t> & | @@ -395,4 +395,4 @@ bool PedestrianVehicleRetrograde::update_mstreams(const std::vector<task_id_t> & | ||
395 | } | 395 | } |
396 | 396 | ||
397 | } // namespace pedestrian_vehicle_retrograde | 397 | } // namespace pedestrian_vehicle_retrograde |
398 | -} // namespace ai_engine_module | 398 | -} // namespace ai_engine_module |
399 | +} // namespace ai_engine_module | ||
399 | \ No newline at end of file | 400 | \ No newline at end of file |
src/ai_platform/MultiSourceProcess.cpp
@@ -26,6 +26,8 @@ | @@ -26,6 +26,8 @@ | ||
26 | 26 | ||
27 | #define WITH_FACE_DET_SS | 27 | #define WITH_FACE_DET_SS |
28 | 28 | ||
29 | +#define productSN "51C4B28135604F649671727185949A91" //linux 通途抓拍引擎产品序列号 | ||
30 | + | ||
29 | using namespace std; | 31 | using namespace std; |
30 | 32 | ||
31 | map<int, algo_type> index_to_algo_type = {{0, algorithm_type_t::HUMAN_SNAPSHOT}, | 33 | map<int, algo_type> index_to_algo_type = {{0, algorithm_type_t::HUMAN_SNAPSHOT}, |
@@ -82,10 +84,59 @@ CMultiSourceProcess::~CMultiSourceProcess(){ | @@ -82,10 +84,59 @@ CMultiSourceProcess::~CMultiSourceProcess(){ | ||
82 | } | 84 | } |
83 | 85 | ||
84 | int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ | 86 | int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ |
87 | +#ifdef USE_VILLAGE | ||
85 | if (!CheckTime()) { | 88 | if (!CheckTime()) { |
89 | + std::cout << "sy_licence_check failed." << std::endl; | ||
86 | return AUTHOR_ERROR; | 90 | return AUTHOR_ERROR; |
87 | } | 91 | } |
88 | - | 92 | +#else |
93 | + //授权相关------------------------------------ | ||
94 | + //授权init----------- | ||
95 | + const char *token_password = "Capture_atlas_arm_2023"; | ||
96 | + std::string guid = std::string("Capture_atlas_arm")+std::to_string(vptParam.gpuid); | ||
97 | + atlas_licence_param lic_param; | ||
98 | + memset(&lic_param, 0, sizeof(atlas_licence_param)); | ||
99 | + sprintf(lic_param.product_id, "%s", productSN); | ||
100 | + sprintf(lic_param.guid, "%s",guid.c_str()); | ||
101 | + sprintf(lic_param.token_pwd, "%s", token_password); | ||
102 | + lic_param.channel_num = 1; | ||
103 | + atlas_licence_token param_token; | ||
104 | + memset(¶m_token, 0, sizeof(atlas_licence_token)); | ||
105 | + | ||
106 | + int result = atlas_licence_connect(&(skt_handle), lic_param, ¶m_token); | ||
107 | + //printf("result:%d,code:%d,msg:%s \n", result, param_token.code, param_token.msg); | ||
108 | + //printf("token:%s\n", param_token.token); | ||
109 | + std::string recv_token = std::string(param_token.token); | ||
110 | + | ||
111 | + //atlas_licence_check_param check_param; | ||
112 | + memset(&(check_param), 0, sizeof(atlas_licence_check_param)); | ||
113 | + sprintf(check_param.token_pwd, "%s", token_password); | ||
114 | + sprintf(check_param.time, "%s", "2023-01-10 20:00:00"); | ||
115 | + sprintf(check_param.token, "%s", recv_token .c_str()); | ||
116 | + check_param.consume = 2; | ||
117 | + | ||
118 | + //授权check------------ | ||
119 | + check_label = -1;//初始值 | ||
120 | + std::cout << "sy_licence_check start." << std::endl; | ||
121 | + atlas_licence_check_result check_result; | ||
122 | + memset(&check_result, 0, sizeof(atlas_licence_check_result)); | ||
123 | + check_result.code = -1; | ||
124 | + | ||
125 | + int res = atlas_licence_check(skt_handle, check_param, &check_result); | ||
126 | + if(res!=0) { | ||
127 | + std::cout << "sy_licence_check failed." << std::endl; | ||
128 | + return AUTHOR_ERROR; | ||
129 | + } | ||
130 | + //std::cout << "code:" << check_result.code << ",msg:" << check_result.msg << std::endl; | ||
131 | + if(check_result.code!=0) { | ||
132 | + std::cout << "code:" << check_result.code << ",msg:" << check_result.msg << std::endl; | ||
133 | + return AUTHOR_ERROR; | ||
134 | + } | ||
135 | + std::cout << "sy_licence_check end." << std::endl; | ||
136 | + | ||
137 | + check_label = 0;//授权成功 | ||
138 | + //授权相关------------------------------------ | ||
139 | +#endif | ||
89 | set_default_logger(LogLevel(vptParam.log_level), "multi_source_process", vptParam.log_path, vptParam.log_mem, vptParam.log_mem); | 140 | set_default_logger(LogLevel(vptParam.log_level), "multi_source_process", vptParam.log_path, vptParam.log_mem, vptParam.log_mem); |
90 | LOG_INFO("编译时间:{} {}", __DATE__, __TIME__); | 141 | LOG_INFO("编译时间:{} {}", __DATE__, __TIME__); |
91 | 142 | ||
@@ -111,23 +162,23 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ | @@ -111,23 +162,23 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ | ||
111 | return ret; | 162 | return ret; |
112 | } | 163 | } |
113 | 164 | ||
165 | +#ifdef USE_VILLAGE | ||
114 | //三轮车头肩检测 | 166 | //三轮车头肩检测 |
115 | if (!tricycle_manned_.init(vptParam.gpuid, models_dir)) { | 167 | if (!tricycle_manned_.init(vptParam.gpuid, models_dir)) { |
116 | LOG_FATAL("Init tricycle_hs failed"); | 168 | LOG_FATAL("Init tricycle_hs failed"); |
117 | return -1; | 169 | return -1; |
118 | } | 170 | } |
119 | - | ||
120 | //货车头肩检测 | 171 | //货车头肩检测 |
121 | if (!truck_manned_.init(vptParam.gpuid, models_dir)) { | 172 | if (!truck_manned_.init(vptParam.gpuid, models_dir)) { |
122 | LOG_FATAL("Init truck_hs failed"); | 173 | LOG_FATAL("Init truck_hs failed"); |
123 | return -1; | 174 | return -1; |
124 | } | 175 | } |
125 | - | ||
126 | //二轮车头肩检测 | 176 | //二轮车头肩检测 |
127 | if (!motor_hsprocess_.init(vptParam.gpuid, models_dir)) { | 177 | if (!motor_hsprocess_.init(vptParam.gpuid, models_dir)) { |
128 | LOG_FATAL("Init motor_hs failed"); | 178 | LOG_FATAL("Init motor_hs failed"); |
129 | return -1; | 179 | return -1; |
130 | } | 180 | } |
181 | +#endif | ||
131 | 182 | ||
132 | #ifdef WITH_FACE_DET_SS | 183 | #ifdef WITH_FACE_DET_SS |
133 | // 人脸检测初始化 | 184 | // 人脸检测初始化 |
@@ -190,7 +241,6 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ | @@ -190,7 +241,6 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ | ||
190 | } | 241 | } |
191 | , this); | 242 | , this); |
192 | 243 | ||
193 | - | ||
194 | m_timing_snapshot_thread = new std::thread( | 244 | m_timing_snapshot_thread = new std::thread( |
195 | [](void* arg) | 245 | [](void* arg) |
196 | { | 246 | { |
@@ -457,7 +507,17 @@ bool CMultiSourceProcess::RestartTask(const string taskID){ | @@ -457,7 +507,17 @@ bool CMultiSourceProcess::RestartTask(const string taskID){ | ||
457 | 507 | ||
458 | bool CMultiSourceProcess::FinishTask(const string taskID){ | 508 | bool CMultiSourceProcess::FinishTask(const string taskID){ |
459 | DecoderManager* pDecManager = DecoderManager::getInstance(); | 509 | DecoderManager* pDecManager = DecoderManager::getInstance(); |
460 | - return pDecManager->closeDecoderByName(taskID); | 510 | + // return pDecManager->closeDecoderByName(taskID); |
511 | + | ||
512 | + // 记录主动结束的任务 | ||
513 | + bool flag = pDecManager->closeDecoderByName(taskID); | ||
514 | +#ifdef POST_USE_RABBITMQ | ||
515 | + if (flag) { | ||
516 | + std::lock_guard<std::mutex> l1(m_ActiveFinishedTaskMtx); | ||
517 | + m_ActiveFinishedTaskMap[taskID] = true; | ||
518 | + } | ||
519 | +#endif | ||
520 | + return flag; | ||
461 | } | 521 | } |
462 | 522 | ||
463 | int CMultiSourceProcess::snapshot_task(std::string& uri_or_name, const std::string& file_name, bool bInTask) { | 523 | int CMultiSourceProcess::snapshot_task(std::string& uri_or_name, const std::string& file_name, bool bInTask) { |
@@ -539,7 +599,7 @@ int CMultiSourceProcess::SnapShot(task_param _cur_task_param) { | @@ -539,7 +599,7 @@ int CMultiSourceProcess::SnapShot(task_param _cur_task_param) { | ||
539 | 599 | ||
540 | void CMultiSourceProcess::CloseAllTask(){ | 600 | void CMultiSourceProcess::CloseAllTask(){ |
541 | m_bfinish = true; | 601 | m_bfinish = true; |
542 | - | 602 | + atlas_licence_close(&(skt_handle)); //授权 |
543 | DecoderManager* pDecManager = DecoderManager::getInstance(); | 603 | DecoderManager* pDecManager = DecoderManager::getInstance(); |
544 | pDecManager->closeAllDecoder(); | 604 | pDecManager->closeAllDecoder(); |
545 | 605 | ||
@@ -601,7 +661,7 @@ void CMultiSourceProcess::clear_finished_task(){// 清理已经结束的任务 | @@ -601,7 +661,7 @@ void CMultiSourceProcess::clear_finished_task(){// 清理已经结束的任务 | ||
601 | } | 661 | } |
602 | 662 | ||
603 | ++ iter_finished; | 663 | ++ iter_finished; |
604 | - } | 664 | + } |
605 | } | 665 | } |
606 | 666 | ||
607 | bool CMultiSourceProcess::finish_task(const string taskID, const bool delete_snapshot){ | 667 | bool CMultiSourceProcess::finish_task(const string taskID, const bool delete_snapshot){ |
@@ -609,20 +669,31 @@ bool CMultiSourceProcess::finish_task(const string taskID, const bool delete_sna | @@ -609,20 +669,31 @@ bool CMultiSourceProcess::finish_task(const string taskID, const bool delete_sna | ||
609 | // 任务结束,关闭跟踪 | 669 | // 任务结束,关闭跟踪 |
610 | if (!vpt_process.finishTaskTracker(taskID)) | 670 | if (!vpt_process.finishTaskTracker(taskID)) |
611 | LOG_ERROR("Finish VPT Tracker failed, task_id: {}", taskID); | 671 | LOG_ERROR("Finish VPT Tracker failed, task_id: {}", taskID); |
612 | - | 672 | + |
613 | #ifdef POST_USE_RABBITMQ | 673 | #ifdef POST_USE_RABBITMQ |
614 | - auto json_str = helpers::gen_json::gen_office_task_heart_beat_json({taskID}); | ||
615 | - mq_manager_->publish(mq_type_t::HEART_BEAT_MQ, json_str.c_str(), true); | 674 | + { |
675 | + // 外部主动结束的任务不推送mq | ||
676 | + std::lock_guard<std::mutex> mlock(m_ActiveFinishedTaskMtx); | ||
677 | + if (!(m_ActiveFinishedTaskMap.count(taskID) && m_ActiveFinishedTaskMap[taskID])) { | ||
678 | + auto json_str = helpers::gen_json::gen_office_task_heart_beat_json({taskID}); | ||
679 | + mq_manager_->publish(mq_type_t::HEART_BEAT_MQ, json_str.c_str(), true); | ||
680 | + } | ||
681 | + if (m_ActiveFinishedTaskMap.count(taskID)) m_ActiveFinishedTaskMap.erase(taskID); | ||
682 | + } | ||
616 | #endif | 683 | #endif |
617 | 684 | ||
618 | // #ifdef WITH_SECOND_PROCESS | 685 | // #ifdef WITH_SECOND_PROCESS |
619 | pedestrian_vehicle_retrograde_.force_release_result(taskID); //221024 byzsh | 686 | pedestrian_vehicle_retrograde_.force_release_result(taskID); //221024 byzsh |
620 | // #endif | 687 | // #endif |
688 | +#ifdef USE_VILLAGE | ||
621 | tricycle_manned_.force_release_result(taskID); | 689 | tricycle_manned_.force_release_result(taskID); |
622 | truck_manned_.force_release_result(taskID); | 690 | truck_manned_.force_release_result(taskID); |
623 | motor_hsprocess_.force_release_result(taskID); | 691 | motor_hsprocess_.force_release_result(taskID); |
624 | 692 | ||
625 | m_task_param_manager->delete_task_param(taskID); | 693 | m_task_param_manager->delete_task_param(taskID); |
694 | +#endif | ||
695 | + m_snapshot_reprocessing->release_finished_locus_snapshot(taskID); | ||
696 | + m_snapshot_reprocessing->release_village_finished_locus_snapshot(taskID); | ||
626 | 697 | ||
627 | return true; | 698 | return true; |
628 | } | 699 | } |
@@ -635,19 +706,62 @@ int CMultiSourceProcess::algorthim_process_thread(){ | @@ -635,19 +706,62 @@ int CMultiSourceProcess::algorthim_process_thread(){ | ||
635 | ACL_CALL(aclrtCreateContext(&ctx, m_devId), ACL_ERROR_NONE, 1); | 706 | ACL_CALL(aclrtCreateContext(&ctx, m_devId), ACL_ERROR_NONE, 1); |
636 | 707 | ||
637 | while (true){ | 708 | while (true){ |
709 | +#ifdef USE_VILLAGE | ||
638 | if (!CheckTime()) { | 710 | if (!CheckTime()) { |
639 | LOG_FATAL("authority failed!"); | 711 | LOG_FATAL("authority failed!"); |
640 | break; | 712 | break; |
641 | } | 713 | } |
642 | - | 714 | +#else |
715 | + //授权相关------------------------------------ | ||
716 | + if(check_label == -1) { | ||
717 | + printf("sy_atlas_licence_check failed.\n"); | ||
718 | + break; | ||
719 | + } | ||
720 | + //获取系统时间,每个月1号check一次授权 | ||
721 | + struct tm* info; | ||
722 | + int nYear, nMonth, nDay; | ||
723 | + time_t raw; | ||
724 | + time(&raw); | ||
725 | + info = localtime(&raw); | ||
726 | + //nYear = info->tm_year + 1900; | ||
727 | + //nMonth = info->tm_mon + 1; | ||
728 | + nDay = info->tm_mday; | ||
729 | + if(nDay==1) { | ||
730 | + if(check_label ==0) { | ||
731 | + std::cout << "atlas_licence_check start." << std::endl; | ||
732 | + atlas_licence_check_result check_result; | ||
733 | + memset(&check_result, 0, sizeof(atlas_licence_check_result)); | ||
734 | + check_result.code = -1; | ||
735 | + | ||
736 | + int res = atlas_licence_check(skt_handle, check_param, &check_result); | ||
737 | + if(res!=0) { | ||
738 | + std::cout << "sy_licence_check failed." << std::endl; | ||
739 | + break; | ||
740 | + } | ||
741 | + //std::cout << "code:" << check_result.code << ",msg:" << check_result.msg << std::endl; | ||
742 | + if(check_result.code!=0) { | ||
743 | + check_label = -1; | ||
744 | + std::cout << "code:" << check_result.code << ",msg:" << check_result.msg << std::endl; | ||
745 | + break; | ||
746 | + } | ||
747 | + std::cout << "atlas_licence_check end." << std::endl; | ||
748 | + check_label =1; | ||
749 | + } | ||
750 | + } | ||
751 | + else { | ||
752 | + check_label =0; | ||
753 | + } | ||
754 | + //授权相关------------------------------------ | ||
755 | +#endif | ||
643 | if(m_bfinish){ | 756 | if(m_bfinish){ |
644 | break; | 757 | break; |
645 | } | 758 | } |
646 | 759 | ||
647 | - clear_finished_task(); | 760 | + clear_finished_task(); |
648 | 761 | ||
649 | vector<DeviceMemory*> vec_gpuMem; | 762 | vector<DeviceMemory*> vec_gpuMem; |
650 | m_DataListMtx.lock(); | 763 | m_DataListMtx.lock(); |
764 | + | ||
651 | while (!m_RgbDataList.empty()){ | 765 | while (!m_RgbDataList.empty()){ |
652 | DeviceMemory* gpuMem = m_RgbDataList.front(); | 766 | DeviceMemory* gpuMem = m_RgbDataList.front(); |
653 | if(gpuMem->getMem() == nullptr){ | 767 | if(gpuMem->getMem() == nullptr){ |
@@ -664,14 +778,14 @@ int CMultiSourceProcess::algorthim_process_thread(){ | @@ -664,14 +778,14 @@ int CMultiSourceProcess::algorthim_process_thread(){ | ||
664 | } | 778 | } |
665 | } | 779 | } |
666 | m_DataListMtx.unlock(); | 780 | m_DataListMtx.unlock(); |
667 | - | ||
668 | - if(vec_gpuMem.size() <= 0){ | 781 | + |
782 | + if(vec_gpuMem.size() <= 0){ | ||
669 | std::this_thread::sleep_for(std::chrono::milliseconds(3)); | 783 | std::this_thread::sleep_for(std::chrono::milliseconds(3)); |
670 | continue; | 784 | continue; |
671 | } | 785 | } |
672 | 786 | ||
673 | aclrtSetCurrentContext(ctx); | 787 | aclrtSetCurrentContext(ctx); |
674 | - algorthim_vpt(vec_gpuMem); | 788 | + algorthim_vpt(vec_gpuMem); |
675 | 789 | ||
676 | #ifdef WITH_FACE_DET_SS | 790 | #ifdef WITH_FACE_DET_SS |
677 | algorthim_face_detect(vec_gpuMem); | 791 | algorthim_face_detect(vec_gpuMem); |
@@ -761,8 +875,8 @@ int CMultiSourceProcess::algorthim_vpt(vector<DeviceMemory*> vec_gpuMem){ | @@ -761,8 +875,8 @@ int CMultiSourceProcess::algorthim_vpt(vector<DeviceMemory*> vec_gpuMem){ | ||
761 | // 货车载人 | 875 | // 货车载人 |
762 | algorithm_truck_manned(vpt_interest_task_id, vec_vptMem, vptResult); | 876 | algorithm_truck_manned(vpt_interest_task_id, vec_vptMem, vptResult); |
763 | // 二轮车超员/未戴盔 | 877 | // 二轮车超员/未戴盔 |
764 | - algorithm_motor_hs_process(vpt_interest_task_id, vec_vptMem, vptResult); | ||
765 | - manned_snapshot(vpt_interest_task_id, vec_vptMem, deleteObjectID); | 878 | + algorithm_motor_hs_process(vpt_interest_task_id, vec_vptMem, vptResult); |
879 | + manned_snapshot(vpt_interest_task_id, vec_vptMem, deleteObjectID); | ||
766 | #endif | 880 | #endif |
767 | 881 | ||
768 | // if(vptResult.size() > 0){ | 882 | // if(vptResult.size() > 0){ |
@@ -1387,10 +1501,11 @@ void CMultiSourceProcess::manned_snapshot(vector<string>& vpt_interest_task_id, | @@ -1387,10 +1501,11 @@ void CMultiSourceProcess::manned_snapshot(vector<string>& vpt_interest_task_id, | ||
1387 | string json_str = ""; | 1501 | string json_str = ""; |
1388 | std::vector<video_object_snapshot> algo_results; | 1502 | std::vector<video_object_snapshot> algo_results; |
1389 | for (int sp_idx = 0; sp_idx < 3; sp_idx ++) { | 1503 | for (int sp_idx = 0; sp_idx < 3; sp_idx ++) { |
1504 | + int num = sp_idx + 1; | ||
1390 | // 原图 | 1505 | // 原图 |
1391 | LOG_DEBUG("原图"); | 1506 | LOG_DEBUG("原图"); |
1392 | std::string fpath_origin = result_folder + helpers::os::sep + obj_key.video_id + "_" + | 1507 | std::string fpath_origin = result_folder + helpers::os::sep + obj_key.video_id + "_" + |
1393 | - std::to_string(obj_key.obj_id) + "_" + cur_timestamp_ms + "_picnum_" + std::to_string(sp_idx) + ".jpg"; | 1508 | + std::to_string(obj_key.obj_id) + "_" + cur_timestamp_ms + "_picnum_" + std::to_string(num) + ".jpg"; |
1394 | 1509 | ||
1395 | ImgSaveInfo origin_save_info; | 1510 | ImgSaveInfo origin_save_info; |
1396 | origin_save_info.file_path = fpath_origin; | 1511 | origin_save_info.file_path = fpath_origin; |
@@ -1402,7 +1517,7 @@ void CMultiSourceProcess::manned_snapshot(vector<string>& vpt_interest_task_id, | @@ -1402,7 +1517,7 @@ void CMultiSourceProcess::manned_snapshot(vector<string>& vpt_interest_task_id, | ||
1402 | LOG_DEBUG("抠图"); | 1517 | LOG_DEBUG("抠图"); |
1403 | // 抠图 | 1518 | // 抠图 |
1404 | string object_file_name = result_folder_little + helpers::os::sep + obj_key.video_id + "_" + | 1519 | string object_file_name = result_folder_little + helpers::os::sep + obj_key.video_id + "_" + |
1405 | - std::to_string(obj_key.obj_id) + "_" + cur_timestamp_ms + "_picnum_" + std::to_string(sp_idx) + ".jpg"; | 1520 | + std::to_string(obj_key.obj_id) + "_" + cur_timestamp_ms + "_picnum_" + std::to_string(num) + ".jpg"; |
1406 | ImgSaveInfo obj_save_info; | 1521 | ImgSaveInfo obj_save_info; |
1407 | obj_save_info.file_path = object_file_name; | 1522 | obj_save_info.file_path = object_file_name; |
1408 | obj_save_info.img_info = obj_value.snapShots[sp_idx].snapShotLittle; | 1523 | obj_save_info.img_info = obj_value.snapShots[sp_idx].snapShotLittle; |
@@ -1737,4 +1852,4 @@ bool CMultiSourceProcess::CheckTime() { | @@ -1737,4 +1852,4 @@ bool CMultiSourceProcess::CheckTime() { | ||
1737 | { | 1852 | { |
1738 | return false; | 1853 | return false; |
1739 | } | 1854 | } |
1740 | -} | ||
1741 | \ No newline at end of file | 1855 | \ No newline at end of file |
1856 | +} |
src/ai_platform/MultiSourceProcess.h
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | #include "../ai_engine_module/truck_manned_process.h" | 20 | #include "../ai_engine_module/truck_manned_process.h" |
21 | #include "../ai_engine_module/motocycle_hs_process.h" | 21 | #include "../ai_engine_module/motocycle_hs_process.h" |
22 | #include "../util/JpegUtil.h" | 22 | #include "../util/JpegUtil.h" |
23 | - | 23 | +#include "atlas_licence.h"//授权文件 |
24 | 24 | ||
25 | #ifdef POST_USE_RABBITMQ | 25 | #ifdef POST_USE_RABBITMQ |
26 | #include "../reprocessing_module/mq_manager.hpp" | 26 | #include "../reprocessing_module/mq_manager.hpp" |
@@ -119,6 +119,9 @@ private: | @@ -119,6 +119,9 @@ private: | ||
119 | mutex m_FinishedTaskMtx; | 119 | mutex m_FinishedTaskMtx; |
120 | map<string,bool> m_FinishedTaskMap; | 120 | map<string,bool> m_FinishedTaskMap; |
121 | 121 | ||
122 | + mutex m_ActiveFinishedTaskMtx ; | ||
123 | + map<string,bool> m_ActiveFinishedTaskMap; // 记录主动结束的任务,不发送mq | ||
124 | + | ||
122 | thread* m_pAlgorthimThread; | 125 | thread* m_pAlgorthimThread; |
123 | bool m_bfinish{false}; | 126 | bool m_bfinish{false}; |
124 | 127 | ||
@@ -144,5 +147,9 @@ private: | @@ -144,5 +147,9 @@ private: | ||
144 | mutex m_recoderinfo_queue_mtx; | 147 | mutex m_recoderinfo_queue_mtx; |
145 | thread* m_recode_thread {nullptr}; | 148 | thread* m_recode_thread {nullptr}; |
146 | 149 | ||
150 | + void *skt_handle = nullptr;//授权 | ||
151 | + atlas_licence_check_param check_param;//授权 | ||
152 | + int check_label = -1;//授权 -1=未授权 0=授权 1=授权check日已经check成功(每月一次check) | ||
153 | + | ||
147 | 154 | ||
148 | }; | 155 | }; |
149 | \ No newline at end of file | 156 | \ No newline at end of file |
src/decoder/Makefile_decoder
100755 → 100644
src/demo/Makefile
@@ -33,7 +33,7 @@ lib_dir=-L/usr/local/Ascend/ascend-toolkit/6.3.RC1/runtime/lib64 \ | @@ -33,7 +33,7 @@ lib_dir=-L/usr/local/Ascend/ascend-toolkit/6.3.RC1/runtime/lib64 \ | ||
33 | lib=-lacl_dvpp -lascendcl -lacl_dvpp_mpi -lruntime -lascendalog -lc_sec -lmsprofiler -lgert -lmmpa -lascend_hal -lexe_graph -lge_executor -lgraph -lprofapi -lascend_protobuf -lerror_manager -lhybrid_executor -lregister -ldavinci_executor -lge_common -lge_common_base \ | 33 | lib=-lacl_dvpp -lascendcl -lacl_dvpp_mpi -lruntime -lascendalog -lc_sec -lmsprofiler -lgert -lmmpa -lascend_hal -lexe_graph -lge_executor -lgraph -lprofapi -lascend_protobuf -lerror_manager -lhybrid_executor -lregister -ldavinci_executor -lge_common -lge_common_base \ |
34 | -lplatform -lgraph_base -lqos_manager | 34 | -lplatform -lgraph_base -lqos_manager |
35 | 35 | ||
36 | -LIBS= -L $(DEPEND_DIR) -lvpt_det_vdec -lsycheck -lface_det_vdec -lhs_tri_process -lhs_truck_process -lhs_motor_process -lvpt_ascend\ | 36 | +LIBS= -L $(DEPEND_DIR) -lvpt_det_vdec -lsycheck -lface_det_vdec -lhs_tri_process -lhs_truck_process -lhs_motor_process -latlaslic -lvpt_ascend\ |
37 | -L $(OPENCV_ROOT)/lib -lopencv_world\ | 37 | -L $(OPENCV_ROOT)/lib -lopencv_world\ |
38 | -L $(JSON_ROOT)/lib -ljsoncpp \ | 38 | -L $(JSON_ROOT)/lib -ljsoncpp \ |
39 | -L $(FFMPEG_ROOT)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \ | 39 | -L $(FFMPEG_ROOT)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \ |
src/demo/demo.cpp
@@ -3,31 +3,32 @@ | @@ -3,31 +3,32 @@ | ||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
6 | +#include <unistd.h> | ||
6 | 7 | ||
7 | using namespace std; | 8 | using namespace std; |
8 | 9 | ||
9 | #ifdef POST_USE_RABBITMQ | 10 | #ifdef POST_USE_RABBITMQ |
10 | 11 | ||
11 | void init_mq_conn(void *handle) { | 12 | void init_mq_conn(void *handle) { |
12 | - for (auto key : {mq_type_t::ALARM_MQ}) { | 13 | + 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}) { |
13 | rabbitmq_conn_params_t mq_conn_params; | 14 | rabbitmq_conn_params_t mq_conn_params; |
14 | - // mq_conn_params.port = 5672; | ||
15 | - | ||
16 | - // strcpy(mq_conn_params.ip, "192.168.10.189"); | ||
17 | - // strcpy(mq_conn_params.uname, "admin"); | ||
18 | - // strcpy(mq_conn_params.passwd, "shiyu2021"); | ||
19 | - // strcpy(mq_conn_params.vhost, "/"); | ||
20 | - // strcpy(mq_conn_params.exchange, "tsl.test.topic"); | ||
21 | - // strcpy(mq_conn_params.exchange_type, "topic"); | ||
22 | - | ||
23 | mq_conn_params.port = 5673; | 15 | mq_conn_params.port = 5673; |
24 | - strcpy(mq_conn_params.ip, "192.168.10.187"); | ||
25 | - strcpy(mq_conn_params.uname, "admin"); | ||
26 | - strcpy(mq_conn_params.passwd, "admin123456"); | 16 | + |
17 | + strcpy(mq_conn_params.ip, "192.168.10.8"); | ||
18 | + strcpy(mq_conn_params.uname, "guest"); | ||
19 | + strcpy(mq_conn_params.passwd, "guest"); | ||
27 | strcpy(mq_conn_params.vhost, "/"); | 20 | strcpy(mq_conn_params.vhost, "/"); |
28 | strcpy(mq_conn_params.exchange, "topExchange"); | 21 | strcpy(mq_conn_params.exchange, "topExchange"); |
29 | strcpy(mq_conn_params.exchange_type, "topic"); | 22 | strcpy(mq_conn_params.exchange_type, "topic"); |
30 | 23 | ||
24 | + // mq_conn_params.port = 5673; | ||
25 | + // strcpy(mq_conn_params.ip, "192.168.10.187"); | ||
26 | + // strcpy(mq_conn_params.uname, "admin"); | ||
27 | + // strcpy(mq_conn_params.passwd, "admin123456"); | ||
28 | + // strcpy(mq_conn_params.vhost, "/"); | ||
29 | + // strcpy(mq_conn_params.exchange, "topExchange"); | ||
30 | + // strcpy(mq_conn_params.exchange_type, "topic"); | ||
31 | + | ||
31 | switch (key) { | 32 | switch (key) { |
32 | case mq_type_t::ALARM_MQ: { | 33 | case mq_type_t::ALARM_MQ: { |
33 | strcpy(mq_conn_params.queue, "topic.queue.alarm"); | 34 | strcpy(mq_conn_params.queue, "topic.queue.alarm"); |
@@ -650,7 +651,9 @@ string createTask(void *handle, std::vector<algorithm_type_t> algor_vec, int gi, | @@ -650,7 +651,9 @@ string createTask(void *handle, std::vector<algorithm_type_t> algor_vec, int gi, | ||
650 | tparam.ipc_url = "rtsp://admin:ad123456@192.168.10.166:554/cam/realmonitor?channel=1&subtype=0"; | 651 | tparam.ipc_url = "rtsp://admin:ad123456@192.168.10.166:554/cam/realmonitor?channel=1&subtype=0"; |
651 | break; | 652 | break; |
652 | case 3: | 653 | case 3: |
653 | - tparam.ipc_url = "/opt/share/data/bayue.mp4"; | 654 | + tparam.ipc_url = "rtsp://122.97.218.170:8604/openUrl/LBBYTra?params=eyJwcm90b2NhbCI6InJ0c3AiLCJjbGllbnRUeXBlIjoib3Blbl9hcGkiLCJleHByaWVUaW1lIjotMSwicHJvdG9jb2wiOiJydHNwIiwiZXhwaXJlVGltZSI6MzAwLCJlbmFibGVNR0MiOnRydWUsImV4cGFuZCI6InN0YW5kYXJkPXJ0c3Amc3RyZWFtZm9ybT1ydHAiLCJhIjoiOTgzYjRjMmUxMThlNGU1OTlkYThmMTI3NTkyMGViODV8MXwwfDEiLCJ0IjoxfQ=="; |
655 | + // tparam.ipc_url = "rtsp://122.97.218.170:8604/openUrl/V5nXRHa?params=eyJwcm90b2NhbCI6InJ0c3AiLCJjbGllbnRUeXBlIjoib3Blbl9hcGkiLCJleHByaWVUaW1lIjotMSwicHJvdG9jb2wiOiJydHNwIiwiZXhwaXJlVGltZSI6MzAwLCJlbmFibGVNR0MiOnRydWUsImV4cGFuZCI6InN0YW5kYXJkPXJ0c3Amc3RyZWFtZm9ybT1ydHAiLCJhIjoiMTBjZjM4N2JjY2Y5NDg3YzhjNWYzNjE2M2ViMWUyNTJ8MXwwfDEiLCJ0IjoxfQ=="; | ||
656 | + //tparam.ipc_url = "/opt/share/data/bayue.mp4"; | ||
654 | break; | 657 | break; |
655 | case 4: | 658 | case 4: |
656 | tparam.ipc_url = "/opt/share/data/Street.uvf"; | 659 | tparam.ipc_url = "/opt/share/data/Street.uvf"; |
@@ -790,6 +793,14 @@ void test_gpu(int gpuID){ | @@ -790,6 +793,14 @@ void test_gpu(int gpuID){ | ||
790 | // std::vector<algorithm_type_t> algor_vec2 = {algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::TRUCK_MANNED}; | 793 | // std::vector<algorithm_type_t> algor_vec2 = {algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::TRUCK_MANNED}; |
791 | std::vector<algorithm_type_t> algor_vec3 = {algorithm_type_t::FACE_SNAPSHOT}; | 794 | std::vector<algorithm_type_t> algor_vec3 = {algorithm_type_t::FACE_SNAPSHOT}; |
792 | 795 | ||
796 | +/* | ||
797 | + int repeat_num = 1000; | ||
798 | + while(repeat_num--) { | ||
799 | + printf("============================:%d\n",repeat_num); | ||
800 | + string task_id = createTask(handle, algor_vec, 3 + gpuID * 10); | ||
801 | + string task_id1 = createTask(handle, algor_vec2, 5); | ||
802 | + string task_id2 = createTask(handle, algor_vec2, 6); | ||
803 | +*/ | ||
793 | 804 | ||
794 | // string task_id = createTask(handle, algor_vec, 3 + gpuID * 10); | 805 | // string task_id = createTask(handle, algor_vec, 3 + gpuID * 10); |
795 | // string task_id1 = createTask(handle, algor_vec2, 5); | 806 | // string task_id1 = createTask(handle, algor_vec2, 5); |
@@ -815,12 +826,18 @@ void test_gpu(int gpuID){ | @@ -815,12 +826,18 @@ void test_gpu(int gpuID){ | ||
815 | // createTask(handle, algor_vec, 17); | 826 | // createTask(handle, algor_vec, 17); |
816 | // createTask(handle, algor_vec, 18); | 827 | // createTask(handle, algor_vec, 18); |
817 | // createTask(handle, algor_vec, 19); | 828 | // createTask(handle, algor_vec, 19); |
829 | +/* | ||
818 | 830 | ||
819 | // test_snapshot(handle); | 831 | // test_snapshot(handle); |
820 | - | 832 | + sleep(60); //60s |
833 | + finish_task(handle, (char*)task_id2.data(), 0); | ||
834 | + finish_task(handle, (char*)task_id1.data(), 0); | ||
835 | + }*/ | ||
821 | while (getchar() != 'q'); | 836 | while (getchar() != 'q'); |
822 | 837 | ||
823 | // finish_task(handle, (char*)task_id.data(), 0); | 838 | // finish_task(handle, (char*)task_id.data(), 0); |
839 | + | ||
840 | + // finish_task(handle, (char*)task_id1.data(), 0); | ||
824 | 841 | ||
825 | tsl_aiplatform_release(&handle); | 842 | tsl_aiplatform_release(&handle); |
826 | } | 843 | } |
@@ -849,4 +866,4 @@ int main(int argc, char *argv[]) { | @@ -849,4 +866,4 @@ int main(int argc, char *argv[]) { | ||
849 | printf("Done.\n"); | 866 | printf("Done.\n"); |
850 | 867 | ||
851 | return 0; | 868 | return 0; |
852 | -} | ||
853 | \ No newline at end of file | 869 | \ No newline at end of file |
870 | +} |
src/reprocessing_module/save_snapshot_reprocessing.cpp
src/reprocessing_module/snapshot_reprocessing.cpp
@@ -770,6 +770,7 @@ void snapshot_reprocessing::release_finished_locus_snapshot(const string taskid, | @@ -770,6 +770,7 @@ void snapshot_reprocessing::release_finished_locus_snapshot(const string taskid, | ||
770 | VPCUtil::vpc_img_release(ss->second.snapShotLittle); | 770 | VPCUtil::vpc_img_release(ss->second.snapShotLittle); |
771 | } | 771 | } |
772 | total_snapshot_info.erase(ss); | 772 | total_snapshot_info.erase(ss); |
773 | + return; | ||
773 | } | 774 | } |
774 | } | 775 | } |
775 | } | 776 | } |
@@ -804,12 +805,13 @@ void snapshot_reprocessing::release_village_finished_locus_snapshot(const string | @@ -804,12 +805,13 @@ void snapshot_reprocessing::release_village_finished_locus_snapshot(const string | ||
804 | if (strcmp(ss->first.video_id.c_str(), taskid.c_str()) == 0) | 805 | if (strcmp(ss->first.video_id.c_str(), taskid.c_str()) == 0) |
805 | { | 806 | { |
806 | if (bRelease){ | 807 | if (bRelease){ |
807 | - for (int i = 0; i < 3; i++) { | 808 | + for (int i = 0; i < 3; i++) { |
808 | VPCUtil::vpc_img_release(ss->second.snapShots[i].snapShot); | 809 | VPCUtil::vpc_img_release(ss->second.snapShots[i].snapShot); |
809 | VPCUtil::vpc_img_release(ss->second.snapShots[i].snapShotLittle); | 810 | VPCUtil::vpc_img_release(ss->second.snapShots[i].snapShotLittle); |
810 | } | 811 | } |
811 | } | 812 | } |
812 | total_village_snapshot_info.erase(ss); | 813 | total_village_snapshot_info.erase(ss); |
814 | + return; | ||
813 | } | 815 | } |
814 | } | 816 | } |
815 | } | 817 | } |
src/reprocessing_module/snapshot_reprocessing.h
@@ -82,8 +82,8 @@ public: | @@ -82,8 +82,8 @@ public: | ||
82 | void update_village_bestsnapshot(vector<DeviceMemory*> vec_devMem, vector<onelevel_det_result> &ol_det_result, vector<vector<int>>& delete_object_id); | 82 | void update_village_bestsnapshot(vector<DeviceMemory*> vec_devMem, vector<onelevel_det_result> &ol_det_result, vector<vector<int>>& delete_object_id); |
83 | map<OBJ_KEY, OBJ_VALUES> get_total_village_snapshot_info(); | 83 | map<OBJ_KEY, OBJ_VALUES> get_total_village_snapshot_info(); |
84 | 84 | ||
85 | - void release_finished_locus_snapshot(const string taskid, const int obj_id, bool bRelease); | ||
86 | - void release_village_finished_locus_snapshot(const string taskid, const int obj_id, bool bRelease); | 85 | + void release_finished_locus_snapshot(const string taskid, const int objid = -1, bool bRelease = true); //-1为删除该路所有任务的快照图 |
86 | + void release_village_finished_locus_snapshot(const string taskid, const int objid = -1, bool bRelease = true); | ||
87 | 87 | ||
88 | private: | 88 | private: |
89 | bool best_snapshot_judge_algor(const OBJ_KEY& obj_key, const OBJ_VALUE& obj_value, int left, int top, int width, int height, int image_width, int image_height); | 89 | bool best_snapshot_judge_algor(const OBJ_KEY& obj_key, const OBJ_VALUE& obj_value, int left, int top, int width, int height, int image_width, int image_height); |
src/tsl_aiplatform_jni/AiEngineNativeInterface.cpp
@@ -261,7 +261,7 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | @@ -261,7 +261,7 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | ||
261 | jstring str_taskParam_taskId = (jstring)env->GetObjectField(taskParam, fid_taskParam_taskId); | 261 | jstring str_taskParam_taskId = (jstring)env->GetObjectField(taskParam, fid_taskParam_taskId); |
262 | const char *taskParam_taskId = env->GetStringUTFChars(str_taskParam_taskId, JNI_FALSE); | 262 | const char *taskParam_taskId = env->GetStringUTFChars(str_taskParam_taskId, JNI_FALSE); |
263 | jobject taskParam_algorConfigParams = env->GetObjectField(taskParam, fid_taskParam_algorConfigParams); | 263 | jobject taskParam_algorConfigParams = env->GetObjectField(taskParam, fid_taskParam_algorConfigParams); |
264 | - | 264 | + |
265 | jint taskParam_dec_type = env->GetIntField(taskParam, fid_taskParam_dec_type); | 265 | jint taskParam_dec_type = env->GetIntField(taskParam, fid_taskParam_dec_type); |
266 | jint taskParam_port = env->GetIntField(taskParam, fid_taskParam_port); | 266 | jint taskParam_port = env->GetIntField(taskParam, fid_taskParam_port); |
267 | jint taskParam_protocal = env->GetIntField(taskParam, fid_taskParam_protocal); | 267 | jint taskParam_protocal = env->GetIntField(taskParam, fid_taskParam_protocal); |
@@ -272,7 +272,6 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | @@ -272,7 +272,6 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | ||
272 | jfieldID fid_syRectParam_width = env->GetFieldID(cls_syRectParam, "width", "I"); | 272 | jfieldID fid_syRectParam_width = env->GetFieldID(cls_syRectParam, "width", "I"); |
273 | jfieldID fid_syRectParam_height = env->GetFieldID(cls_syRectParam, "height", "I"); | 273 | jfieldID fid_syRectParam_height = env->GetFieldID(cls_syRectParam, "height", "I"); |
274 | 274 | ||
275 | - | ||
276 | // java to C++ | 275 | // java to C++ |
277 | task_param mTaskParam; | 276 | task_param mTaskParam; |
278 | mTaskParam.ipc_url = taskParam_ipcUrl; | 277 | mTaskParam.ipc_url = taskParam_ipcUrl; |
@@ -290,7 +289,7 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | @@ -290,7 +289,7 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | ||
290 | map<int, char *> psnapshot_AlgorConfigParamResSnapshotFolderMap; | 289 | map<int, char *> psnapshot_AlgorConfigParamResSnapshotFolderMap; |
291 | map<int, jstring> snapshot_AlgorConfigParamResVideoFolderMap; | 290 | map<int, jstring> snapshot_AlgorConfigParamResVideoFolderMap; |
292 | map<int, char *> psnapshot_AlgorConfigParamResVideoFolderMap; | 291 | map<int, char *> psnapshot_AlgorConfigParamResVideoFolderMap; |
293 | - | 292 | + |
294 | jclass cls_arraylist = env->FindClass("java/util/ArrayList"); | 293 | jclass cls_arraylist = env->FindClass("java/util/ArrayList"); |
295 | // method in class ArrayList | 294 | // method in class ArrayList |
296 | jmethodID mid_arraylist_get = env->GetMethodID(cls_arraylist, "get", "(I)Ljava/lang/Object;"); | 295 | jmethodID mid_arraylist_get = env->GetMethodID(cls_arraylist, "get", "(I)Ljava/lang/Object;"); |
@@ -309,7 +308,6 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | @@ -309,7 +308,6 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | ||
309 | 308 | ||
310 | jclass cls_AlgorConfigParam = env->GetObjectClass(algorConfigParam_algorInitParam); | 309 | jclass cls_AlgorConfigParam = env->GetObjectClass(algorConfigParam_algorInitParam); |
311 | 310 | ||
312 | - | ||
313 | /* assign public variables. */ | 311 | /* assign public variables. */ |
314 | auto algor_basic_param = new algor_basic_config_param_t; | 312 | auto algor_basic_param = new algor_basic_config_param_t; |
315 | { | 313 | { |
@@ -317,19 +315,19 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | @@ -317,19 +315,19 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | ||
317 | env->GetFieldID(cls_AlgorConfigParam, "algor_valid_rect", "Lcom/objecteye/pojo/common/SyRectParam;"); | 315 | env->GetFieldID(cls_AlgorConfigParam, "algor_valid_rect", "Lcom/objecteye/pojo/common/SyRectParam;"); |
318 | jobject ssAlgorConfigParam_algorRect = | 316 | jobject ssAlgorConfigParam_algorRect = |
319 | env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_algorRect); | 317 | env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_algorRect); |
320 | - | 318 | + |
321 | jint ssAlgorConfigParam_algorRect_left = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_left); | 319 | jint ssAlgorConfigParam_algorRect_left = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_left); |
322 | jint ssAlgorConfigParam_algorRect_top = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_top); | 320 | jint ssAlgorConfigParam_algorRect_top = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_top); |
323 | jint ssAlgorConfigParam_algorRect_width = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_width); | 321 | jint ssAlgorConfigParam_algorRect_width = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_width); |
324 | jint ssAlgorConfigParam_algorRect_height = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_height); | 322 | jint ssAlgorConfigParam_algorRect_height = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_height); |
325 | - | 323 | + |
326 | jfieldID fid_ssAlgorConfigParam_snapshotLittleFolder = | 324 | jfieldID fid_ssAlgorConfigParam_snapshotLittleFolder = |
327 | env->GetFieldID(cls_AlgorConfigParam, "result_folder_little", "Ljava/lang/String;"); | 325 | env->GetFieldID(cls_AlgorConfigParam, "result_folder_little", "Ljava/lang/String;"); |
328 | jfieldID fid_ssAlgorConfigParam_snapshotFolder = | 326 | jfieldID fid_ssAlgorConfigParam_snapshotFolder = |
329 | env->GetFieldID(cls_AlgorConfigParam, "result_folder", "Ljava/lang/String;"); | 327 | env->GetFieldID(cls_AlgorConfigParam, "result_folder", "Ljava/lang/String;"); |
330 | jfieldID fid_ssAlgorConfigParam_videoFolder = | 328 | jfieldID fid_ssAlgorConfigParam_videoFolder = |
331 | env->GetFieldID(cls_AlgorConfigParam, "video_folder", "Ljava/lang/String;"); //视频存储地址 | 329 | env->GetFieldID(cls_AlgorConfigParam, "video_folder", "Ljava/lang/String;"); //视频存储地址 |
332 | - | 330 | + |
333 | snapshot_little_AlgorConfigParamResSnapshotFolderMap[i] = | 331 | snapshot_little_AlgorConfigParamResSnapshotFolderMap[i] = |
334 | (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_snapshotLittleFolder); | 332 | (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_snapshotLittleFolder); |
335 | psnapshot_little_AlgorConfigParamResSnapshotFolderMap[i] = | 333 | psnapshot_little_AlgorConfigParamResSnapshotFolderMap[i] = |
@@ -342,7 +340,7 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | @@ -342,7 +340,7 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | ||
342 | (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_videoFolder); | 340 | (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_videoFolder); |
343 | psnapshot_AlgorConfigParamResVideoFolderMap[i] = | 341 | psnapshot_AlgorConfigParamResVideoFolderMap[i] = |
344 | (char *)env->GetStringUTFChars(snapshot_AlgorConfigParamResVideoFolderMap[i], JNI_FALSE); | 342 | (char *)env->GetStringUTFChars(snapshot_AlgorConfigParamResVideoFolderMap[i], JNI_FALSE); |
345 | - | 343 | + |
346 | auto algor_init_config_param = new algor_init_config_param_t; | 344 | auto algor_init_config_param = new algor_init_config_param_t; |
347 | 345 | ||
348 | 346 | ||
@@ -385,34 +383,29 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | @@ -385,34 +383,29 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | ||
385 | case algorithm_type_t::TRICYCLE_MANNED: | 383 | case algorithm_type_t::TRICYCLE_MANNED: |
386 | case algorithm_type_t::TRUCK_MANNED: { | 384 | case algorithm_type_t::TRUCK_MANNED: { |
387 | jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "hs_threshold", "I"); | 385 | jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "hs_threshold", "I"); |
388 | - jint j_hs_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | ||
389 | - | 386 | + jint j_hs_threshold = env->GetIntField(algorConfigParam_algorInitParam, fid); |
390 | fid = env->GetFieldID(cls_AlgorConfigParam, "m_frame", "I"); | 387 | fid = env->GetFieldID(cls_AlgorConfigParam, "m_frame", "I"); |
391 | jint j_m_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); | 388 | jint j_m_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); |
392 | - | ||
393 | fid = env->GetFieldID(cls_AlgorConfigParam, "n_frame", "I"); | 389 | fid = env->GetFieldID(cls_AlgorConfigParam, "n_frame", "I"); |
394 | jint j_n_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); | 390 | jint j_n_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); |
395 | - | ||
396 | fid = env->GetFieldID(cls_AlgorConfigParam, "obj_min_width", "I"); | 391 | fid = env->GetFieldID(cls_AlgorConfigParam, "obj_min_width", "I"); |
397 | jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid); | 392 | jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid); |
398 | - | ||
399 | fid = env->GetFieldID(cls_AlgorConfigParam, "obj_min_height", "I"); | 393 | fid = env->GetFieldID(cls_AlgorConfigParam, "obj_min_height", "I"); |
400 | jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid); | 394 | jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid); |
401 | - | ||
402 | fid = env->GetFieldID(cls_AlgorConfigParam, "obj_confidence_threshold", "F"); | 395 | fid = env->GetFieldID(cls_AlgorConfigParam, "obj_confidence_threshold", "F"); |
403 | jfloat j_confidence_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | 396 | jfloat j_confidence_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); |
404 | - // std::printf("%s:%d i is %d mn is [%d %d] threshold is %d\n", __FILE__, __LINE__, i, (int)j_m_frame, | ||
405 | - // (int)j_n_frame, (int)j_hs_threshold); | 397 | + std::printf("%s:%d i is %d mn is [%d %d] threshold is %d\n", __FILE__, __LINE__, i, (int)j_m_frame, |
398 | + (int)j_n_frame, (int)j_hs_threshold); | ||
406 | 399 | ||
407 | typedef algor_config_param_manned_incident algor_config_param_type; | 400 | typedef algor_config_param_manned_incident algor_config_param_type; |
408 | mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | 401 | mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; |
409 | auto algor_param = | 402 | auto algor_param = |
410 | (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | 403 | (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; |
411 | - | 404 | + |
412 | algor_param->m = (int)j_m_frame; | 405 | algor_param->m = (int)j_m_frame; |
413 | algor_param->n = (int)j_n_frame; | 406 | algor_param->n = (int)j_n_frame; |
414 | algor_param->hs_count_threshold = (int)j_hs_threshold; | 407 | algor_param->hs_count_threshold = (int)j_hs_threshold; |
415 | - | 408 | + |
416 | algor_param->obj_min_width = (int)j_min_width; | 409 | algor_param->obj_min_width = (int)j_min_width; |
417 | algor_param->obj_min_height = (int)j_min_height; | 410 | algor_param->obj_min_height = (int)j_min_height; |
418 | algor_param->obj_confidence_threshold = (float)j_confidence_threshold; | 411 | algor_param->obj_confidence_threshold = (float)j_confidence_threshold; |
@@ -490,8 +483,8 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | @@ -490,8 +483,8 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter | ||
490 | algor_param->n = (int)j_n_frame; | 483 | algor_param->n = (int)j_n_frame; |
491 | algor_param->threshold = (float)j_threshold; | 484 | algor_param->threshold = (float)j_threshold; |
492 | 485 | ||
493 | - // std::printf("%s:%d i is %d mn is [%d %d] threshold is %f\n", __FILE__, __LINE__, i, algor_param->m, | ||
494 | - // algor_param->n, algor_param->threshold); | 486 | + std::printf("%s:%d i is %d mn is [%d %d] threshold is %f\n", __FILE__, __LINE__, i, algor_param->m, |
487 | + algor_param->n, algor_param->threshold); | ||
495 | } break; | 488 | } break; |
496 | case algorithm_type_t::PEDESTRIAN_FIGHT: { | 489 | case algorithm_type_t::PEDESTRIAN_FIGHT: { |
497 | jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "threshold", "F"); | 490 | jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "threshold", "F"); |