#include "HumanFeature.h" #include "humanreid.h" HumanFeature::HumanFeature(/* args */) { } HumanFeature::~HumanFeature() { release(); } int HumanFeature::init(int dev_id, string model_dir){ string model_path = model_dir + "/models/human_reid2/humanreid_310p.om" ; LOG_INFO("hp 版本:{} 模型路径:{}", humanreid_get_version(), model_path); humanreid_param param; char modelNames[100]; strcpy(modelNames, model_path.c_str()); param.modelNames = modelNames; param.devId = dev_id; m_devId = param.devId; ACL_CALL(aclrtSetDevice(m_devId), ACL_SUCCESS, -1); ACL_CALL(aclrtCreateContext(&m_algorthim_ctx, m_devId), ACL_SUCCESS, -1); int ret = humanreid_init(&m_handle, param); if(ret != 0){ LOG_ERROR("humanreid_init error."); return -1; } return 0; } vector HumanFeature::process(vector vec_gpuMem) { int batchsize = vec_gpuMem.size(); vector batch_img; for (int i = 0; i < vec_gpuMem.size(); i++) { DeviceMemory* mem = vec_gpuMem[i]; sy_img img; img.w_ = mem->getWidth(); img.h_ = mem->getHeight(); img.c_ = mem->getChannel(); img.data_ = mem->getMem(); batch_img.push_back(img); } float ** feature=new float*[batchsize]; for(int b=0;b vec_hf_res; for(int batchIdx = 0;batchIdx