filter_by_confidence#
- movement.filtering.filter_by_confidence(data, confidence, threshold=0.6, keep_points_with_nan_confidence=True, print_report=False)[source]#
Drop data points below a certain confidence threshold.
Data points with an associated confidence value below the threshold are converted to NaN. Data points with a missing (NaN) confidence value are kept by default, but this can be changed via
keep_points_with_nan_confidence.- Parameters:
data (
DataArray) – The input data to be filtered.confidence (
DataArray) – The data array containing confidence scores to filter by.threshold (
float) – The confidence threshold below which datapoints are filtered. A default value of0.6is used. See notes for more information.keep_points_with_nan_confidence (
bool) – Whether to keep data points whose confidence value is NaN. Default isTrue. 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 isFalse.
- Returns:
The data where points with a confidence value below the user-defined threshold have been converted to NaNs.
- Return type:
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.
A missing (NaN) confidence value may mean that the point was manually annotated or edited, and therefore has no associated model confidence. For example, this is the case for points proof-read in SLEAP. Such points are the ones we should be most confident about, so they are kept by default. Set
keep_points_with_nan_confidence=Falseto drop them instead.