Commit 193bf0d843f5928668ac7a7874e29158a8314859

Authored by Hu Chunming
2 parents 785da442 7c1c31d6

Merge branch 'master' into dev-cmhu

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(&param, 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(&param_token, 0, sizeof(atlas_licence_token));
  25 +
  26 + int result = atlas_licence_connect(&skt_handle, param, &param_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 &quot;CYGWIN&quot; OR CMAKE_SYSTEM_NAME MATCHES &quot;MSYS&quot;)
48 48 set(CMAKE_CXX_EXTENSIONS ON)
49 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 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 14 JSON_ROOT = $(THIRDPARTY_ROOT)/jsoncpp-1.9.5/release
15 15 FFMPEG_ROOT = $(THIRDPARTY_ROOT)/ffmpeg-4.4.4/release
16 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 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 22 include_dir=-I/usr/local/Ascend/ascend-toolkit/6.3.RC1/aarch64-linux/include \
21 23 -I $(SPDLOG_ROOT)/include \
... ... @@ -24,6 +26,7 @@ include_dir=-I/usr/local/Ascend/ascend-toolkit/6.3.RC1/aarch64-linux/include \
24 26 -I $(JSON_ROOT)/include \
25 27 -I $(FFMPEG_ROOT)/include \
26 28 -I $(RABBITMQ_CLIENT_ROOT)/include \
  29 + -I $(AUTHORITY_DIR)/include \
27 30  
28 31 lib_dir=-L/usr/local/Ascend/ascend-toolkit/6.3.RC1/runtime/lib64 \
29 32 -L/usr/local/Ascend/ascend-toolkit/latest/lib64 \
... ... @@ -40,6 +43,7 @@ LIBS= -L $(SPDLOG_ROOT)/lib -l:libspdlog.a \
40 43 -L $(JSON_ROOT)/lib -ljsoncpp \
41 44 -L $(FFMPEG_ROOT)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \
42 45 -L $(RABBITMQ_CLIENT_ROOT)/lib/aarch64-linux-gnu -lrabbitmq \
  46 + -L $(AUTHORITY_DIR)/lib -latlaslic \
43 47  
44 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&lt;task_id_t&gt; &amp;
395 395 }
396 396  
397 397 } // namespace pedestrian_vehicle_retrograde
398 398 -} // namespace ai_engine_module
  399 +} // namespace ai_engine_module
399 400 \ No newline at end of file
... ...
src/ai_platform/MultiSourceProcess.cpp
... ... @@ -26,6 +26,8 @@
26 26  
27 27 #define WITH_FACE_DET_SS
28 28  
  29 +#define productSN "51C4B28135604F649671727185949A91" //linux 通途抓拍引擎产品序列号
  30 +
29 31 using namespace std;
30 32  
31 33 map<int, algo_type> index_to_algo_type = {{0, algorithm_type_t::HUMAN_SNAPSHOT},
... ... @@ -82,10 +84,59 @@ CMultiSourceProcess::~CMultiSourceProcess(){
82 84 }
83 85  
84 86 int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){
  87 +#ifdef USE_VILLAGE
85 88 if (!CheckTime()) {
  89 + std::cout << "sy_licence_check failed." << std::endl;
86 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(&param_token, 0, sizeof(atlas_licence_token));
  105 +
  106 + int result = atlas_licence_connect(&(skt_handle), lic_param, &param_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 140 set_default_logger(LogLevel(vptParam.log_level), "multi_source_process", vptParam.log_path, vptParam.log_mem, vptParam.log_mem);
90 141 LOG_INFO("编译时间:{} {}", __DATE__, __TIME__);
91 142  
... ... @@ -111,23 +162,23 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){
111 162 return ret;
112 163 }
113 164  
  165 +#ifdef USE_VILLAGE
114 166 //三轮车头肩检测
115 167 if (!tricycle_manned_.init(vptParam.gpuid, models_dir)) {
116 168 LOG_FATAL("Init tricycle_hs failed");
117 169 return -1;
118 170 }
119   -
120 171 //货车头肩检测
121 172 if (!truck_manned_.init(vptParam.gpuid, models_dir)) {
122 173 LOG_FATAL("Init truck_hs failed");
123 174 return -1;
124 175 }
125   -
126 176 //二轮车头肩检测
127 177 if (!motor_hsprocess_.init(vptParam.gpuid, models_dir)) {
128 178 LOG_FATAL("Init motor_hs failed");
129 179 return -1;
130 180 }
  181 +#endif
131 182  
132 183 #ifdef WITH_FACE_DET_SS
133 184 // 人脸检测初始化
... ... @@ -190,7 +241,6 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){
190 241 }
191 242 , this);
192 243  
193   -
194 244 m_timing_snapshot_thread = new std::thread(
195 245 [](void* arg)
196 246 {
... ... @@ -457,7 +507,17 @@ bool CMultiSourceProcess::RestartTask(const string taskID){
457 507  
458 508 bool CMultiSourceProcess::FinishTask(const string taskID){
459 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 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 599  
540 600 void CMultiSourceProcess::CloseAllTask(){
541 601 m_bfinish = true;
542   -
  602 + atlas_licence_close(&(skt_handle)); //授权
543 603 DecoderManager* pDecManager = DecoderManager::getInstance();
544 604 pDecManager->closeAllDecoder();
545 605  
... ... @@ -601,7 +661,7 @@ void CMultiSourceProcess::clear_finished_task(){// 清理已经结束的任务
601 661 }
602 662  
603 663 ++ iter_finished;
604   - }
  664 + }
605 665 }
606 666  
607 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 669 // 任务结束,关闭跟踪
610 670 if (!vpt_process.finishTaskTracker(taskID))
611 671 LOG_ERROR("Finish VPT Tracker failed, task_id: {}", taskID);
612   -
  672 +
613 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 683 #endif
617 684  
618 685 // #ifdef WITH_SECOND_PROCESS
619 686 pedestrian_vehicle_retrograde_.force_release_result(taskID); //221024 byzsh
620 687 // #endif
  688 +#ifdef USE_VILLAGE
621 689 tricycle_manned_.force_release_result(taskID);
622 690 truck_manned_.force_release_result(taskID);
623 691 motor_hsprocess_.force_release_result(taskID);
624 692  
625 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 698 return true;
628 699 }
... ... @@ -635,19 +706,62 @@ int CMultiSourceProcess::algorthim_process_thread(){
635 706 ACL_CALL(aclrtCreateContext(&ctx, m_devId), ACL_ERROR_NONE, 1);
636 707  
637 708 while (true){
  709 +#ifdef USE_VILLAGE
638 710 if (!CheckTime()) {
639 711 LOG_FATAL("authority failed!");
640 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 756 if(m_bfinish){
644 757 break;
645 758 }
646 759  
647   - clear_finished_task();
  760 + clear_finished_task();
648 761  
649 762 vector<DeviceMemory*> vec_gpuMem;
650 763 m_DataListMtx.lock();
  764 +
651 765 while (!m_RgbDataList.empty()){
652 766 DeviceMemory* gpuMem = m_RgbDataList.front();
653 767 if(gpuMem->getMem() == nullptr){
... ... @@ -664,14 +778,14 @@ int CMultiSourceProcess::algorthim_process_thread(){
664 778 }
665 779 }
666 780 m_DataListMtx.unlock();
667   -
668   - if(vec_gpuMem.size() <= 0){
  781 +
  782 + if(vec_gpuMem.size() <= 0){
669 783 std::this_thread::sleep_for(std::chrono::milliseconds(3));
670 784 continue;
671 785 }
672 786  
673 787 aclrtSetCurrentContext(ctx);
674   - algorthim_vpt(vec_gpuMem);
  788 + algorthim_vpt(vec_gpuMem);
675 789  
676 790 #ifdef WITH_FACE_DET_SS
677 791 algorthim_face_detect(vec_gpuMem);
... ... @@ -761,8 +875,8 @@ int CMultiSourceProcess::algorthim_vpt(vector&lt;DeviceMemory*&gt; vec_gpuMem){
761 875 // 货车载人
762 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 880 #endif
767 881  
768 882 // if(vptResult.size() > 0){
... ... @@ -1387,10 +1501,11 @@ void CMultiSourceProcess::manned_snapshot(vector&lt;string&gt;&amp; vpt_interest_task_id,
1387 1501 string json_str = "";
1388 1502 std::vector<video_object_snapshot> algo_results;
1389 1503 for (int sp_idx = 0; sp_idx < 3; sp_idx ++) {
  1504 + int num = sp_idx + 1;
1390 1505 // 原图
1391 1506 LOG_DEBUG("原图");
1392 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 1510 ImgSaveInfo origin_save_info;
1396 1511 origin_save_info.file_path = fpath_origin;
... ... @@ -1402,7 +1517,7 @@ void CMultiSourceProcess::manned_snapshot(vector&lt;string&gt;&amp; vpt_interest_task_id,
1402 1517 LOG_DEBUG("抠图");
1403 1518 // 抠图
1404 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 1521 ImgSaveInfo obj_save_info;
1407 1522 obj_save_info.file_path = object_file_name;
1408 1523 obj_save_info.img_info = obj_value.snapShots[sp_idx].snapShotLittle;
... ... @@ -1737,4 +1852,4 @@ bool CMultiSourceProcess::CheckTime() {
1737 1852 {
1738 1853 return false;
1739 1854 }
1740   -}
1741 1855 \ No newline at end of file
  1856 +}
... ...
src/ai_platform/MultiSourceProcess.h
... ... @@ -20,7 +20,7 @@
20 20 #include "../ai_engine_module/truck_manned_process.h"
21 21 #include "../ai_engine_module/motocycle_hs_process.h"
22 22 #include "../util/JpegUtil.h"
23   -
  23 +#include "atlas_licence.h"//授权文件
24 24  
25 25 #ifdef POST_USE_RABBITMQ
26 26 #include "../reprocessing_module/mq_manager.hpp"
... ... @@ -119,6 +119,9 @@ private:
119 119 mutex m_FinishedTaskMtx;
120 120 map<string,bool> m_FinishedTaskMap;
121 121  
  122 + mutex m_ActiveFinishedTaskMtx ;
  123 + map<string,bool> m_ActiveFinishedTaskMap; // 记录主动结束的任务,不发送mq
  124 +
122 125 thread* m_pAlgorthimThread;
123 126 bool m_bfinish{false};
124 127  
... ... @@ -144,5 +147,9 @@ private:
144 147 mutex m_recoderinfo_queue_mtx;
145 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 156 \ No newline at end of file
... ...
src/decoder/Makefile_decoder 100755 → 100644
... ... @@ -60,4 +60,4 @@ $(TARGET):$(OBJS)
60 60 $(XX) $(CXXFLAGS) -c $<
61 61  
62 62 clean:
63   - rm -f *.o $(TARGET)
64 63 \ No newline at end of file
  64 + rm -f *.o $(TARGET)
... ...
src/demo/Makefile
... ... @@ -33,7 +33,7 @@ lib_dir=-L/usr/local/Ascend/ascend-toolkit/6.3.RC1/runtime/lib64 \
33 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 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 37 -L $(OPENCV_ROOT)/lib -lopencv_world\
38 38 -L $(JSON_ROOT)/lib -ljsoncpp \
39 39 -L $(FFMPEG_ROOT)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \
... ...
src/demo/demo.cpp
... ... @@ -3,31 +3,32 @@
3 3 #include <stdio.h>
4 4 #include <string.h>
5 5 #include <stdlib.h>
  6 +#include <unistd.h>
6 7  
7 8 using namespace std;
8 9  
9 10 #ifdef POST_USE_RABBITMQ
10 11  
11 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 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 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 20 strcpy(mq_conn_params.vhost, "/");
28 21 strcpy(mq_conn_params.exchange, "topExchange");
29 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 32 switch (key) {
32 33 case mq_type_t::ALARM_MQ: {
33 34 strcpy(mq_conn_params.queue, "topic.queue.alarm");
... ... @@ -650,7 +651,9 @@ string createTask(void *handle, std::vector&lt;algorithm_type_t&gt; algor_vec, int gi,
650 651 tparam.ipc_url = "rtsp://admin:ad123456@192.168.10.166:554/cam/realmonitor?channel=1&subtype=0";
651 652 break;
652 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 657 break;
655 658 case 4:
656 659 tparam.ipc_url = "/opt/share/data/Street.uvf";
... ... @@ -790,6 +793,14 @@ void test_gpu(int gpuID){
790 793 // std::vector<algorithm_type_t> algor_vec2 = {algorithm_type_t::TRICYCLE_MANNED, algorithm_type_t::TRUCK_MANNED};
791 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 805 // string task_id = createTask(handle, algor_vec, 3 + gpuID * 10);
795 806 // string task_id1 = createTask(handle, algor_vec2, 5);
... ... @@ -815,12 +826,18 @@ void test_gpu(int gpuID){
815 826 // createTask(handle, algor_vec, 17);
816 827 // createTask(handle, algor_vec, 18);
817 828 // createTask(handle, algor_vec, 19);
  829 +/*
818 830  
819 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 836 while (getchar() != 'q');
822 837  
823 838 // finish_task(handle, (char*)task_id.data(), 0);
  839 +
  840 + // finish_task(handle, (char*)task_id1.data(), 0);
824 841  
825 842 tsl_aiplatform_release(&handle);
826 843 }
... ... @@ -849,4 +866,4 @@ int main(int argc, char *argv[]) {
849 866 printf("Done.\n");
850 867  
851 868 return 0;
852   -}
853 869 \ No newline at end of file
  870 +}
... ...
src/reprocessing_module/save_snapshot_reprocessing.cpp
... ... @@ -114,4 +114,4 @@ void save_snapshot_reprocessing::save_img_process() {
114 114 }
115 115  
116 116 }
117 117 -}
  118 +}
118 119 \ No newline at end of file
... ...
src/reprocessing_module/snapshot_reprocessing.cpp
... ... @@ -770,6 +770,7 @@ void snapshot_reprocessing::release_finished_locus_snapshot(const string taskid,
770 770 VPCUtil::vpc_img_release(ss->second.snapShotLittle);
771 771 }
772 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 805 if (strcmp(ss->first.video_id.c_str(), taskid.c_str()) == 0)
805 806 {
806 807 if (bRelease){
807   - for (int i = 0; i < 3; i++) {
  808 + for (int i = 0; i < 3; i++) {
808 809 VPCUtil::vpc_img_release(ss->second.snapShots[i].snapShot);
809 810 VPCUtil::vpc_img_release(ss->second.snapShots[i].snapShotLittle);
810 811 }
811 812 }
812 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 82 void update_village_bestsnapshot(vector<DeviceMemory*> vec_devMem, vector<onelevel_det_result> &ol_det_result, vector<vector<int>>& delete_object_id);
83 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 88 private:
89 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 261 jstring str_taskParam_taskId = (jstring)env->GetObjectField(taskParam, fid_taskParam_taskId);
262 262 const char *taskParam_taskId = env->GetStringUTFChars(str_taskParam_taskId, JNI_FALSE);
263 263 jobject taskParam_algorConfigParams = env->GetObjectField(taskParam, fid_taskParam_algorConfigParams);
264   -
  264 +
265 265 jint taskParam_dec_type = env->GetIntField(taskParam, fid_taskParam_dec_type);
266 266 jint taskParam_port = env->GetIntField(taskParam, fid_taskParam_port);
267 267 jint taskParam_protocal = env->GetIntField(taskParam, fid_taskParam_protocal);
... ... @@ -272,7 +272,6 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter
272 272 jfieldID fid_syRectParam_width = env->GetFieldID(cls_syRectParam, "width", "I");
273 273 jfieldID fid_syRectParam_height = env->GetFieldID(cls_syRectParam, "height", "I");
274 274  
275   -
276 275 // java to C++
277 276 task_param mTaskParam;
278 277 mTaskParam.ipc_url = taskParam_ipcUrl;
... ... @@ -290,7 +289,7 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter
290 289 map<int, char *> psnapshot_AlgorConfigParamResSnapshotFolderMap;
291 290 map<int, jstring> snapshot_AlgorConfigParamResVideoFolderMap;
292 291 map<int, char *> psnapshot_AlgorConfigParamResVideoFolderMap;
293   -
  292 +
294 293 jclass cls_arraylist = env->FindClass("java/util/ArrayList");
295 294 // method in class ArrayList
296 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 308  
310 309 jclass cls_AlgorConfigParam = env->GetObjectClass(algorConfigParam_algorInitParam);
311 310  
312   -
313 311 /* assign public variables. */
314 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 315 env->GetFieldID(cls_AlgorConfigParam, "algor_valid_rect", "Lcom/objecteye/pojo/common/SyRectParam;");
318 316 jobject ssAlgorConfigParam_algorRect =
319 317 env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_algorRect);
320   -
  318 +
321 319 jint ssAlgorConfigParam_algorRect_left = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_left);
322 320 jint ssAlgorConfigParam_algorRect_top = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_top);
323 321 jint ssAlgorConfigParam_algorRect_width = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_width);
324 322 jint ssAlgorConfigParam_algorRect_height = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_height);
325   -
  323 +
326 324 jfieldID fid_ssAlgorConfigParam_snapshotLittleFolder =
327 325 env->GetFieldID(cls_AlgorConfigParam, "result_folder_little", "Ljava/lang/String;");
328 326 jfieldID fid_ssAlgorConfigParam_snapshotFolder =
329 327 env->GetFieldID(cls_AlgorConfigParam, "result_folder", "Ljava/lang/String;");
330 328 jfieldID fid_ssAlgorConfigParam_videoFolder =
331 329 env->GetFieldID(cls_AlgorConfigParam, "video_folder", "Ljava/lang/String;"); //视频存储地址
332   -
  330 +
333 331 snapshot_little_AlgorConfigParamResSnapshotFolderMap[i] =
334 332 (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_snapshotLittleFolder);
335 333 psnapshot_little_AlgorConfigParamResSnapshotFolderMap[i] =
... ... @@ -342,7 +340,7 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter
342 340 (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_videoFolder);
343 341 psnapshot_AlgorConfigParamResVideoFolderMap[i] =
344 342 (char *)env->GetStringUTFChars(snapshot_AlgorConfigParamResVideoFolderMap[i], JNI_FALSE);
345   -
  343 +
346 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 383 case algorithm_type_t::TRICYCLE_MANNED:
386 384 case algorithm_type_t::TRUCK_MANNED: {
387 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 387 fid = env->GetFieldID(cls_AlgorConfigParam, "m_frame", "I");
391 388 jint j_m_frame = env->GetIntField(algorConfigParam_algorInitParam, fid);
392   -
393 389 fid = env->GetFieldID(cls_AlgorConfigParam, "n_frame", "I");
394 390 jint j_n_frame = env->GetIntField(algorConfigParam_algorInitParam, fid);
395   -
396 391 fid = env->GetFieldID(cls_AlgorConfigParam, "obj_min_width", "I");
397 392 jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid);
398   -
399 393 fid = env->GetFieldID(cls_AlgorConfigParam, "obj_min_height", "I");
400 394 jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid);
401   -
402 395 fid = env->GetFieldID(cls_AlgorConfigParam, "obj_confidence_threshold", "F");
403 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 400 typedef algor_config_param_manned_incident algor_config_param_type;
408 401 mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type;
409 402 auto algor_param =
410 403 (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param;
411   -
  404 +
412 405 algor_param->m = (int)j_m_frame;
413 406 algor_param->n = (int)j_n_frame;
414 407 algor_param->hs_count_threshold = (int)j_hs_threshold;
415   -
  408 +
416 409 algor_param->obj_min_width = (int)j_min_width;
417 410 algor_param->obj_min_height = (int)j_min_height;
418 411 algor_param->obj_confidence_threshold = (float)j_confidence_threshold;
... ... @@ -490,8 +483,8 @@ JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInter
490 483 algor_param->n = (int)j_n_frame;
491 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 488 } break;
496 489 case algorithm_type_t::PEDESTRIAN_FIGHT: {
497 490 jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "threshold", "F");
... ...