MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / _flatten_detections

Method _flatten_detections

deeplabcut/core/inferenceutils.py:414–429  ·  view source on GitHub ↗
(data_dict)

Source from the content-addressed store, hash-verified

412
413 @staticmethod
414 def _flatten_detections(data_dict):
415 ind = 0
416 coordinates = data_dict["coordinates"][0]
417 confidence = data_dict["confidence"]
418 ids = data_dict.get("identity", None)
419 if ids is None:
420 ids = [np.ones(len(arr), dtype=int) * -1 for arr in confidence]
421 else:
422 ids = [arr.argmax(axis=1) for arr in ids]
423 for i, (coords, conf, id_) in enumerate(zip(coordinates, confidence, ids, strict=False)):
424 if not np.any(coords):
425 continue
426 for xy, p, g in zip(coords, conf, id_, strict=False):
427 joint = Joint(tuple(xy), p.item(), i, ind, g)
428 ind += 1
429 yield joint
430
431 def extract_best_links(self, joints_dict, costs, trees=None):
432 links = []

Callers 2

_assembleMethod · 0.95

Calls 2

JointClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected