/** * 动态检测推理engine * */ #ifndef MOVEENGINE_H #define MOVEENGINE_H #include "AppCommon.h" #include "EngineBase.h" #include "EngineFactory.h" #include "yolov8_inference.h" #define STEP0_INPUT_SIZE STEP0_BATCH_SIZE*STEP0_INPUT_CHANNEL*STEP0_INPUT_W*STEP0_INPUT_H #define STEP0_OUTPUT_ARRAY 5 #define STEP0_OUTPUT_SIZE 1 * STEP0_OUTPUT_ARRAY * 2 // BOX //#define STEP0_CLEAR_NUM 0 //#define STEP0_CLASS_NUM 5 class MoveEngine : public ai_matrix::EngineBase { public: MoveEngine(); ~MoveEngine(); APP_ERROR Init() override; APP_ERROR DeInit() override; APP_ERROR Process() override; private: //初始化识别模型 APP_ERROR InitModel(); //获取模型配置 APP_ERROR ReadModelInfo(); //参数初始化 void InitParam(); //使用单device处理 void SingleDeviceProcess(std::shared_ptr pProcessData, int iType); std::string intTrainStage_2_str(int iTrainStage); void sendComeTrain(); void sendEndTrain(); ai_matrix::ModelConfig modelConfig_; ai_matrix::IdentifyConfig identifyConfig_; ai_matrix::BaseConfig baseConfig_; std::string strPort0_; std::string strPort1_; YoloV8Inference yolov8model; int iStepInter_ = 0; //(0:不识别; 1:开始识别; 2:结束识别) uint32_t iMoveDataNO_ = 1; //动态检测数据编号 int iHasTrainNum_ = 0; //有车的图象数 std::string strTrainDate_; std::string strTrainTime_; ai_matrix::DataSourceConfig dataSourceConfig_; std::string INPUT_BLOB_NAME = "images"; // deploy文件中定义的输入层名称 std::string OUTPUT_BLOB_NAME = "output0"; // deploy文件中定义的输出层名称 unsigned int img_width = IMAGE_WIDTH; unsigned int img_height = IMAGE_HEIGHT; unsigned int model_width = STEP0_INPUT_W; unsigned int model_height = STEP0_INPUT_H; // unsigned int clear_num = STEP0_CLEAR_NUM; // unsigned int class_num = STEP0_CLASS_NUM; unsigned int input_size = STEP0_INPUT_SIZE; unsigned int output_size = STEP0_OUTPUT_SIZE; // unsigned int det_size = STEP0_CLASS_NUM + STEP0_CLEAR_NUM + 5; unsigned int batch_size = STEP0_BATCH_SIZE; float score_threshold = STEP1_SCORE_THRESH; float nms_threshold = STEP1_NMS_THRESH; YoloV5ModelInfo modelinfo; std::queue> queProcessData_; }; ENGINE_REGIST(MoveEngine) #endif