MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / calc_bboxes_from_keypoints

Function calc_bboxes_from_keypoints

deeplabcut/core/trackingutils.py:724–736  ·  view source on GitHub ↗
(data, slack=0, offset=0)

Source from the content-addressed store, hash-verified

722
723
724def calc_bboxes_from_keypoints(data, slack=0, offset=0):
725 data = np.asarray(data)
726 if data.shape[-1] < 3:
727 raise ValueError("Data should be of shape (n_animals, n_bodyparts, 3)")
728
729 if data.ndim != 3:
730 data = np.expand_dims(data, axis=0)
731 bboxes = np.full((data.shape[0], 5), np.nan)
732 bboxes[:, :2] = np.nanmin(data[..., :2], axis=1) - slack # X1, Y1
733 bboxes[:, 2:4] = np.nanmax(data[..., :2], axis=1) + slack # X2, Y2
734 bboxes[:, -1] = np.nanmean(data[..., 2], axis=1) # Average confidence
735 bboxes[:, [0, 2]] += offset
736 return bboxes
737
738
739def reconstruct_all_ellipses(data, sd):

Callers 1

_track_individualsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected