Evaluates standard Person ReID metrics (https://github.com/damo-cv/TransReID/blob/639bc460b85224942dbee6c53b43bbe72ad712bd/utils/metrics.py#L90): * Rank 1 * mAP: mean average precision
(self)
| 151 | self.image_type.extend(image_type) |
| 152 | |
| 153 | def evaluate(self): |
| 154 | """ |
| 155 | Evaluates standard Person ReID metrics (https://github.com/damo-cv/TransReID/blob/639bc460b85224942dbee6c53b43bbe72ad712bd/utils/metrics.py#L90): |
| 156 | |
| 157 | * Rank 1 |
| 158 | * mAP: mean average precision |
| 159 | """ |
| 160 | feats = torch.cat(self.feats, dim=0) |
| 161 | if self.feat_norm: |
| 162 | print("The test feature is normalized") |
| 163 | feats = torch.nn.functional.normalize(feats, dim=1, p=2) # along channel |
| 164 | |
| 165 | query_index = [i for i, type in enumerate(self.image_type) if type == 'query'] |
| 166 | gallery_index = [i for i, type in enumerate(self.image_type) if type == 'gallery'] |
| 167 | |
| 168 | query_index = np.asarray(query_index) |
| 169 | gallery_index = np.asarray(gallery_index) |
| 170 | |
| 171 | pids_asarray = np.asarray(self.pids) |
| 172 | camera_ids_asarray = np.asarray(self.camids) |
| 173 | |
| 174 | # query |
| 175 | qf = feats[query_index] |
| 176 | q_pids = pids_asarray[query_index] |
| 177 | q_camids = camera_ids_asarray[query_index] |
| 178 | # gallery |
| 179 | gf = feats[gallery_index] |
| 180 | g_pids = pids_asarray[gallery_index] |
| 181 | g_camids = camera_ids_asarray[gallery_index] |
| 182 | |
| 183 | print('=> Computing DistMat with euclidean_distance') |
| 184 | distmat = euclidean_distance(qf, gf) |
| 185 | cmc, mAP = eval_func(distmat, q_pids, g_pids, q_camids, g_camids) |
| 186 | |
| 187 | return cmc, mAP, distmat, self.pids, self.camids, qf, gf |
nothing calls this directly
no test coverage detected