// YOLOV5检测器 #ifndef __DETECTOR_YOLOV5_H__ #define __DETECTOR_YOLOV5_H__ #include #include #include #include #include "Decoder.h" using namespace std; using namespace cv; using namespace migraphx; namespace migraphxSamples { // YOLOV5参数 typedef struct _YOLOV5Parameter { int numberOfClasses;// 类别数 float confidenceThreshold;// 置信度阈值 float nmsThreshold;// NMS阈值 float objectThreshold;// 目标置信度值 }YOLOV5Parameter; class DetectorYOLOV5 { public: DetectorYOLOV5(); ~DetectorYOLOV5(); ErrorCode Initialize(InitializationParameterOfDetector initializationParameterOfDetector); ErrorCode Detect(const cv::Mat &srcImage, std::vector &resultsOfDetection); ErrorCode Detect(DCU_Frame &srcImage, std::vector &resultsOfDetection); float* preprocess_Image = NULL; private: ErrorCode DoCommonInitialization(InitializationParameterOfDetector initializationParameterOfDetector); private: cv::FileStorage configurationFile; InitializationParameterOfDetector initializationParameter; FILE *logFile; // net migraphx::program net; cv::Size inputSize; string inputName; migraphx::shape inputShape; bool useFP16; vector classNames; YOLOV5Parameter yolov5Parameter; migraphx::parameter_map ParameterMap; }; } #endif