gsd_CenterGroup.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /**
  2. *
  3. * gsd_CenterGroup.h
  4. *
  5. */
  6. #pragma once
  7. #include <drogon/plugins/Plugin.h>
  8. #include <drogon/drogon.h>
  9. #include "config.hpp"
  10. #include "Util/logger.h"
  11. #include "Poller/Timer.h"
  12. #include "httplib.h"
  13. using namespace toolkit;
  14. namespace gsd
  15. {
  16. class CenterGroup : public drogon::Plugin<CenterGroup>
  17. {
  18. public:
  19. CenterGroup() {}
  20. /// This method must be called by drogon to initialize and start the plugin.
  21. /// It must be implemented by the user.
  22. void initAndStart(const Json::Value &config) override;
  23. /// This method must be called by drogon to shutdown the plugin.
  24. /// It must be implemented by the user.
  25. void shutdown() override;
  26. /**
  27. * @description: 获取比例
  28. * @return {*}
  29. */
  30. double getProportion();
  31. /**
  32. * @description: 获取推理引擎
  33. * @return {*}
  34. */
  35. std::string getInferEngine();
  36. /**
  37. * @description: readJsonFromString
  38. * @param {string&} mystr
  39. * @return {*}
  40. */
  41. static Json::Value readJsonFromString(const string& mystr);
  42. /**
  43. * @description: 获取版本
  44. * @return {*}
  45. */
  46. std::string getVersion();
  47. /**
  48. * @description: getDebug
  49. * @return {*}
  50. */
  51. int getDebug();
  52. /**
  53. * @description: 获取
  54. * @return {*}
  55. */
  56. vector<int> getInferTargets();
  57. /**
  58. * @description: InferTargets
  59. * @param {vector<int>} data
  60. * @return {*}
  61. */
  62. void setInferTargets(vector<int> data);
  63. /**
  64. * @description: getAlienLabels
  65. * @return {*}
  66. */
  67. vector<int> getAlienLabels();
  68. /**
  69. * @description: setAlienLabels
  70. * @param {vector<int>} data
  71. * @return {*}
  72. */
  73. void setAlienLabels(vector<int> data);
  74. /**
  75. * @description: getInferSave
  76. * @param {*}
  77. * @return {*}
  78. */
  79. bool getInferSave();
  80. /**
  81. * @description: getSavePath
  82. * @param {*}
  83. * @return {*}
  84. */
  85. std::string getSavePath();
  86. protected:
  87. /**
  88. * @description: 更新数据
  89. * @return {*}
  90. */
  91. void Update();
  92. private:
  93. gsd::config::Ptr m_config = nullptr;
  94. Timer::Ptr ConfigTimer = nullptr;
  95. std::string apiKey = "sunwin202110291532";
  96. std::string spug_ip = "192.168.1.1";
  97. int spug_port = 9090;
  98. std::string app = "gsd_";
  99. // string
  100. std::string gsd_check_Engine = "best6_fp16.engine";
  101. // 比例过滤器阈值
  102. double gsd_check_Proportion_th = 0.5;
  103. // 数据记录
  104. int gsd_check_InferSave = 0;
  105. std::string gsd_check_SavePath = "./data/";
  106. };
  107. }