#ifndef YOLOPV2_H #define YOLOPV2_H #include #include #include #include #include #include using namespace cv; using namespace Ort; using namespace std; struct Net_config { float confThreshold; // Confidence threshold float nmsThreshold; // Non-maximum suppression threshold string modelpath; }; typedef struct BoxInfo { float x1; float y1; float x2; float y2; float score; int label; } BoxInfo; class YOLOPv2 { public: YOLOPv2(Net_config config); Mat detect(Mat& frame); private: int inpWidth; int inpHeight; int nout; int num_proposal; vector class_names; int num_class; float confThreshold; float nmsThreshold; vector input_image_; void normalize_(Mat img); void nms(vector& input_boxes); const float anchors[3][6] = { {12, 16, 19, 36, 40, 28}, {36, 75, 76, 55, 72, 146},{142, 110, 192, 243, 459, 401} }; const float stride[3] = { 8.0, 16.0, 32.0 }; Env env = Env(ORT_LOGGING_LEVEL_ERROR, "YOLOPv2"); Ort::Session *ort_session = nullptr; SessionOptions sessionOptions = SessionOptions(); vector input_names; vector output_names; vector> input_node_dims; // >=1 outputs vector> output_node_dims; // >=1 outputs }; #endif // YOLOPV2_H