Calculate recall for testing
(results: np.ndarray, gt_ids: np.ndarray, topk: int = 10)
| 46 | |
| 47 | @staticmethod |
| 48 | def CalRecall(results: np.ndarray, gt_ids: np.ndarray, topk: int = 10) -> float: |
| 49 | """Calculate recall for testing""" |
| 50 | # too many indices for array: array is 1-dimensional, but 2 were indexed |
| 51 | recall = np.isin(results[:topk], gt_ids[:topk]).sum(axis=0) |
| 52 | return recall / topk |
| 53 | |
| 54 | @staticmethod |
| 55 | def GenerateRandomFilePath() -> str: |