filter_by_confidence#

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

Drop data points below a certain confidence threshold.

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

Parameters:
  • data (xarray.DataArray) – The input data to be filtered.

  • confidence (xarray.DataArray) – The data array containing confidence scores to filter by.

  • 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:

The data where points with a confidence value below the user-defined threshold have been converted to NaNs.

Return type:

xarray.DataArray

Notes

For the poses dataset case, note that 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.