(h36m_kpts, h36m_scores, valid_frames)
| 78 | |
| 79 | |
| 80 | def revise_kpts(h36m_kpts, h36m_scores, valid_frames): |
| 81 | |
| 82 | new_h36m_kpts = np.zeros_like(h36m_kpts) |
| 83 | for index, frames in enumerate(valid_frames): |
| 84 | kpts = h36m_kpts[index, frames] |
| 85 | score = h36m_scores[index, frames] |
| 86 | |
| 87 | index_frame = np.where(np.sum(score < 0.3, axis=1) > 0)[0] |
| 88 | |
| 89 | for frame in index_frame: |
| 90 | less_threshold_joints = np.where(score[frame] < 0.3)[0] |
| 91 | |
| 92 | intersect = [i for i in [2, 3, 5, 6] if i in less_threshold_joints] |
| 93 | |
| 94 | if [2, 3, 5, 6] == intersect: |
| 95 | kpts[frame, [2, 3, 5, 6]] = kpts[frame, [1, 1, 4, 4]] |
| 96 | elif [2, 3, 6] == intersect: |
| 97 | kpts[frame, [2, 3, 6]] = kpts[frame, [1, 1, 5]] |
| 98 | elif [3, 5, 6] == intersect: |
| 99 | kpts[frame, [3, 5, 6]] = kpts[frame, [2, 4, 4]] |
| 100 | elif [3, 6] == intersect: |
| 101 | kpts[frame, [3, 6]] = kpts[frame, [2, 5]] |
| 102 | elif [3] == intersect: |
| 103 | kpts[frame, 3] = kpts[frame, 2] |
| 104 | elif [6] == intersect: |
| 105 | kpts[frame, 6] = kpts[frame, 5] |
| 106 | else: |
| 107 | continue |
| 108 | |
| 109 | new_h36m_kpts[index, frames] = kpts |
| 110 | |
| 111 | return new_h36m_kpts |
| 112 | |
| 113 |
no outgoing calls
no test coverage detected