generated from zhangwei/Matrixai
99 lines
2.7 KiB
C++
99 lines
2.7 KiB
C++
/**
|
|
* 列车信息推理结果转换引擎
|
|
* */
|
|
|
|
#ifndef TRAINCHARACTERCONVERSIONENGINE_H
|
|
#define TRAINCHARACTERCONVERSIONENGINE_H
|
|
|
|
#include "AppCommon.h"
|
|
#include "EngineBase.h"
|
|
#include "EngineFactory.h"
|
|
|
|
class TrainCharacterConversionEngine : public ai_matrix::EngineBase
|
|
{
|
|
public:
|
|
TrainCharacterConversionEngine();
|
|
~TrainCharacterConversionEngine();
|
|
|
|
APP_ERROR Init() override;
|
|
APP_ERROR DeInit() override;
|
|
APP_ERROR Process() override;
|
|
|
|
private:
|
|
void InitParam();
|
|
//校验车型是否符合验证
|
|
bool authTransNum(int classId, const std::string &trainNum);
|
|
//过滤第二步字段代号的误识别
|
|
void filterSingleData(std::vector<SingleData> &vecObjs, TargetMaxLen iMaxLen);
|
|
//属性框内容转换
|
|
void transPro(Step2ResultData &step2ResultData, std::map<int, std::vector<SingleData>> &mapLine);
|
|
//车号框内容转换
|
|
void transNum(Step2ResultData &step2ResultData, std::map<int, std::vector<SingleData>> &mapLine);
|
|
// 集装箱框内容转换
|
|
void transContainerNum(Step2ResultData &step2ResultData, std::map<int, std::vector<SingleData>> &mapLine);
|
|
// 校验码验证
|
|
bool verifyContainerNo(std::string &strContainerNo);
|
|
//车头框内容转换
|
|
void transHead(Step2ResultData &step2ResultData, std::map<int, std::vector<SingleData>> &mapLine);
|
|
|
|
void recordNum(const Step2ResultData &step2ResultData, const int iFrameId);
|
|
|
|
std::string strPort0_;
|
|
std::string strPort1_;
|
|
ai_matrix::ModelConfig modelConfig_;
|
|
ai_matrix::BaseConfig baseConfig_;
|
|
std::string strResultPath_;
|
|
std::vector<std::string> vecClassNames_; // 分类名称集合
|
|
|
|
// std::map<int, bool> mapDataSourceIsEnd_; //[key-数据源id, value-数据是否结束]
|
|
|
|
std::map<std::string, uint32_t> mapNumInfo_;
|
|
uint32_t iPreFrameId_;
|
|
int iSkipInterval_;
|
|
|
|
//集装箱号转换
|
|
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(TrainCharacterConversionEngine)
|
|
|
|
#endif
|