From 6e31ccd0d01b1d693673f6ef9fb46f46fd934685 Mon Sep 17 00:00:00 2001 From: Michael Welter Date: Sat, 29 May 2021 17:43:26 +0200 Subject: TrackerNeuralnet: Display inference time and all available elements Meaning informative elements like the pose gizmo and bounding boxes --- tracker-neuralnet/ftnoir_tracker_neuralnet.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tracker-neuralnet/ftnoir_tracker_neuralnet.h') diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.h b/tracker-neuralnet/ftnoir_tracker_neuralnet.h index e26689a4..b2eca6e3 100644 --- a/tracker-neuralnet/ftnoir_tracker_neuralnet.h +++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.h @@ -82,6 +82,7 @@ class Localizer std::pair run( const cv::Mat &frame); + double last_inference_time_millis() const; private: inline static constexpr int input_img_width = 288; inline static constexpr int input_img_height = 224; @@ -90,6 +91,7 @@ class Localizer cv::Mat scaled_frame{}, input_mat{}; Ort::Value input_val{nullptr}, output_val{nullptr}; std::array results; + double last_inference_time = 0; }; @@ -111,11 +113,10 @@ class PoseEstimator std::optional run(const cv::Mat &frame, const cv::Rect &box); // Returns an image compatible with the 'frame' image for displaying. cv::Mat last_network_input() const; - + double last_inference_time_millis() const; private: // Operates on the private image data members int find_input_intensity_90_pct_quantile() const; - inline static constexpr int input_img_width = 129; inline static constexpr int input_img_height = 129; Ort::Session session{nullptr}; @@ -130,6 +131,7 @@ class PoseEstimator Ort::Value{nullptr}, Ort::Value{nullptr}, Ort::Value{nullptr}}; + double last_inference_time = 0; }; @@ -154,7 +156,7 @@ private: bool load_and_initialize_model(); void draw_gizmos( cv::Mat frame, - const PoseEstimator::Face &face, + const std::optional &face, const Affine& pose) const; void update_fps(double dt); @@ -175,7 +177,7 @@ private: static constexpr float head_size_mm = 200.f; double fps = 0; - double max_frame_time = 0; + double last_inference_time = 0; static constexpr double RC = .25; QMutex mtx; // Protects the pose -- cgit v1.2.3