diff options
Diffstat (limited to 'tracker-neuralnet')
| -rw-r--r-- | tracker-neuralnet/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | tracker-neuralnet/ftnoir_tracker_neuralnet.cpp | 43 | ||||
| -rw-r--r-- | tracker-neuralnet/ftnoir_tracker_neuralnet.h | 12 | ||||
| -rw-r--r-- | tracker-neuralnet/lang/de_DE.ts | 172 | ||||
| -rw-r--r-- | tracker-neuralnet/models/head-pose-0.3-big-quantized.onnx (renamed from tracker-neuralnet/models/head-pose.onnx) | bin | 13047683 -> 11385815 bytes |
5 files changed, 210 insertions, 19 deletions
diff --git a/tracker-neuralnet/CMakeLists.txt b/tracker-neuralnet/CMakeLists.txt index e7bb3b1c..3729c789 100644 --- a/tracker-neuralnet/CMakeLists.txt +++ b/tracker-neuralnet/CMakeLists.txt @@ -33,9 +33,9 @@ if(OpenCV_FOUND AND ONNXRuntime_FOUND AND OpenMP_FOUND) install( FILES "models/head-localizer.onnx" - "models/head-pose.onnx" "models/head-pose-0.2-big.onnx" "models/head-pose-0.2-small.onnx" + "models/head-pose-0.3-big-quantized.onnx" DESTINATION "${opentrack-libexec}/models" PERMISSIONS ${opentrack-perms-file} ) diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp index a919bb81..c55ddf0c 100644 --- a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp +++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp @@ -66,13 +66,26 @@ QDir get_default_model_directory() int enum_to_fps(int value) { + int fps = 0; + switch (value) { - case fps_30: return 30; - case fps_60: return 60; - default: [[fallthrough]]; - case fps_default: return 0; + default: eval_once(qDebug() << "neuralnet tracker: invalid fps enum value"); + [[fallthrough]]; + case fps_default: fps = 0; break; + case fps_30: fps = 30; break; + case fps_60: fps = 60; break; + case fps_75: fps = 75; break; + case fps_125: fps = 125; break; + case fps_200: fps = 200; break; + case fps_50: fps = 50; break; + case fps_100: fps = 100; break; + case fps_120: fps = 120; break; + case fps_300: fps = 300; break; + case fps_250: fps = 250; break; } + + return fps; } @@ -414,7 +427,7 @@ QuatPose NeuralNetTracker::transform_to_world_pose(const cv::Quatf &face_rotatio QuatPose NeuralNetTracker::compute_filtered_pose(const PoseEstimator::Face &face) { - if (fps_ > 0.01 && last_pose_ && poseestimator_->has_uncertainty()) + if (fps_ > 0.001 && last_pose_ && poseestimator_->has_uncertainty()) { auto image2world = [this](const cv::Quatf &face_rotation, const cv::Point2f& face_xy, const float face_size) { return this->transform_to_world_pose(face_rotation, face_xy, face_size); }; @@ -667,14 +680,20 @@ void NeuralNetTracker::data(double *data) const auto& my = tmp.R.col(1); const auto& mz = tmp.R.col(2); + // For reference: https://en.wikipedia.org/wiki/Euler_angles. Section "Rotation matrix". The relevant matrix is + // under "Tait-Bryan angles", row with "Y_alpha Z_beta X_gamma = ...". + // Because for the NN tracker x is forward, and y is up. We can see that the x axis is independent of roll. Thus it + // is relatively easy to figure out the yaw and pitch angles (alpha and beta). const float yaw = std::atan2(mx(2), mx(0)); const float pitch = -std::atan2(-mx(1), std::sqrt(mx(2)*mx(2)+mx(0)*mx(0))); - const float roll = std::atan2(-my(2), mz(2)); + // For the roll angle we recognize that the matrix entries in the second row contain cos(pitch)*cos(roll), and + // cos(pitch)*sin(roll). Using atan2 eliminates the common pitch factor and we obtain the roll angle. + const float roll = std::atan2(-mz(1), my(1)); { constexpr double rad2deg = 180/M_PI; data[Yaw] = rad2deg * yaw; data[Pitch] = rad2deg * pitch; - data[Roll] = rad2deg * roll; + data[Roll] = -rad2deg * roll; // convert to cm data[TX] = -tmp.t[2] * 0.1; @@ -707,14 +726,6 @@ QString NeuralNetTracker::get_posenet_filename() const } - - - - - - - - void NeuralNetDialog::make_fps_combobox() { for (int k = 0; k < fps_MAX; k++) @@ -855,7 +866,7 @@ void NeuralNetDialog::status_poll() else { auto [ res, fps, inference_time ] = tracker_->stats(); - status = tr("%1x%2 @ %3 FPS / Inference: %4 ms").arg(res.width).arg(res.height).arg(int(fps)).arg(int(inference_time)); + status = tr("%1x%2 @ %3 FPS / Inference: %4 ms").arg(res.width).arg(res.height).arg(int(fps)).arg(inference_time, 0, 'f', 1); } ui_.resolution_display->setText(status); } diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.h b/tracker-neuralnet/ftnoir_tracker_neuralnet.h index bafaa6e5..fe755f51 100644 --- a/tracker-neuralnet/ftnoir_tracker_neuralnet.h +++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.h @@ -48,7 +48,15 @@ enum fps_choices fps_default = 0, fps_30 = 1, fps_60 = 2, - fps_MAX = 3 + fps_75 = 3, + fps_125 = 4, + fps_200 = 5, + fps_50 = 6, + fps_100 = 7, + fps_120 = 8, + fps_300 = 9, + fps_250 = 10, + fps_MAX = 11, }; struct resolution_tuple @@ -84,7 +92,7 @@ struct Settings : opts { value<int> resolution { b, "force-resolution", 0 }; value<double> deadzone_size { b, "deadzone-size", 1. }; value<double> deadzone_hardness { b, "deadzone-hardness", 1.5 }; - value<QString> posenet_file { b, "posenet-file", "head-pose.onnx" }; + value<QString> posenet_file { b, "posenet-file", "head-pose-0.3-big-quantized.onnx" }; Settings(); }; diff --git a/tracker-neuralnet/lang/de_DE.ts b/tracker-neuralnet/lang/de_DE.ts new file mode 100644 index 00000000..6261eec0 --- /dev/null +++ b/tracker-neuralnet/lang/de_DE.ts @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="de_DE"> +<context> + <name>Form</name> + <message> + <source>Tracker settings</source> + <translation>Tracker-Einstellungen</translation> + </message> + <message> + <source>Head Center Offset</source> + <translation>Versatz zur Kopfmitte</translation> + </message> + <message> + <source>Right</source> + <translation>Rechts</translation> + </message> + <message> + <source>Forward</source> + <translation>Vorwärts</translation> + </message> + <message> + <source>Up</source> + <translation>Hoch</translation> + </message> + <message> + <source> mm</source> + <translation> mm</translation> + </message> + <message> + <source>Use only yaw and pitch while calibrating. +Don't roll or change position.</source> + <translation>Während der Kalibrierung nur gieren und nicken. +Bitte nicht rollen oder die Position ändern.</translation> + </message> + <message> + <source>Start calibration</source> + <translation>Kalibrierung starten</translation> + </message> + <message> + <source>Camera Configuration</source> + <translation>Kamera-Konfiguration</translation> + </message> + <message> + <source>Diagonal FOV</source> + <translation>Diagonales Sichtfeld</translation> + </message> + <message> + <source>Camera name</source> + <translation>Kamera-Name</translation> + </message> + <message> + <source>Field of view. Needed to transform the pose to world coordinates.</source> + <translation>Sichtfeld. Benötigt, um die Pose in Welt-Koordinaten zu übersetzen.</translation> + </message> + <message> + <source>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.</source> + <translation>Die angeforderte Auflösung für Fälle, in denen die Kamera die maximale Bildrate nur bei bestimmten Auflösungen ausgibt. Das Bild wird möglicherweise weiterhin herunterskaliert auf die interne Auflösung.</translation> + </message> + <message> + <source>Resolution</source> + <translation>Auflösung</translation> + </message> + <message> + <source>Requested video frame rate. Actual setting may not be supported by the camera.</source> + <translation>Angeforderte Bildrate. Die tatsächliche Einstellungen wird von der Kamera möglicherweise nicht unterstützt.</translation> + </message> + <message> + <source>Frames per second</source> + <translation>Bilder pro Sekunde</translation> + </message> + <message> + <source>MJPEG</source> + <translation>MJPEG</translation> + </message> + <message> + <source>Camera settings</source> + <translation>Kamera-Einstellungen</translation> + </message> + <message> + <source>Tuning / Debug</source> + <translation>Tuning / Fehlersuche</translation> + </message> + <message> + <source>Thread Count</source> + <translation>Anzahl der Threads</translation> + </message> + <message> + <source>Number of threads. Can be used to balance the CPU load between the game and the tracker.</source> + <translation>Anzahl der Threads. Kann verwendet werden, um die CPU-Last zwischen Spiel und Tracker zu balancieren.</translation> + </message> + <message> + <source>Show the image patch that the pose estimation model sees.</source> + <translation>Zeigt den Bildausschnitt, den das Modell zur Posenabschätzung sieht.</translation> + </message> + <message> + <source>Show Network Input</source> + <translation>Zeige Netzwerk-Eingabe</translation> + </message> + <message> + <source>ROI Smoothing Alpha</source> + <translation>ROI-Glättungsalpha</translation> + </message> + <message> + <source>Amount of smoothing of the face region coordinates. Can help stabilize the pose.</source> + <translation>Umfang der Glättung der Gesichtkoordinaten. Kann helfen, die Pose zu stabilisieren.</translation> + </message> + <message> + <source>ROI Zoom</source> + <translation>ROI-Zoom</translation> + </message> + <message> + <source>Zoom factor for the face region. Applied before the patch is fed into the pose estimation model. There is a sweet spot near 1.</source> + <translation>Zoom-Faktor der Gesichtsregion. Wird angewendet, bevor der Bildausschnitt zum Posen-Abschätzungsmodell gesendet wird. Der Sweet-Spot liegt nahe bei 1.</translation> + </message> + <message> + <source>Select the pose network. Changes take affect on the next tracker start</source> + <translation>Wählt das Pose-Netzwerk. Die Änderungen treten beim nächsten Start des Trackers inkraft</translation> + </message> + <message> + <source>Select Pose Net ONNX</source> + <translation>Wähle Pose-Netzwerk ONNX</translation> + </message> + <message> + <source><the pose net file></source> + <translation><die pose netzwerk datei></translation> + </message> +</context> +<context> + <name>neuralnet_tracker_ns::NeuralNetDialog</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Tracker Offline</source> + <translation>Tracker offline</translation> + </message> + <message> + <source>%1x%2 @ %3 FPS / Inference: %4 ms</source> + <translation>%1x%2 @ %3 FPS / Inferenz: %4 ms</translation> + </message> + <message> + <source>%1 yaw samples. Yaw more to %2 samples for stable calibration.</source> + <translation>%1 Gieren-Proben. Weiterhin gieren bis %2 Proben für eine stabile Kalibrierung.</translation> + </message> + <message> + <source>%1 pitch samples. Pitch more to %2 samples for stable calibration.</source> + <translation>%1 Nicken-Proben. Weiterhin nicken bis %2 Proben für eine stabile Kalibrierung.</translation> + </message> + <message> + <source>%1 samples. Over %2, good!</source> + <translation>%1 Proben. Mehr als %2, gut!</translation> + </message> + <message> + <source>Stop calibration</source> + <translation>Kalibrierung stoppen</translation> + </message> + <message> + <source>Start calibration</source> + <translation>Kalibrierung starten</translation> + </message> + <message> + <source>Select Pose Net ONNX</source> + <translation>Wähle Pose-Netzwerk ONNX</translation> + </message> + <message> + <source>ONNX Files (*.onnx)</source> + <translation>ONNX-Dateien (*.onnx)</translation> + </message> +</context> +</TS> diff --git a/tracker-neuralnet/models/head-pose.onnx b/tracker-neuralnet/models/head-pose-0.3-big-quantized.onnx Binary files differindex dcb55dcc..7f875c63 100644 --- a/tracker-neuralnet/models/head-pose.onnx +++ b/tracker-neuralnet/models/head-pose-0.3-big-quantized.onnx |
