(data_dict)
| 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 = [] |
no test coverage detected