123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #include "DetectorAPI.h"
- #include "AbandObjDetector.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::abandobj::AbandObjDetector("AbandObj", "遗留物检测");
- return det;
- }
- SDKAPI void DestroyDetector(masd::Detector* detector)
- {
- TZ_delete(detector);
- }
- SDKAPI TZ_INT GetInformation(TZ_CHAR* information)
- {
- masd::DetectorInfo info;
- info.Key = "AbandObj";
- info.Name = "遗留物检测";
- info.Version = "V1.0.0-T-20241214R";
- info.Author = "杭州晨鹰军泰";
- info.UpdateDate = "2024-12-14 09:30:00";
- info.InputType = masd::EN_BUFFER_TYPE::MRT_BGR;
- std::vector<masd::DetectCfg> paramInfos;
- paramInfos.emplace_back(masd::DIT_STRING,
- "algo", "算法类型", "MOG", "NAN", "NAN", "NAN");
- paramInfos.emplace_back(masd::DIT_INT,
- "factor", "下采样因子", "4", "1", "16", "1");
- paramInfos.emplace_back(masd::DIT_DOUBLE,
- "short_term_rate", "短期学习率", "0.01", "0.0001", "1.0", "0.0001");
- paramInfos.emplace_back(masd::DIT_INT,
- "short_term_history", "短期历史帧数", "200", "10", "1000", "10");
- paramInfos.emplace_back(masd::DIT_DOUBLE,
- "long_term_rate", "长期学习率", "0.0005", "0.00001", "0.1", "0.00001");
- paramInfos.emplace_back(masd::DIT_INT,
- "long_term_history", "长期历史帧数", "5000", "100", "20000", "100");
- paramInfos.emplace_back(masd::DIT_DOUBLE,
- "var_threshold", "阈值变化量", "16.0", "0.1", "100.0", "0.1");
- paramInfos.emplace_back(masd::DIT_BOOL,
- "detect_shadows", "是否检测阴影", "TRUE", "FALSE", "TRUE", "NAN");
- paramInfos.emplace_back(masd::DIT_DOUBLE,
- "iou_threshold", "IOU阈值", "0.6", "0.1", "1.0", "0.01");
- paramInfos.emplace_back(masd::DIT_DOUBLE,
- "area_threshold", "面积阈值", "625.0", "1.0", "10000.0", "1.0");
- paramInfos.emplace_back(masd::DIT_DOUBLE,
- "perimeter_threshold", "周长阈值", "100.0", "1.0", "1000.0", "1.0");
- paramInfos.emplace_back(masd::DIT_DOUBLE,
- "confidence_threshold", "关键点置信度阈值", "0.05", "0.0", "1.0", "0.01");
- paramInfos.emplace_back(masd::DIT_INT,
- "valid_cnt", "可信关键点数量阈值", "7", "0", "14", "1");
- info.ParamTemp = tzc::json::ArrayToJson(paramInfos);
- masd::abandobj::AbandObjDetectResult rstInfo;
- masd::abandobj::Proposal props;
- rstInfo.proposals.push_back(props);
- info.RstTemp = rstInfo.toJson();
- std::vector<masd::DetectCfg> buildInfos;
- buildInfos.emplace_back(masd::DIT_STRING, "algo", "算法类型", "MOG2", "NAN", "NAN", "NAN");
- buildInfos.emplace_back(masd::DIT_INT, "factor", "下采样因子", "4", "1", "16", "1");
- buildInfos.emplace_back(masd::DIT_DOUBLE, "short_term_rate", "短期学习率", "0.01", "0.0001", "1.0", "0.0001");
- buildInfos.emplace_back(masd::DIT_INT, "short_term_history", "短期历史帧数", "200", "10", "1000", "10");
- buildInfos.emplace_back(masd::DIT_DOUBLE, "long_term_rate", "长期学习率", "0.0005", "0.00001", "0.1", "0.00001");
- buildInfos.emplace_back(masd::DIT_INT, "long_term_history", "长期历史帧数", "5000", "100", "20000", "100");
- buildInfos.emplace_back(masd::DIT_DOUBLE, "var_threshold", "阈值变化量", "16.0", "0.1", "100.0", "0.1");
- buildInfos.emplace_back(masd::DIT_BOOL, "detect_shadows", "是否检测阴影", "TRUE", "FALSE", "TRUE", "NAN");
- buildInfos.emplace_back(masd::DIT_DOUBLE, "iou_threshold", "IOU阈值", "0.6", "0.1", "1.0", "0.01");
- buildInfos.emplace_back(masd::DIT_DOUBLE, "area_threshold", "面积阈值", "625.0", "1.0", "10000.0", "1.0");
- buildInfos.emplace_back(masd::DIT_DOUBLE, "perimeter_threshold", "周长阈值", "100.0", "1.0", "1000.0", "1.0");
- info.BuildTemp = tzc::json::ArrayToJson(buildInfos);
- info.AreaTemp = "[focus, ignore]";
- info.InitParam = "{\"algo\": \"MOG2\", "
- "\"factor\": 4, "
- "\"short_term_rate\": 0.01, "
- "\"short_term_history\": 200, "
- "\"long_term_rate\": 0.0005, "
- "\"long_term_history\": 5000, "
- "\"var_threshold\": 16.0, "
- "\"detect_shadows\": true, "
- "\"iou_threshold\": 0.6, "
- "\"area_threshold\": 625.0, "
- "\"perimeter_threshold\": 100.0}";
- strcpy(information, info.toJson().c_str());
- return masd::MEC_OK;
- }
|