From 34ef39354a48146fff99d9fcbb1882ae50f9a627 Mon Sep 17 00:00:00 2001 From: nunzip Date: Thu, 13 Dec 2018 00:53:43 +0000 Subject: Fix evaluate -M -A bug --- evaluate.py | 7 +++++-- opt.py | 16 ++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/evaluate.py b/evaluate.py index b178abc..a19a7a9 100755 --- a/evaluate.py +++ b/evaluate.py @@ -155,8 +155,11 @@ def test_model(gallery_data, probe_data, gallery_label, probe_label, gallery_cam AP[i] = sum(max_level_precision[i])/11 mAP = np.mean(AP) print('mAP:',mAP) - return target_pred, mAP - return target_pred + + if args.mAP: + return target_pred, mAP + else: + return target_pred def main(): logging.debug("Verbose mode is on") diff --git a/opt.py b/opt.py index 28de96f..e29495e 100755 --- a/opt.py +++ b/opt.py @@ -99,18 +99,14 @@ def eval(camId, filelist, labels, gallery_idx, train_idx, feature_vectors, args) train_data=pca.transform(train_data) test_data=pca.transform(test_data) - accuracy = np.zeros((2, args.multrank)) - test_table = np.arange(1, args.multrank+1) - for q in range(args.comparison+1): - if args.mAP: - return test_model(train_data, test_data, train_label, test_label, train_cam, test_cam, showfiles_train, showfiles_test, train_model, args) - + if args.mAP: + target_pred, mAP = test_model(train_data, test_data, train_label, test_label, train_cam, test_cam, showfiles_train, showfiles_test, train_model, args) + return mAP + else: target_pred = test_model(train_data, test_data, train_label, test_label, train_cam, test_cam, showfiles_train, showfiles_test, train_model, args) - for i in range(args.multrank): - return draw_results(test_label, target_pred[i]) - args.rerank = True - args.neighbors = 1 + target_pred = target_pred.reshape(target_pred.shape[1]) + return draw_results(test_label, target_pred) def kopt(camId, filelist, labels, gallery_idx, train_idx, feature_vectors, args): axis = 0 -- cgit v1.2.3-54-g00ecf