#ifndef _AIModelParam_H_ #define _AIModelParam_H_ #include #include #include "JsonCoversion.h" #include "AI_Moudel.hpp" // AI-图片参数参数 struct AI_Image_Param { int width; int height; int channels; int N; AI_Image_Param() { Init(); } void Init() { width = 0; height = 0; channels = 0; N = 0; } void copy(AI_Image_Param tem) { this->width = tem.width; this->N = tem.N; this->height = tem.height; this->channels = tem.channels; } void print(std::string str) { printf("%s n w h c= %d %d %d %d\n", str.c_str(), N, width, height, channels); } }; // AI-模型主要参数 struct AI_Model_Param { int ID; int type; std::string strAIModelName; std::string strModelPath; std::string strModelPath_1; std::string strOutName; AI_Image_Param in_img; AI_Image_Param out_img; std::shared_ptr pdetect; AI_Model_Param() { pdetect = NULL; Init(); } void Init() { strModelPath = ""; strAIModelName = ""; strModelPath_1 = ""; ID = 0; type = 0; strOutName = ""; if (pdetect != NULL) { pdetect->release(); } } // void copy(AI_Model_Param tem) // { // this->strModelPath = tem.strModelPath; // this->strAIModelName = tem.strAIModelName; // this->in_img.copy(tem.in_img); // this->out_img.copy(tem.out_img); // this->ID = tem.ID; // this->type = tem.type; // this->strOutName = tem.strOutName; // } void print(std::string str) { printf("%s modelPath %s AIModelName %s strOutName %s ID %d type %d\n", str.c_str(), strModelPath.c_str(), strAIModelName.c_str(), strOutName.c_str(), ID, type); in_img.print("in_img"); out_img.print("out_img"); } }; struct AI_Model_ConfigList { std::vector AIModelConfigList; AI_Model_ConfigList() { Init(); } void Init() { AIModelConfigList.erase(AIModelConfigList.begin(), AIModelConfigList.end()); } void print(std::string str) { for (int i = 0; i < AIModelConfigList.size(); i++) { AIModelConfigList.at(i).print(std::to_string(i)); } } }; class AIModelParamJson : public JsonCoversion { public: AIModelParamJson() {} virtual ~AIModelParamJson() {} public: virtual Json::Value toJsonValue(); virtual void toObjectFromValue(Json::Value root); int GetConfig(std::shared_ptr &pconfig); private: std::shared_ptr m_pconfig; }; #endif