// // Created by nvidia on 24-9-12. // #ifndef TRAIN_COMMONSTRUCT_H #define TRAIN_COMMONSTRUCT_H //模型参数 typedef struct _YoloV5ModelParam{ unsigned int uiClassNum; unsigned int uiDetSize; float fScoreThreshold; float fNmsThreshold; }YoloV5ModelParam; typedef struct _YoloV5ClearityModelParam{ unsigned int uiClassNum; unsigned int uiClearNum; unsigned int uiDetSize; float fScoreThreshold; float fNmsThreshold; }YoloV5ClearityModelParam; typedef struct _ModelCommonInfo{ unsigned int uiModelWidth; unsigned int uiModelHeight; unsigned int uiInputSize; unsigned int uiOutputSize; unsigned int uiChannel; unsigned int uiBatchSize; std::string strInputBlobName; std::string strOutputBlobName; }ModelCommonInfo; typedef struct _YoloV5ModelInfo{ YoloV5ModelParam yolov5ModelParam; ModelCommonInfo modelCommonInfo; }YoloV5ModelInfo; typedef struct _YoloV5ClearityModelInfo{ YoloV5ClearityModelParam yolov5ClearityModelParam; ModelCommonInfo modelCommonInfo; }YoloV5ClearityModelInfo; struct ModelConfig { std::string strAnchorPath; //锚框文件路径 std::string strClassPath; //类别名称集合 std::string strOmPath; //om文件路径 int iModelWidth; //模型输入宽度 int iModelHeight; //模型输入高度 float fScoreThreshold; //得分阈值 float fNMSTreshold; //nms阈值 int iClassNum; //类别个数 int iLineNum; //字段代号 }; typedef struct { float fLTX = 0; //左上X坐标 float fLTY = 0; //左上y坐标 float fRBX = 0; //右下y坐标 float fRBY = 0; //右下y坐标 }Location; // 定义日期结构体 typedef struct Date { int year; int month; int day; } Date; //数据源基本信息 typedef struct { uint32_t iWidth = 0; uint32_t iHeight = 0; int iRate = 0; //帧率 } DataSourceInfo; // 原始帧信息 typedef struct { // 帧画面 std::shared_ptr pData = nullptr; // Size of memory, bytes uint32_t iSize = 0; // 帧数据时间戳 uint64_t i64TimeStamp = 0; } SourceFrameData; //识别处理数据 typedef struct { // 数据来源标识 // int iDataSource = 0; // 数据源信息 DataSourceInfo dataSourceInfo; // 原始帧数据 SourceFrameData sourceFrameData; // 解码参数 AVCodecParameters *pCodecParameters_ = nullptr; // 列车结束标识 bool bIsTrainEnd = false; } ProcessData; typedef struct { // 帧数据时间戳 uint64_t i64TimeStamp = 0; // Size of memory, bytes uint32_t iSize = 0; // Width of image uint32_t iWidth = 0; // Height of image uint32_t iHeight = 0; // 帧率 int iRate = 0; // 原始数据 std::shared_ptr pData = nullptr; AVCodecID avCodecID; } VFrameData; // 识别区域坐标 typedef struct { // 字段代号(仅第二步使用) int iLine = -1; // 大小框的类别 int iClassId = -1; // 框的名称 std::string strClassName; // 分数 float fScore = 0; // 清晰度 float fClear = 0; // 左上X坐标 Left Top x float fLTX = 0; // 左上y坐标 Left Top y float fLTY = 0; // 右下y坐标 Right Bottom x float fRBX = 0; // 右下y坐标 Right Bottom y float fRBY = 0; } VCoordinate; // 集装箱信息 typedef struct { // 集装箱号 std::string strContainerNo; // 集装箱最优图 std::string strImg; // 集装箱编号坐标 VCoordinate coordinate; } VContainer; typedef struct { // 过车日期(格式:YYYY-MM-DD) std::string strTrainDate; // 过车时间(格式:HH-MM-SS) std::string strTrainTime; // 股道编号 std::string strTrackName = "0"; // 列车来车方向 (0:未知 1:左 2:右) uint16_t iTDirection = 0; // 车厢编号 uint16_t iCarOrder = 0; // 车厢种类 uint16_t iCategory = -1; // 车型 std::string strTType; // 车厢编号 std::string strTNum; // 车厢载重 std::string strTLoadWeight; // 车厢自重(皮重) std::string strTTareWeight; // 车厢容积 std::string strTVolume; // 车厢换长 std::string strTChangeLen; // 车厢编号图片 std::string strTNum_image; // 车厢属性图片 std::string strTPro_image; // 车厢开始帧号 uint32_t iStartFrame = 0; // 车厢结束帧号 uint32_t iEndFrame = 0; // 车厢开始时间 std::string strStartTime; // 车厢结束时间 std::string strEndTime; // 是否最后一节车厢 bool bIsTheLast = false; // 车厢编号大框坐标 VCoordinate numCoordinate; // 车厢属性大框坐标 VCoordinate proCoordinate; // 集装箱信息 std::vector vecContainer; } VTrainInfo; typedef struct { // 模型地址 std::string strModelPath; // 图片地址 std::string strImagePath; // 模型类型[0:检测 detect 1:分类 classify] uint8_t iModel = 0; // 模型版本["v5","v8"] std::string strModelVersion; // 类别模板地址 std::string strClassModelPath; } VYoloTestInfo; //动态检测结果 typedef struct { // 文件存储目录 std::string strFilePath; // 文件名字 std::string strFileName; // 帧号 uint32_t iFrameId = 0; // 帧数据时间戳 uint64_t i64TimeStamp = 0; // 列车结束标识 bool bIsEnd = false; // 过车日期(格式:YYYY-MM-DD) std::string strTrainDate; // 过车时间(格式:HH-MM-SS) std::string strTrainTime; // 火车位置阶段(车头-车头车身之间-车身-车尾) int iTrainStage = MONITOR_MODEL_INIT_STATE; } VMoveInfo; // 存图数据 typedef struct { // 车厢位置状态 std::string strTrainStage; // 行车方向 std::string strDirection; // 车厢运动状态 std::string strTrainStatus; // 帧图像数据 VFrameData frameData; // 文件存储目录 std::string strFilePath; // 文件名字 std::string strFileName; // 图片需要标记的框坐标 std::vector vecCoordinate; // 火车结束标志 bool bIsEnd; } SaveImgData; typedef struct { // 火车结束标志 bool bIsEnd; // 图片所在目录 std::string strImagePath; // 图片名字 std::string strImageName; } VToStep1Data; typedef struct { // 帧号 uint32_t iFrameId = 0; // 过车日期(格式:YYYY-MM-DD) std::string strTrainDate; // 过车时间(格式:HH-MM-SS) std::string strTrainTime; // 火车位置阶段(车头-车头车身之间-车身-车尾) int iTrainStage = MONITOR_MODEL_INIT_STATE; // 图片 cv::Mat cvImage; // // 原始数据 // std::shared_ptr pData = nullptr; // // Size of memory, bytes // uint32_t iSize = 0; // 火车结束标志 bool bIsEnd; } VTrainStep1Data; // 模型具体结果 typedef struct { // 目标类别 (0:车号; 1:属性; 2:车头; 3:定检期; 4:集装箱; 5:公共间隔; 6:车厢大间隔) int iTargetType = -1; // 字段代号(仅第二步使用) int iLine = -1; // 大小框的类别 int iClassId = -1; // 分数 float fScore = 0; // 左上X坐标 float fLTX = 0; // 左上y坐标 float fLTY = 0; // 右下y坐标 float fRBX = 0; // 右下y坐标 float fRBY = 0; // 清晰度 float fClear = 0; // 所属车厢(第二步用) int iTrainIndex = 0; } SingleData; //后处理数据 typedef struct { // 帧号 uint32_t iFrameId = 0; // 过车日期(格式:YYYY-MM-DD) std::string strTrainDate; // 过车时间(格式:HH-MM-SS) std::string strTrainTime; // 火车结束标志 bool bIsEnd; // 当前大框所属车厢 int iCarXH = 0; // 火车车辆状态(0-无车; 1-有车行驶; 2-有车停止) int iTrainStatus = 0; // 模型具体结果 std::vector vecSingleData; } InferenceResultData; // 倒车数据集 typedef struct { // 后处理数据 std::shared_ptr pInferenceResultData; // 当前帧识别的全部内容 std::string strAllClassType; }TrainBackInfo; // 用于方向计算 typedef struct { // 帧号 uint32_t iFrameId = 0; // 大框id (给第二步用 1-属性 23456-编号) int iBigClassId = -1; // 第一步识别目标中心点X坐标 float fCenterX; // 第一步识别目标X坐标宽度 float fTargetWidth; } CalculateInfo; //车厢划分信息结构体 typedef struct { std::string strTrainDate; std::string strTrainTime; int iTrainIndex = 0; // 当节车厢出现的开始帧帧号 int iStartframe; // 当节车厢出现的结束帧帧号 int iEndframe; // 间隔框的帧号 int iSpaceFrame; // 大框中线 int iCenterX; // 是否最后一节 bool bIsEnd = false; // 切分方式 bool bSpaceDivide = true; }PartionInfo; //转换具体内容 typedef struct { // 字段代号 int iLine = -1; // 是否符合基本数据校验 bool IsChkFlag = false; // 转换后的每个字符内容 std::vector vecValue; // 每个字符对应的分数 std::vector vecScore; // 本框的识别结果 std::string strTmpResult; } TransInfo; typedef struct { std::string strTrainDate; std::string strTrainTime; // 帧序号 int iFrameId; // 图片 cv::Mat cvImage; // 大框集合 std::vector vecSingleData; // 是否最后一节 bool bIsEnd = false; } VStep2InputData; typedef struct { // 所属车厢(第二步用) int iTrainIndex = 0; // 大小框的类别 int iClassId = -1; // 分数 float fScore = 0; // 左上X坐标 float fLTX = 0; // 左上y坐标 float fLTY = 0; // 右下y坐标 float fRBX = 0; // 右下y坐标 float fRBY = 0; // 子框得分总和 float fSubScoreSum = 0; // 子框信息集合 std::vector vecSingleData; // 子框的转换结果 std::vector vecTransInfo; } Step2ResultData; typedef struct { std::string strTrainDate; std::string strTrainTime; // 帧序号 int iFrameId; // 大框以及对应小框的集合 std::vector vecStep2ResultData; // 是否最后一节 bool bIsEnd = false; } VStep2OutputData; #endif //TRAIN_COMMONSTRUCT_H