diff options
author | Michael Welter <michael@welter-4d.de> | 2021-10-26 11:31:26 +0200 |
---|---|---|
committer | Michael Welter <michael@welter-4d.de> | 2022-05-12 19:55:23 +0200 |
commit | f58bc9de86e79df8f7a30fe1e21821bdabfb165e (patch) | |
tree | 5eec9c4c8304305483dc49b97eb00a3b54110f8a /tracker-neuralnet | |
parent | db54d8eb86b06e6c7ea44ff0c112c22ab85305c3 (diff) |
tracker/nn: catch exception in case the head pose model throws during inference
Diffstat (limited to 'tracker-neuralnet')
-rw-r--r-- | tracker-neuralnet/ftnoir_tracker_neuralnet.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp index 3687a6cd..50d1e7b4 100644 --- a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp +++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp @@ -315,7 +315,16 @@ std::optional<PoseEstimator::Face> PoseEstimator::run( const auto nt = omp_get_num_threads(); omp_set_num_threads(num_threads); - session.Run(Ort::RunOptions{nullptr}, input_names, &input_val, 1, output_names, output_val, 3); + try + { + session.Run(Ort::RunOptions{ nullptr }, input_names, &input_val, 1, output_names, output_val, 3); + } + catch (const Ort::Exception &e) + { + qDebug() << "Failed to run the model: " << e.what(); + omp_set_num_threads(nt); + return {}; + } omp_set_num_threads(nt); // FIXME: Execution time fluctuates wildly. 19 to 26 ms. Why??? |