Skip to content

Commit

Permalink
Log warning when assigning fixed conf scores
Browse files Browse the repository at this point in the history
  • Loading branch information
lochhh committed Nov 14, 2023
1 parent 0c3c63f commit a4d9523
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion movement/io/load_poses.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
ValidPosesCSV,
ValidPoseTracks,
)
from movement.logging import log_error
from movement.logging import log_error, log_warning

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -255,6 +255,11 @@ def _load_from_sleap_analysis_file(
# Assume user-labelled and assign 1.0 as score
mask = np.isnan(tracks[:, :, :, 1])
scores = np.where(mask, scores, 1.0)
log_warning(
f"Could not find confidence scores in {file.path}. "
"Assuming pose tracks are user-labelled and "
"assigning fixed confidence scores of 1.0."
)
return ValidPoseTracks(
tracks_array=tracks.astype(np.float32),
scores_array=scores.astype(np.float32),
Expand Down Expand Up @@ -290,6 +295,11 @@ def _load_from_sleap_labels_file(

if _sleap_labels_contains_user_labels_only(labels):
tracks_with_scores = _sleap_user_labels_to_numpy(labels)
log_warning(
f"Could not find PredictedInstances in {file.path}. "
"Assuming pose tracks are user-labelled and "
"assigning fixed confidence scores of 1.0."
)
else:
tracks_with_scores = labels.numpy(
untracked=False, return_confidence=True
Expand Down

0 comments on commit a4d9523

Please sign in to comment.