Train_Identify/nvidia_ascend_engine/common_engine/SelectBestEngine/SelectBestEngine.h

92 lines
4.1 KiB
C
Raw Normal View History

2024-01-23 02:46:26 +00:00
/**
* Engine
* */
#ifndef SELECTBESTENGINE_H
#define SELECTBESTENGINE_H
#include "AppCommon.h"
#include "MyYaml.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 InitNumParam();
//初始化属性参数信息
void InitProParam();
//初始化车头参数信息
void InitHeadParam();
//初始化参数信息
void InitParam();
//获取最优长度
int GetBestLength(std::vector<TransInfo> &vecAllTransInfo, TargetMaxLen iMaxLen);
//获取最优结果
std::string GetBest(std::vector<TransInfo> &vecAllTransInfo, TargetMaxLen iMaxLen);
//车号数据加入到待选优集合中
void NumAddSelectBestMap(std::shared_ptr<ProcessData> pProcessData, TransSubData &transSubData);
//属性数据加入到待选优集合中
void ProAddSelectBestMap(std::shared_ptr<ProcessData> pProcessData, TransSubData &transSubData);
//车头数据加入到待选优集合中
void HeadAddSelectBestMap(std::shared_ptr<ProcessData> pProcessData, TransSubData &transSubData);
//汇总车头
bool GetHeadBest(std::shared_ptr<ProcessData> pProcessData);
void GetNumBest(TrainNum &trainNum, std::shared_ptr<ProcessData> pProcessData);
void GetProBest(TrainPro &trainPro, std::shared_ptr<ProcessData> pProcessData);
//汇总车厢
void GetTrainBest(std::shared_ptr<ProcessData> pProcessData);
//拷贝最优图片到最优路径下
void CopyBestImgToBestPath(const std::shared_ptr<Train> &pTrain);
//push数据到队列队列满时则休眠一段时间再push
void PushData(const std::string &strPort, const std::shared_ptr<Train> &pTrain);
std::string strPort0_;
std::string strPort1_;
int iSelectBestMode_; //选优模式
std::string strResultPath_;
std::string strBestPath_;
int iNumIndex_ = 1; //当前车号所属车厢号
int iProIndex_ = 1; //当前属性所属车厢号
std::map<int, std::vector<TransInfo>> mapNumInfo_; //车号待选优集合 key [0:车型; 1:编号]
float fMaxScoreSumNum_; //当前车厢车号最高得分
std::string strBestNumImg_; //当前车厢车号最高分的图片名
uint64_t i64TimeStampNum_ = 0; //当前车厢车号最高分的图片时间戳
Step1Location step1LocationBestNum_; //当前车厢车号最高分的图片大框坐标
std::map<int, int> mapTrainTypeId_; //车厢类型ID集合 [key:车厢类型ID; value:识别到次数] (标识哪种类型的车,根据车号大框区分)
uint32_t iDataSourceNum_ = 0;
std::map<int, std::vector<TransInfo>> mapProInfo_; //属性待选优集合 key [0:载重; 1:自重; 2:容积; 3:换长; 4:容量记表]
float fMaxScoreSumPro_; //当前车厢属性最高得分
std::string strBestProImg_; //当前车厢属性最高分的图片名
uint64_t i64TimeStampPro_ = 0; //当前车厢属性最高分的图片时间戳
Step1Location step1LocationBestPro_; //当前车厢属性最高分的图片大框坐标
uint32_t iDataSourcePro_ = 0;
std::map<int, std::vector<TransInfo>> mapHeadInfo_; //车头待选优集合 key [0:车头型号; 1:车头编号]
float fMaxScoreSumHead_; //车头最高得分
std::string strBestHeadImg_; //车头最高分的图片名
uint64_t i64TimeStampHead_ = 0; //车头最高分的图片时间戳
Step1Location step1LocationBestHead_; //车头最高分的图片大框坐标
uint32_t iDataSourceHead_ = 0;
std::map<int, bool> mapDataSourceIsEnd_; //[key-数据源id, value-数据是否结束]
};
ENGINE_REGIST(SelectBestEngine)
#endif