update eval

pull/62/head
KaiyangZhou 2018-06-04 10:27:07 +01:00
parent e000a78794
commit 745ecd8182
1 changed files with 12 additions and 5 deletions

View File

@ -3,7 +3,14 @@ import numpy as np
import copy
from collections import defaultdict
import sys
from eval_lib.cython_eval import eval_market1501_wrap
try:
from eval_lib.cython_eval import eval_market1501_wrap
CYTHON_EVAL_AVAI = True
print("Cython evaluation is AVAILABLE")
except ImportError:
CYTHON_EVAL_AVAI = False
print("Warning: Cython evaluation is UNAVAILABLE")
def eval_cuhk03(distmat, q_pids, g_pids, q_camids, g_camids, max_rank, N=100):
"""Evaluation with cuhk03 metric
@ -127,11 +134,11 @@ def eval_market1501(distmat, q_pids, g_pids, q_camids, g_camids, max_rank):
return all_cmc, mAP
def evaluate(distmat, q_pids, g_pids, q_camids, g_camids, max_rank=50, use_metric_cuhk03=False, use_cython=False):
def evaluate(distmat, q_pids, g_pids, q_camids, g_camids, max_rank=50, use_metric_cuhk03=False, use_cython=True):
if use_metric_cuhk03:
return eval_cuhk03(distmat, q_pids, g_pids, q_camids, g_camids, max_rank)
else:
if not use_cython:
return eval_market1501(distmat, q_pids, g_pids, q_camids, g_camids, max_rank)
else:
if use_cython and CYTHON_EVAL_AVAI:
return eval_market1501_wrap(distmat, q_pids, g_pids, q_camids, g_camids, max_rank)
else:
return eval_market1501(distmat, q_pids, g_pids, q_camids, g_camids, max_rank)