/******************************************************************************************* * Version: VPT_x64_V2.0.0_20170705 * CopyRight: 中科院自动化研究所模式识别实验室图像视频组 * UpdateDate: 20170705 * Content: 人车物监测跟踪 ********************************************************************************************/ #pragma once #include #include #include #include "sort/Sort.h" #include "acl/acl.h" #include "acl/ops/acl_dvpp.h" #include "../util/vpc_util.h" #include "../util/JpegUtil.h" using namespace std; // #define THRESHOLD 0.45 #define THRESHOLD 0.3 struct TaskTracker { string TaskID; double ratioWidth; double ratioHeight; Sort tracker; }; typedef struct VPTProcess_PARAM { int gpuid; //指定显卡id float threshold; int max_batch; char* serialize_file; char* auth_license; string model_dir; VPTProcess_PARAM() : gpuid(0), threshold(0.6), max_batch(20) {}; }VPTProcess_PARAM; class VPTProcess { public: VPTProcess(); ~VPTProcess(); /************************************************************************* * FUNCTION: VPT_Init * PURPOSE: 初始化 * PARAM: [in] vparam 参数 * RETURN: handle * NOTES: *************************************************************************/ int init(VPTProcess_PARAM vparam); /** * @brief 人车物检测跟踪 * * @param handle [in] * @param batch_img [in] * @param batchsize [in] * @param result [in] * @param deleteObjectID [in] * @param unUsedResult [in] * @param class_label_count [in/out] * @return int -1:图像错误; 其他:检测到的个数 */ int process_gpu(sy_img * batch_img, vector& tasklist, vector& result, vector>& deleteObjectID, vector>& unUsedResult); int process_gpu(sy_img * batch_img, vector vec_vptMem, vector& tasklist, vector& result, vector>& deleteObjectID, vector>& unUsedResult); /************************************************************************* * FUNCTION: VPT_Release * PURPOSE: 资源释放 * PARAM: [in] handle - 处理句柄 * RETURN: NULL * NOTES: *************************************************************************/ void release(); void addTaskTracker(const string taskID, double rWidth =1, double rHeight=1, int skip_frame=5); //221117byzsh bool finishTaskTracker(const string taskID); private: int m_devId; aclrtContext m_algorthim_ctx; JpegUtil jpegUtil; void* m_det_handle{nullptr}; float threshold{0.6}; int m_max_batchsize; map taskTrackers; };