diff options
author | Michael Welter <michael@welter-4d.de> | 2021-05-29 17:43:26 +0200 |
---|---|---|
committer | Michael Welter <michael@welter-4d.de> | 2021-05-29 18:13:10 +0200 |
commit | 6e31ccd0d01b1d693673f6ef9fb46f46fd934685 (patch) | |
tree | 2a1409a02d7d9a0aa705021a744f98015f54ba4d /tracker-neuralnet/ftnoir_tracker_neuralnet.h | |
parent | bcf5275a01557fbd114d5969c3dccc582a656088 (diff) |
TrackerNeuralnet: Display inference time and all available elements
Meaning informative elements like the pose gizmo and bounding boxes
Diffstat (limited to 'tracker-neuralnet/ftnoir_tracker_neuralnet.h')
-rw-r--r-- | tracker-neuralnet/ftnoir_tracker_neuralnet.h | 10 |
1 files changed, 6 insertions, 4 deletions
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<float, cv::Rect2f> 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<float, 5> results; + double last_inference_time = 0; }; @@ -111,11 +113,10 @@ class PoseEstimator std::optional<Face> 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<PoseEstimator::Face> &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 |