#include "HumanAnalysis.h" static std::string body_colors[] = { "黑", "白", "灰", "红", "蓝", "黄", "绿", "多色", "其他" }; HumanAnalysis::HumanAnalysis(/* args */) { } HumanAnalysis::~HumanAnalysis() { release(); } int HumanAnalysis::init(int devId, std::string sdk_root){ ACL_CALL(aclrtCreateContext(&ctx, devId), SY_SUCCESS, SY_FAILED); ACL_CALL(aclrtSetCurrentContext(ctx), SY_SUCCESS, SY_FAILED); std::string model_path = sdk_root + "/models/hp/hp220908_310p.om"; hp_param param; param.modelNames = (char*)model_path.data(); param.devId = devId; LOG_INFO("hp_init start"); int ret = hp_init(&m_handle, param); if (ret != 0) { return -1; } LOG_INFO("hp_init success"); return SY_SUCCESS; } vector HumanAnalysis::detect(vector vec_img){ const int batchsize = vec_img.size(); hp_analysis_res * results = new hp_analysis_res[batchsize]; int ret = SY_FAILED; vector vec_body_color; do { ret = aclrtSetCurrentContext(ctx); if (SY_SUCCESS != ret) { printf("aclrtSetCurrentContext failed!"); break; } ret = hp_batch(m_handle, vec_img.data(), batchsize, results); if (SY_SUCCESS != ret) { printf("hp_batch failed!"); break; } for(int batchIdx = 0;batchIdx