Train_Identify/nvidia_ascend_engine/common_engine/SelectBestEngine/SelectBestContainerEngine_N...

111 lines
3.9 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**SelectBestContainerEngine_NEW
* 集装箱选取最优结果Engine
* */
#ifndef SELECTBESTCONTAINERENGINE_NEW_H
#define SELECTBESTCONTAINERENGINE_NEW_H
#include "AppCommon.h"
#include "MyYaml.h"
#include "EngineBase.h"
#include "EngineFactory.h"
class SelectBestContainerEngine_NEW : public ai_matrix::EngineBase
{
public:
SelectBestContainerEngine_NEW();
~SelectBestContainerEngine_NEW();
APP_ERROR Init() override;
APP_ERROR DeInit() override;
APP_ERROR Process() override;
private:
//初始化参数信息
void InitParam();
//验证集装箱号是否满足规则(前10位依次与2^0 ~2^9相乘/11 所得余数,即是校验位)
bool VerifyContainerNo(std::string &strContainerNo);
//构造最优集装箱信息
void MakeBestContainer(Container &containerBest,
TransSubData *pTransSubData,
std::shared_ptr<ProcessData> pProcessData);
void DealContainer(std::shared_ptr<ProcessData> pProcessData, TransSubData &transSubData,
std::map<int, std::map<int, std::vector<Container>>> &mapSidContainers,
std::map<int, Step1Location> &mapStep1Pre, std::map<int, bool> &mapSecondFlag);
void SelectBestTrainContainer(std::shared_ptr<TrainContainer> pTrainContainer);
//获取每个摄像头的最优箱号
void GetBestContainerBySid(std::map<int, std::map<int, std::vector<Container>>> &mapSidContainers,
std::map<int, std::vector<Container>> &mapSidConBest);
//获取所有摄像头最优箱号
void GetBestContainer(TrainContainer &trainContainerSucc,
TrainContainer &trainContainerFail,
std::map<int, std::vector<Container>> &mapSidConBest);
std::string strPort0_;
std::string strPort1_;
std::map<int, bool> mapDataSourceIsEnd_; //[key-数据源id, value-数据是否结束]
std::set<int> setTopContainerSid_; //[顶部集装箱数据源ID]
//正向信息
std::map<int, std::map<int, std::vector<Container>>> mapSidContainers0_; //[key-数据源id, value-[key-集装箱序号, value-集装箱号集合]]
std::map<int, std::vector<Container>> mapSidConBest0_; //[key-数据源id, value-集装箱号1和2]
std::map<int, Step1Location> mapStep1Pre0_; //[key-数据源id, value-上一帧大框信息]
std::map<int, bool> mapSecondFlag0_; //[key-数据源id, value-是否保存第2个箱号]
//反向信息
std::map<int, std::map<int, std::vector<Container>>> mapSidContainers1_; //[key-数据源id, value-[key-集装箱序号, value-集装箱号集合]]
std::map<int, std::vector<Container>> mapSidConBest1_; //[key-数据源id, value-集装箱号1和2]
std::map<int, Step1Location> mapStep1Pre1_; //[key-数据源id, value-上一帧大框信息]
std::map<int, bool> mapSecondFlag1_; //[key-数据源id, value-是否保存第2个箱号]
//集装箱号转换
std::map<std::string, int> mapExchange_ = {
{"A", 10},
{"B", 12},
{"C", 13},
{"D", 14},
{"E", 15},
{"F", 16},
{"G", 17},
{"H", 18},
{"I", 19},
{"J", 20},
{"K", 21},
{"L", 23},
{"M", 24},
{"N", 25},
{"O", 26},
{"P", 27},
{"Q", 28},
{"R", 29},
{"S", 30},
{"T", 31},
{"U", 32},
{"V", 34},
{"W", 35},
{"X", 36},
{"Y", 37},
{"Z", 38},
{"0", 0},
{"1", 1},
{"2", 2},
{"3", 3},
{"4", 4},
{"5", 5},
{"6", 6},
{"7", 7},
{"8", 8},
{"9", 9},
};
};
ENGINE_REGIST(SelectBestContainerEngine_NEW)
#endif