From 46bdc8b2ea4618efc606d509d4de37dc8f50a929 Mon Sep 17 00:00:00 2001 From: nunzip Date: Tue, 11 Dec 2018 13:06:27 +0000 Subject: Minor changes --- evaluate.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/evaluate.py b/evaluate.py index 208f517..642116f 100755 --- a/evaluate.py +++ b/evaluate.py @@ -18,7 +18,7 @@ from sklearn.neighbors import NearestNeighbors from sklearn.neighbors import DistanceMetric from sklearn.cluster import KMeans from sklearn.decomposition import PCA -from sklearn.discriminant_analysis import LinearDiscriminantAnalysis +from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.metrics import confusion_matrix @@ -42,7 +42,7 @@ parser.add_argument("-k", "--kmean_alt", help="Perform clustering with generaliz parser.add_argument("-m", "--mahalanobis", help="Perform Mahalanobis Distance metric", action='store_true', default=0) parser.add_argument("-e", "--euclidean", help="Use standard euclidean distance", action='store_true', default=0) parser.add_argument("-r", "--rerank", help="Use k-reciprocal rernaking", action='store_true') -parser.add_argument("-p", "--reranka", help="Parameter k1 for Rerank -p '$k1val' -ARGUMENT REQUIRED, default=9-", type=int, default = 9) +parser.add_argument("-p", "--reranka", help="Parameter k1 for rerank -p '$k1val' -ARGUMENT REQUIRED, default=9-", type=int, default = 9) parser.add_argument("-q", "--rerankb", help="Parameter k2 for rerank -q '$k2val' -ARGUMENT REQUIRED, default=3-", type=int, default = 3) parser.add_argument("-l", "--rerankl", help="Coefficient to combine distances(lambda) -l '$lambdaval' -ARGUMENT REQUIRED, default=0.3-", type=float, default = 0.3) parser.add_argument("-n", "--neighbors", help="Use customized ranklist size -n 'size' -ARGUMENT REQUIRED, default=1-", type=int, default = 1) @@ -84,11 +84,10 @@ def test_model(gallery_data, probe_data, gallery_label, probe_label, gallery_cam MemorySave = False, Minibatch = 2000) else: if args.mahalanobis: - # metric = 'jaccard' is also valid cov_inv = np.linalg.inv(np.cov(train_model.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) + debug("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') -- cgit v1.2.3-70-g09d2