Rescoring mechanism gaussian or linear. Args: overlap: calculated ious scores: target scores. thr: retain oks overlap < thr. type: 'gaussian' or 'linear' Returns: np.ndarray: indexes to keep
(overlap, scores, thr, type='gaussian')
| 124 | |
| 125 | |
| 126 | def _rescore(overlap, scores, thr, type='gaussian'): |
| 127 | """Rescoring mechanism gaussian or linear. |
| 128 | |
| 129 | Args: |
| 130 | overlap: calculated ious |
| 131 | scores: target scores. |
| 132 | thr: retain oks overlap < thr. |
| 133 | type: 'gaussian' or 'linear' |
| 134 | |
| 135 | Returns: |
| 136 | np.ndarray: indexes to keep |
| 137 | """ |
| 138 | assert len(overlap) == len(scores) |
| 139 | assert type in ['gaussian', 'linear'] |
| 140 | |
| 141 | if type == 'linear': |
| 142 | inds = np.where(overlap >= thr)[0] |
| 143 | scores[inds] = scores[inds] * (1 - overlap[inds]) |
| 144 | else: |
| 145 | scores = scores * np.exp(-overlap**2 / thr) |
| 146 | |
| 147 | return scores |
| 148 | |
| 149 | |
| 150 | def soft_oks_nms(kpts_db, thr, max_dets=20, sigmas=None, vis_thr=None): |