movement.filtering.filter_by_confidence#

movement.filtering.filter_by_confidence(ds, threshold=0.6, print_report=True)[source]#

Drop all points below a certain confidence threshold.

Position points with an associated confidence value below the threshold are converted to NaN.

Parameters:
  • ds (xarray.Dataset) – Dataset containing position, confidence scores, and metadata.

  • threshold (float) – The confidence threshold below which datapoints are filtered. A default value of 0.6 is used. See notes for more information.

  • print_report (bool) – Whether to print a report on the number of NaNs in the dataset before and after filtering. Default is True.

Returns:

ds_thresholded – The provided dataset (ds), where points with a confidence value below the user-defined threshold have been converted to NaNs.

Return type:

xarray.Dataset

Notes

The point-wise confidence values reported by various pose estimation frameworks are not standardised, and the range of values can vary. For example, DeepLabCut reports a likelihood value between 0 and 1, whereas the point confidence reported by SLEAP can range above 1. Therefore, the default threshold value will not be appropriate for all datasets and does not have the same meaning across pose estimation frameworks. We advise users to inspect the confidence values in their dataset and adjust the threshold accordingly.