diff --git a/deploy/third_engine/demo_openvino/picodet_openvino.h b/deploy/third_engine/demo_openvino/picodet_openvino.h index 9871184dd7ab15cc6d758c4f105aab2152cba9ea..2a5bced16a3c3d57096adbdfa263b634c74377db 100644 --- a/deploy/third_engine/demo_openvino/picodet_openvino.h +++ b/deploy/third_engine/demo_openvino/picodet_openvino.h @@ -13,66 +13,63 @@ // limitations under the License. // reference from https://github.com/RangiLyu/nanodet/tree/main/demo_openvino - #ifndef _PICODET_OPENVINO_H_ #define _PICODET_OPENVINO_H_ -#include -#include #include +#include +#include #define image_size 416 - -typedef struct HeadInfo -{ - std::string cls_layer; - std::string dis_layer; - int stride; +typedef struct HeadInfo { + std::string cls_layer; + std::string dis_layer; + int stride; } HeadInfo; -typedef struct BoxInfo -{ - float x1; - float y1; - float x2; - float y2; - float score; - int label; +typedef struct BoxInfo { + float x1; + float y1; + float x2; + float y2; + float score; + int label; } BoxInfo; -class PicoDet -{ +class PicoDet { public: - PicoDet(const char* param); + PicoDet(const char *param); - ~PicoDet(); + ~PicoDet(); - InferenceEngine::ExecutableNetwork network_; - InferenceEngine::InferRequest infer_request_; - // static bool hasGPU; + InferenceEngine::ExecutableNetwork network_; + InferenceEngine::InferRequest infer_request_; + // static bool hasGPU; - std::vector heads_info_{ - // cls_pred|dis_pred|stride - {"save_infer_model/scale_0.tmp_1", "save_infer_model/scale_4.tmp_1", 8}, - {"save_infer_model/scale_1.tmp_1", "save_infer_model/scale_5.tmp_1", 16}, - {"save_infer_model/scale_2.tmp_1", "save_infer_model/scale_6.tmp_1", 32}, - {"save_infer_model/scale_3.tmp_1", "save_infer_model/scale_7.tmp_1", 64}, - }; + std::vector heads_info_{ + // cls_pred|dis_pred|stride + {"transpose_0.tmp_0", "transpose_1.tmp_0", 8}, + {"transpose_2.tmp_0", "transpose_3.tmp_0", 16}, + {"transpose_4.tmp_0", "transpose_5.tmp_0", 32}, + {"transpose_6.tmp_0", "transpose_7.tmp_0", 64}, + }; - std::vector detect(cv::Mat image, float score_threshold, float nms_threshold); + std::vector detect(cv::Mat image, float score_threshold, + float nms_threshold); private: - void preprocess(cv::Mat& image, InferenceEngine::Blob::Ptr& blob); - void decode_infer(const float*& cls_pred, const float*& dis_pred, int stride, float threshold, std::vector>& results); - BoxInfo disPred2Bbox(const float*& dfl_det, int label, float score, int x, int y, int stride); - static void nms(std::vector& result, float nms_threshold); - std::string input_name_; - int input_size_ = image_size; - int num_class_ = 80; - int reg_max_ = 7; - + void preprocess(cv::Mat &image, InferenceEngine::Blob::Ptr &blob); + void decode_infer(const float *&cls_pred, const float *&dis_pred, int stride, + float threshold, + std::vector> &results); + BoxInfo disPred2Bbox(const float *&dfl_det, int label, float score, int x, + int y, int stride); + static void nms(std::vector &result, float nms_threshold); + std::string input_name_; + int input_size_ = image_size; + int num_class_ = 80; + int reg_max_ = 7; }; - #endif diff --git a/deploy/third_engine/demo_openvino_kpts/picodet_openvino.h b/deploy/third_engine/demo_openvino_kpts/picodet_openvino.h index 242423a3af3644c3f3ad495ab0c291015560e49f..7bd3d79c44a2f6ae62eaba82bcafcae45a84254f 100644 --- a/deploy/third_engine/demo_openvino_kpts/picodet_openvino.h +++ b/deploy/third_engine/demo_openvino_kpts/picodet_openvino.h @@ -38,8 +38,8 @@ typedef struct BoxInfo { } BoxInfo; class PicoDet { - public: - PicoDet(const char* param); +public: + PicoDet(const char *param); ~PicoDet(); @@ -48,26 +48,23 @@ class PicoDet { std::vector heads_info_{ // cls_pred|dis_pred|stride - {"save_infer_model/scale_0.tmp_1", "save_infer_model/scale_4.tmp_1", 8}, - {"save_infer_model/scale_1.tmp_1", "save_infer_model/scale_5.tmp_1", 16}, - {"save_infer_model/scale_2.tmp_1", "save_infer_model/scale_6.tmp_1", 32}, - {"save_infer_model/scale_3.tmp_1", "save_infer_model/scale_7.tmp_1", 64}, + {"transpose_0.tmp_0", "transpose_1.tmp_0", 8}, + {"transpose_2.tmp_0", "transpose_3.tmp_0", 16}, + {"transpose_4.tmp_0", "transpose_5.tmp_0", 32}, + {"transpose_6.tmp_0", "transpose_7.tmp_0", 64}, }; - std::vector detect(cv::Mat image, - float score_threshold, + std::vector detect(cv::Mat image, float score_threshold, float nms_threshold); - private: - void preprocess(cv::Mat& image, InferenceEngine::Blob::Ptr& blob); - void decode_infer(const float*& cls_pred, - const float*& dis_pred, - int stride, +private: + void preprocess(cv::Mat &image, InferenceEngine::Blob::Ptr &blob); + void decode_infer(const float *&cls_pred, const float *&dis_pred, int stride, float threshold, - std::vector>& results); - BoxInfo disPred2Bbox( - const float*& dfl_det, int label, float score, int x, int y, int stride); - static void nms(std::vector& result, float nms_threshold); + std::vector> &results); + BoxInfo disPred2Bbox(const float *&dfl_det, int label, float score, int x, + int y, int stride); + static void nms(std::vector &result, float nms_threshold); std::string input_name_; int input_size_ = image_size; int num_class_ = 80;