From 2206ca4e3497deaaf61c4ac4112e7028bcbedbd5 Mon Sep 17 00:00:00 2001 From: Michael Perlov Date: Thu, 2 Feb 2023 17:45:17 +0200 Subject: tracker-neuralnet: russian translation --- tracker-neuralnet/lang/ru_RU.ts | 73 +++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 35 deletions(-) (limited to 'tracker-neuralnet') diff --git a/tracker-neuralnet/lang/ru_RU.ts b/tracker-neuralnet/lang/ru_RU.ts index a80c7e3d..b191e769 100644 --- a/tracker-neuralnet/lang/ru_RU.ts +++ b/tracker-neuralnet/lang/ru_RU.ts @@ -5,147 +5,150 @@ Form Tracker settings - + Настройки трекера Diagonal FOV - + Угол обзора Camera settings - + Настройки камеры Frames per second - + Кадры в секунду Camera name - + Камера Camera Configuration - + Конфигурация камеры Head Center Offset - + Смещение центра головы mm - + мм Use only yaw and pitch while calibrating. Don't roll or change position. - + Поворачивайте голову влево-вправо и наклоняйте вверх-вниз. +Не наклоняйте набок и не смещайте голову в сторону. Start calibration - + Начать калибровку Right - + Вправо Forward - + Вперед Up - + Вверх Show Network Input - + Показать входные данные MJPEG - + Использовать MJPEG Tuning / Debug - + Тонкая настройка ROI Smoothing Alpha - + Сглаживание ROI ROI Zoom - + Масштабирование ROI Thread Count - + Количество потоков Resolution - + Разрешение Field of view. Needed to transform the pose to world coordinates. - + Угол обзора камеры. Требуется для преобразования положения головы в глобальные координаты Requested video frame rate. Actual setting may not be supported by the camera. - + Частота кадров. Реальные значения могут не поддерживаться камерой. The requested resolution for cases where the camera delivers maximum frame rate only for a particular resolution. The image may still be downscaled to the internal resolution. - + Разрешение камеры, для тех случаев, когда быстродействие камеры максимально в определенном разрешении. Может быть масштабировано до внутреннего разрешения. Number of threads. Can be used to balance the CPU load between the game and the tracker. - + Количество потоков. Используется для балансировки нагрузки на процессор между игрой и трекером. Show the image patch that the pose estimation model sees. - + Показать изображение, используемое моделью определения позиции Amount of smoothing of the face region coordinates. Can help stabilize the pose. - + Сглаживание координат области лица. Может помочь стабилизировать позицию. Zoom factor for the face region. Applied before the patch is fed into the pose estimation model. There is a sweet spot near 1. - + Фактор масштабирования области лица. Применяется перед передачей кадра в модель определения позиции. Наилучшие результаты близки к 1 neuralnet_tracker_ns::NeuralNetDialog Default - + По умолчанию Tracker Offline - + Трекер выключен %1x%2 @ %3 FPS / Inference: %4 ms - + %1x%2 @ %3 FPS; Время оценки: %4 мс %1 yaw samples. Yaw more to %2 samples for stable calibration. - + Сэмплов поворота: %1. +Поворачивайте голову в стороны до %2 сэмплов для стабильной калибрации. %1 pitch samples. Pitch more to %2 samples for stable calibration. - + Сэмплов наклона: %1. +Наклоняйте голову вниз/вверх до %2 сэмплов для стабильной калибрации. %1 samples. Over %2, good! - + %1 сэмплов. Более %2, достаточно. Stop calibration - + Остановить калибровку Start calibration - + Начать калибровку -- cgit v1.2.3 From 6656b9f5b99733e88c776579dcaa07877d816a79 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 1 Mar 2023 20:14:38 +0100 Subject: cmake: fix onnx broken build on 32-bit Linux --- tracker-neuralnet/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tracker-neuralnet') diff --git a/tracker-neuralnet/CMakeLists.txt b/tracker-neuralnet/CMakeLists.txt index f414c920..4689dba1 100644 --- a/tracker-neuralnet/CMakeLists.txt +++ b/tracker-neuralnet/CMakeLists.txt @@ -1,4 +1,9 @@ include(opentrack-opencv) +set(host-spec "${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} ${CMAKE_SIZEOF_VOID_P}") +if(host-spec MATCHES "^Linux i[3-6]86 4$") + return() +endif() + find_package(OpenCV QUIET) find_package(OpenMP QUIET) # Used to control number of onnx threads. find_package(ONNXRuntime QUIET) -- cgit v1.2.3 From bd90aaa53751610b5b49ab9042b4612af2816f88 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 4 Jan 2023 13:08:06 +0100 Subject: tracker/nn: make dialog embeddable --- tracker-neuralnet/ftnoir_tracker_neuralnet.cpp | 20 +++++++++++++++++++- tracker-neuralnet/ftnoir_tracker_neuralnet.h | 5 +++++ 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'tracker-neuralnet') diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp index b56b4e96..59e17063 100644 --- a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp +++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp @@ -747,10 +747,19 @@ NeuralNetDialog::NeuralNetDialog() : tracker_status_poll_timer_.start(); } +void NeuralNetDialog::save() +{ + settings_.b->save(); +} + +void NeuralNetDialog::reload() +{ + settings_.b->reload(); +} void NeuralNetDialog::doOK() { - settings_.b->save(); + save(); close(); } @@ -793,6 +802,15 @@ void NeuralNetDialog::unregister_tracker() ui_.tcalib_button->setEnabled(false); } +bool NeuralNetDialog::embeddable() noexcept +{ + return true; +} + +void NeuralNetDialog::set_buttons_visible(bool x) +{ + ui_.buttonBox->setVisible(x); +} void NeuralNetDialog::status_poll() { diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.h b/tracker-neuralnet/ftnoir_tracker_neuralnet.h index 9e0374da..3548335e 100644 --- a/tracker-neuralnet/ftnoir_tracker_neuralnet.h +++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.h @@ -166,6 +166,9 @@ public: NeuralNetDialog(); void register_tracker(ITracker * x) override; void unregister_tracker() override; + + bool embeddable() noexcept override; + void set_buttons_visible(bool x) override; private: void make_fps_combobox(); void make_resolution_combobox(); @@ -180,6 +183,8 @@ private: NeuralNetTracker* tracker_ = nullptr; private Q_SLOTS: + void save() override; + void reload() override; void doOK(); void doCancel(); void camera_settings(); -- cgit v1.2.3 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/CMakeLists.txt | 6 ++++-- tracker-neuralnet/model_adapters.cpp | 42 ++++++++++++++++++++++++++++-------- tracker-neuralnet/model_adapters.h | 13 +++++++---- 3 files changed, 46 insertions(+), 15 deletions(-) (limited to 'tracker-neuralnet') diff --git a/tracker-neuralnet/CMakeLists.txt b/tracker-neuralnet/CMakeLists.txt index 4689dba1..9298cd1f 100644 --- a/tracker-neuralnet/CMakeLists.txt +++ b/tracker-neuralnet/CMakeLists.txt @@ -16,15 +16,17 @@ if(OpenCV_FOUND AND ONNXRuntime_FOUND AND OpenMP_FOUND) otr_module(tracker-neuralnet) - target_link_libraries(${self} + target_link_libraries(${self} opentrack-cv onnxruntime::onnxruntime opencv_calib3d opencv_imgproc opencv_imgcodecs opencv_core - OpenMP::OpenMP_C + OpenMP::OpenMP_CXX ) + # OpenMP::OpenMP_CXX doesn't set up the -fopenmp linking option, so set it up ourselves. + target_link_options(${self} PUBLIC ${OpenMP_CXX_FLAGS}) install( FILES "models/head-localizer.onnx" diff --git a/tracker-neuralnet/model_adapters.cpp b/tracker-neuralnet/model_adapters.cpp index af599321..a8e55b2a 100644 --- a/tracker-neuralnet/model_adapters.cpp +++ b/tracker-neuralnet/model_adapters.cpp @@ -7,7 +7,7 @@ #include #include - +#include namespace neuralnet_tracker_ns { @@ -165,6 +165,24 @@ double Localizer::last_inference_time_millis() const } +std::string PoseEstimator::get_network_input_name(size_t i) const +{ +#if ORT_API_VERSION >= 12 + return std::string(&*session_.GetInputNameAllocated(i, allocator_)); +#else + return std::string(session_.GetInputName(i, allocator_)); +#endif +} + +std::string PoseEstimator::get_network_output_name(size_t i) const +{ +#if ORT_API_VERSION >= 12 + return std::string(&*session_.GetOutputNameAllocated(i, allocator_)); +#else + return std::string(session_.GetOutputName(i, allocator_)); +#endif +} + PoseEstimator::PoseEstimator(Ort::MemoryInfo &allocator_info, Ort::Session &&session) : model_version_{session.GetModelMetadata().GetVersion()} , session_{std::move(session)} @@ -215,14 +233,16 @@ PoseEstimator::PoseEstimator(Ort::MemoryInfo &allocator_info, Ort::Session &&ses qDebug() << "Pose model inputs (" << session_.GetInputCount() << ")"; qDebug() << "Pose model outputs (" << session_.GetOutputCount() << "):"; + output_names_.resize(session_.GetOutputCount()); + output_c_names_.resize(session_.GetOutputCount()); for (size_t i=0; i PoseEstimator::run( { session_.Run( Ort::RunOptions{ nullptr }, - input_names_.data(), + input_c_names_.data(), input_val_.data(), input_val_.size(), - output_names_.data(), - output_val_.data(), + output_c_names_.data(), + output_val_.data(), output_val_.size()); } catch (const Ort::Exception &e) @@ -430,4 +454,4 @@ double PoseEstimator::last_inference_time_millis() const -} // namespace neuralnet_tracker_ns \ No newline at end of file +} // namespace neuralnet_tracker_ns 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 From 0395ef625920f036a7d869e44fb32765ed38222e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 7 Apr 2023 15:31:49 +0200 Subject: tracker/nn: don't include PR: #1638 --- tracker-neuralnet/model_adapters.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'tracker-neuralnet') diff --git a/tracker-neuralnet/model_adapters.cpp b/tracker-neuralnet/model_adapters.cpp index a8e55b2a..a8580a89 100644 --- a/tracker-neuralnet/model_adapters.cpp +++ b/tracker-neuralnet/model_adapters.cpp @@ -7,7 +7,6 @@ #include #include -#include namespace neuralnet_tracker_ns { -- cgit v1.2.3 From 94e7374bad0da0d9d132401bd57526b509497c7d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 13 Apr 2023 23:54:13 +0200 Subject: tracker/nn: fix build --- tracker-neuralnet/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tracker-neuralnet') diff --git a/tracker-neuralnet/CMakeLists.txt b/tracker-neuralnet/CMakeLists.txt index 9298cd1f..db568fae 100644 --- a/tracker-neuralnet/CMakeLists.txt +++ b/tracker-neuralnet/CMakeLists.txt @@ -25,8 +25,11 @@ if(OpenCV_FOUND AND ONNXRuntime_FOUND AND OpenMP_FOUND) opencv_core OpenMP::OpenMP_CXX ) + # OpenMP::OpenMP_CXX doesn't set up the -fopenmp linking option, so set it up ourselves. - target_link_options(${self} PUBLIC ${OpenMP_CXX_FLAGS}) + if(NOT MSVC) + target_link_options(${self} PUBLIC ${OpenMP_CXX_FLAGS}) + endif() install( FILES "models/head-localizer.onnx" -- cgit v1.2.3