From fc135349a356ee50703361cacb83ea4a83c71936 Mon Sep 17 00:00:00 2001 From: Zhao Zhixu Date: Fri, 7 Apr 2023 21:30:37 +0800 Subject: tracker/neuralnet: Add support for building on Linux. (#1638) --- tracker-neuralnet/model_adapters.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tracker-neuralnet/model_adapters.h') diff --git a/tracker-neuralnet/model_adapters.h b/tracker-neuralnet/model_adapters.h index 3fbfb861..820330cf 100644 --- a/tracker-neuralnet/model_adapters.h +++ b/tracker-neuralnet/model_adapters.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -21,7 +22,7 @@ class Localizer public: Localizer(Ort::MemoryInfo &allocator_info, Ort::Session &&session); - + // Returns bounding wrt image coordinate of the input image // The preceeding float is the score for being a face normalized to [0,1]. std::pair run( @@ -68,13 +69,16 @@ class PoseEstimator bool has_uncertainty() const { return has_uncertainty_; } private: + std::string get_network_input_name(size_t i) const; + std::string get_network_output_name(size_t i) const; int64_t model_version_ = 0; // Queried meta data from the ONNX file Ort::Session session_{nullptr}; // ONNX's runtime context for running the model Ort::Allocator allocator_; // Memory allocator for tensors // Inputs cv::Mat scaled_frame_{}, input_mat_{}; // Input. One is the original crop, the other is rescaled (?) std::vector input_val_; // Tensors to put into the model - std::vector input_names_; // Refers to the names in the onnx model. + std::vector input_names_; // Refers to the names in the onnx model. + std::vector input_c_names_; // Refers to the C names in the onnx model. // Outputs cv::Vec output_coord_{}; // 2d Coordinate and head size output. cv::Vec output_quat_{}; // Quaternion output @@ -83,7 +87,8 @@ class PoseEstimator cv::Vec output_eyes_{}; cv::Vec output_coord_scales_{}; std::vector output_val_; // Tensors to put the model outputs in. - std::vector output_names_; // Refers to the names in the onnx model. + std::vector output_names_; // Refers to the names in the onnx model. + std::vector output_c_names_; // Refers to the C names in the onnx model. // More bookkeeping size_t num_recurrent_states_ = 0; double last_inference_time_ = 0; @@ -99,4 +104,4 @@ int find_input_intensity_quantile(const cv::Mat& frame, float percentage); void normalize_brightness(const cv::Mat& frame, cv::Mat& out); -} // namespace neuralnet_tracker_ns \ No newline at end of file +} // namespace neuralnet_tracker_ns -- cgit v1.2.3