#include "DetectorAPI.h" #include "YoloCrowdDetector.h" SDKAPI TZ_INT Initialize() { return masd::MEC_OK; } SDKAPI TZ_INT Dispose() { return masd::MEC_OK; } SDKAPI masd::Detector* BuildDetector() { masd::Detector* det = new masd::yolocrowd::YoloCrowdDetector("YoloCrowd", "人头目标检测"); return det; } SDKAPI void DestroyDetector(masd::Detector* detector) { TZ_delete(detector); } SDKAPI TZ_INT GetInformation(TZ_CHAR* information) { masd::DetectorInfo info; info.Key = "YoloCrowd"; info.Name = "人头目标检测"; info.Version = "V1.0.0-T-20241007R"; info.Author = "杭州晨鹰军泰"; info.UpdateDate = "2024-10-07 09:30:00"; info.InputType = masd::EN_BUFFER_TYPE::MRT_BGR; masd::DetectCfg paramInfo(masd::DIT_FORM, "target", "检测目标类型", "人头", "NAN", "NAN", "NAN", {"head"}); info.ParamTemp = paramInfo.toJson(); masd::yolocrowd::YoloCrowdDetectResult rstInfo; masd::yolocrowd::DetObj objs; rstInfo.objs.push_back(objs); info.RstTemp = rstInfo.toJson(); std::vector buildInfos; buildInfos.emplace_back(masd::DIT_INT, "gpu_id", "GPU ID", "0", "0", "0", "0"); buildInfos.emplace_back(masd::DIT_INT, "max_objects", "检测结果数量上限", "1024", "1", "4096", "1"); buildInfos.emplace_back(masd::DIT_DOUBLE, "confidence_threshold", "全局置信度下限阈值", "0.05", "0.0", "1.0", "0.01"); buildInfos.emplace_back(masd::DIT_DOUBLE, "nms_threshold", "NMS阈值", "0.45", "0.0", "1.0", "0.01"); buildInfos.emplace_back(masd::DIT_STRING, "model_path", "YOLO模型路径", PROGRAM_ROOT_PATH "models/yolo-crowd.trt", "NAN", "NAN", "NAN"); info.BuildTemp = tzc::json::ArrayToJson(buildInfos); info.AreaTemp = "[focus, ignore]"; info.InitParam = "{\"gpu_id\": 0, \"max_objects\": 1024, \"confidence_threshold\": 0.05, \"nms_threshold\": 0.45, \"model_path\": \"" PROGRAM_ROOT_PATH "models/yolo-crowd.trt\"}"; strcpy(information, info.toJson().c_str()); return masd::MEC_OK; }