aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xevaluate.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/evaluate.py b/evaluate.py
index 7ce586b..64f617c 100755
--- a/evaluate.py
+++ b/evaluate.py
@@ -86,8 +86,11 @@ def test_model(gallery_data, probe_data, gallery_label, probe_label, gallery_cam
else:
if args.mahalanobis:
# metric = 'jaccard' is also valid
- cov_inv = np.linalg.inv(np.cov(gallery_data.T)).T
- distances = cdist(probe_data, gallery_data, 'mahalanobis', VI=cov_inv)
+ cov_inv = np.linalg.inv(np.cov(gallery_data.T))
+ distances = np.zeros((probe_data.shape[0], gallery_data.shape[0]))
+ for i in range(int(probe_data.shape[0]/10)):
+ print("Comupting from", i*10, "to", (i+1)*10-1)
+ distances[i*10:(i+1)*10-1] = cdist(probe_data[i*10:(i+1)*10-1], gallery_data, 'mahalanobis', VI=cov_inv)
else:
distances = cdist(probe_data, gallery_data, 'euclidean')