aboutsummaryrefslogtreecommitdiff
path: root/opt.py
diff options
context:
space:
mode:
Diffstat (limited to 'opt.py')
-rwxr-xr-xopt.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/opt.py b/opt.py
index ee63cc0..29acea4 100755
--- a/opt.py
+++ b/opt.py
@@ -87,7 +87,6 @@ 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(gallery_data.T))
distances = np.zeros((probe_data.shape[0], gallery_data.shape[0]))
for i in range(int(probe_data.shape[0]/10)):
@@ -118,7 +117,7 @@ def test_model(gallery_data, probe_data, gallery_label, probe_label, gallery_cam
probe_label[probe_idx] == gallery_label[row[n]]):
n += 1
nneighbors[probe_idx][q] = gallery_label[row[n]]
- nnshowrank[probe_idx][q] = showfiles_train[row[n]] #
+ nnshowrank[probe_idx][q] = showfiles_train[row[n]]
q += 1
n += 1
@@ -160,10 +159,8 @@ def test_model(gallery_data, probe_data, gallery_label, probe_label, gallery_cam
for i in range(probe_label.shape[0]):
for j in range(11):
max_level_precision[i][j] = np.max(precision[i][np.where(recall[i]>=(j/10))])
- #print(mAP[i])
for i in range(probe_label.shape[0]):
mAP[i] = sum(max_level_precision[i])/11
- #mAP[i] = sum(precision[i])/args.neighbors
print('mAP:',np.mean(mAP))
return np.mean(mAP)
@@ -177,7 +174,6 @@ def eval(camId, filelist, labels, gallery_idx, train_idx, feature_vectors, args)
labs = labels[train_idx].reshape((labels[train_idx].shape[0],1))
tt = np.hstack((train_idx, cam))
train, test, train_label, test_label = train_test_split(tt, labs, test_size=0.3, random_state=0)
- #to make it smaller we do a double split
del labs
del cam
train_data = feature_vectors[train[:,0]]