h/mercury: Add min detection confidence option

This commit is contained in:
Mateo de Mayo 2023-08-23 13:50:00 -03:00 committed by Jakob Bornecrantz
parent 14c1ecc96e
commit a4a6850094
3 changed files with 10 additions and 2 deletions

View file

@ -33,6 +33,7 @@ struct hg_tuneable_values
struct u_var_draggable_f32 max_reprojection_error;
struct u_var_draggable_f32 opt_smooth_factor;
struct u_var_draggable_f32 max_hand_dist;
struct u_var_draggable_f32 min_detection_confidence;
bool scribble_predictions_into_next_frame = false;
bool scribble_keypoint_model_outputs = false;
bool scribble_optimizer_outputs = true;

View file

@ -383,7 +383,7 @@ run_hand_detection(void *ptr)
for (int hand_idx = 0; hand_idx < 2; hand_idx++) {
hand_region_of_interest &output = info->outputs[hand_idx];
output.found = hand_exists[hand_idx] > 0.3;
output.found = hand_exists[hand_idx] > hgt->tuneable_values.min_detection_confidence.val;
if (output.found) {
output.hand_detection_confidence = hand_exists[hand_idx];
@ -983,4 +983,4 @@ release_onnx_wrap(onnx_wrap *wrap)
wrap->api->ReleaseEnv(wrap->env);
}
} // namespace xrt::tracking::hand::mercury
} // namespace xrt::tracking::hand::mercury

View file

@ -26,6 +26,7 @@ namespace xrt::tracking::hand::mercury {
DEBUG_GET_ONCE_LOG_OPTION(mercury_log, "MERCURY_LOG", U_LOGGING_WARN)
DEBUG_GET_ONCE_BOOL_OPTION(mercury_optimize_hand_size, "MERCURY_optimize_hand_size", true)
DEBUG_GET_ONCE_FLOAT_OPTION(mercury_min_detection_confidence, "MERCURY_MIN_DETECTION_CONFIDENCE", 0.3)
// Flags to tell state tracker that these are indeed valid joints
static const enum xrt_space_relation_flags valid_flags_ht = (enum xrt_space_relation_flags)(
@ -1192,6 +1193,11 @@ t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib,
hgt->tuneable_values.max_hand_dist.step = 0.05f;
hgt->tuneable_values.max_hand_dist.val = 1.7f;
hgt->tuneable_values.min_detection_confidence.max = 1.0f;
hgt->tuneable_values.min_detection_confidence.min = 0.0f;
hgt->tuneable_values.min_detection_confidence.step = 0.01f;
hgt->tuneable_values.min_detection_confidence.val = debug_get_float_option_mercury_min_detection_confidence();
u_var_add_draggable_f32(hgt, &hgt->tuneable_values.amt_use_depth, "Amount to use depth prediction");
@ -1207,6 +1213,7 @@ t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib,
u_var_add_draggable_f32(hgt, &hgt->tuneable_values.max_reprojection_error, "Max reprojection error");
u_var_add_draggable_f32(hgt, &hgt->tuneable_values.opt_smooth_factor, "Optimizer smoothing factor");
u_var_add_draggable_f32(hgt, &hgt->tuneable_values.max_hand_dist, "Max hand distance");
u_var_add_draggable_f32(hgt, &hgt->tuneable_values.min_detection_confidence, "Min detection confidence");
u_var_add_i32(hgt, &hgt->tuneable_values.max_num_outside_view,
"max allowed number of hand joints outside view");