Exemplo n.º 1
0
def test_reid_cmc_score(batch: Dict[str, torch.Tensor], topk: Iterable[int],
                        true_values: Dict[str, float]) -> None:
    """Check if CMCMetric works correctly"""
    metric = ReidCMCMetric(
        embeddings_key="embeddings",
        pids_key="pids",
        cids_key="cids",
        is_query_key="is_query",
        topk_args=topk,
    )
    _test_score(metric=metric, batch=batch, true_values=true_values)
Exemplo n.º 2
0
 def __init__(
     self,
     embeddings_key: str,
     pids_key: str,
     cids_key: str,
     is_query_key: str,
     topk_args: List[int] = None,
     prefix: str = None,
     suffix: str = None,
 ):
     """Init."""
     super().__init__(
         metric=ReidCMCMetric(
             embeddings_key=embeddings_key,
             pids_key=pids_key,
             cids_key=cids_key,
             is_query_key=is_query_key,
             topk_args=topk_args,
             prefix=prefix,
             suffix=suffix,
         ),
         input_key=[embeddings_key, is_query_key],
         target_key=[pids_key, cids_key],
     )