123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- /**
- *
- * gsd_CenterGroup.h
- *
- */
- #pragma once
- #include <drogon/plugins/Plugin.h>
- #include <drogon/drogon.h>
- #include "config.hpp"
- #include "Util/logger.h"
- #include "Poller/Timer.h"
- #include "httplib.h"
- using namespace toolkit;
- namespace gsd
- {
- class CenterGroup : public drogon::Plugin<CenterGroup>
- {
- public:
- CenterGroup() {}
- /// This method must be called by drogon to initialize and start the plugin.
- /// It must be implemented by the user.
- void initAndStart(const Json::Value &config) override;
- /// This method must be called by drogon to shutdown the plugin.
- /// It must be implemented by the user.
- void shutdown() override;
- /**
- * @description: 获取比例
- * @return {*}
- */
- double getProportion();
- /**
- * @description: 获取推理引擎
- * @return {*}
- */
- std::string getInferEngine();
- /**
- * @description: readJsonFromString
- * @param {string&} mystr
- * @return {*}
- */
- static Json::Value readJsonFromString(const string& mystr);
- /**
- * @description: 获取版本
- * @return {*}
- */
- std::string getVersion();
- /**
- * @description: getDebug
- * @return {*}
- */
- int getDebug();
- /**
- * @description: 获取
- * @return {*}
- */
- vector<int> getInferTargets();
- /**
- * @description: InferTargets
- * @param {vector<int>} data
- * @return {*}
- */
- void setInferTargets(vector<int> data);
- /**
- * @description: getAlienLabels
- * @return {*}
- */
- vector<int> getAlienLabels();
- /**
- * @description: setAlienLabels
- * @param {vector<int>} data
- * @return {*}
- */
- void setAlienLabels(vector<int> data);
- /**
- * @description: getInferSave
- * @param {*}
- * @return {*}
- */
- bool getInferSave();
- /**
- * @description: getSavePath
- * @param {*}
- * @return {*}
- */
- std::string getSavePath();
- protected:
- /**
- * @description: 更新数据
- * @return {*}
- */
- void Update();
- private:
- gsd::config::Ptr m_config = nullptr;
- Timer::Ptr ConfigTimer = nullptr;
- std::string apiKey = "sunwin202110291532";
- std::string spug_ip = "192.168.1.1";
- int spug_port = 9090;
- std::string app = "gsd_";
-
- // string
- std::string gsd_check_Engine = "best6_fp16.engine";
- // 比例过滤器阈值
- double gsd_check_Proportion_th = 0.5;
- // 数据记录
- int gsd_check_InferSave = 0;
- std::string gsd_check_SavePath = "./data/";
- };
- }
|