/** * 选取最优结果Engine * */ #ifndef SELECTBESTENGINE_H #define SELECTBESTENGINE_H #include "AppCommon.h" #include "EngineBase.h" #include "EngineFactory.h" class SelectBestEngine : public ai_matrix::EngineBase { public: SelectBestEngine(); ~SelectBestEngine(); APP_ERROR Init() override; APP_ERROR DeInit() override; APP_ERROR Process() override; private: //初始化车号参数信息 void InitContainerParam(); //初始化车号参数信息 void InitNumParam(); //初始化属性参数信息 void InitProParam(); //初始化车头参数信息 void InitHeadParam(); //初始化参数信息 void InitParam(); //获取最优长度 int GetBestLength(std::vector &vecAllTransInfo, TargetMaxLen iMaxLen); //获取最优结果 std::string GetBest(std::vector &vecAllTransInfo, TargetMaxLen iMaxLen); // 车号数据加入到待选优集合中 void numAddSelectBestMap(const int iFrameId, const Step2ResultData &step2ResultData); // 属性数据加入到待选优集合中 void proAddSelectBestMap(const int iFrameId, const Step2ResultData &step2ResultData); // 集装箱数据加入到待选优集合中 void containerAddSelectBestMap(const int iFrameId, const Step2ResultData &step2ResultData); //车头数据加入到待选优集合中 void headAddSelectBestMap(const int iFrameId, const Step2ResultData &step2ResultData); //汇总车头 // bool getHeadBest(std::shared_ptr pProcessData); void getContainerBest(VTrainInfo &train, std::shared_ptr pVStep2OutputData); void getNumBest(VTrainInfo &train, std::shared_ptr pVStep2OutputData); void getProBest(VTrainInfo &train, std::shared_ptr pVStep2OutputData); //汇总车厢 void getTrainBest(std::shared_ptr pVStep2OutputData); //拷贝最优图片到最优路径下 void copyBestImgToBestPath(const VTrainInfo &train); bool readPartionJson(std::string &strJsonPath, PartionInfo &partionInfo); std::string strPort0_; std::string strPort1_; int iSelectBestMode_ = LENGTH; //选优模式 std::string strResultPath_; std::string strBestPath_; ai_matrix::BaseConfig baseConfig_; ai_matrix::DataSourceConfig dataSourceConfig_; ai_matrix::IdentifyConfig identifyConfig_; // int iNumIndex_ = 1; //当前车号所属车厢号 // int iProIndex_ = 1; //当前属性所属车厢号 int iContainerIndex_ = 0; //当前集装箱序号 PartionInfo partionInfo_; std::map> mapContainerInfo_; //集装箱待选优集合 key [0:第一个箱子; 1:第二个箱子] std::map mapMaxScoreSumContainer_; std::map mapBestContainerImg_; std::map mapStep1BestContainer_; // float fMaxScoreSumContainer_; //当前集装箱号最高得分 // std::string strBestContainerImg_; //当前集装箱号最高分的图片名 Step2ResultData step1BestContainer_; //当前集装箱号最高分的图片大框坐标 float fCenter_X_pre_ = 0.0f; std::map> mapNumInfo_; //车号待选优集合 key [0:车型; 1:编号] float fMaxScoreSumNum_; //当前车厢车号最高得分 std::string strBestNumImg_; //当前车厢车号最高分的图片名 Step2ResultData step1BestNum_; //当前车厢车号最高分的图片大框坐标 std::map mapTrainTypeId_; //车厢类型ID集合 [key:车厢类型ID; value:识别到次数] (标识哪种类型的车,根据车号大框区分) std::map> mapProInfo_; //属性待选优集合 key [0:载重; 1:自重; 2:容积; 3:换长; 4:容量记表] float fMaxScoreSumPro_; //当前车厢属性最高得分 std::string strBestProImg_; //当前车厢属性最高分的图片名 Step2ResultData step1BestPro_; //当前车厢属性最高分的图片大框坐标 std::map> mapHeadInfo_; //车头待选优集合 key [0:车头型号; 1:车头编号] float fMaxScoreSumHead_; //车头最高得分 std::string strBestHeadImg_; //车头最高分的图片名 Step2ResultData step1BestHead_; //车头最高分的图片大框坐标 std::map mapTrainIndex_ = { {"HEAD",0}, {"NUM",0}, {"PRO",0}, {"CONTAINER_1",0}, {"CONTAINER_2",0} }; std::map mapLoad_ = { {"C62", "60"}, {"C62B", "61"}, {"C63", "61"}, {"C64", "61"}, {"C65", "60"}, {"C70", "70"}, {"C80", "80"}, {"KM70", "70"}, {"KM81", "81"}, {"KM98", "98"} }; }; ENGINE_REGIST(SelectBestEngine) #endif