diff options
-rwxr-xr-x | evaluate.py | 7 | ||||
-rwxr-xr-x | 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") @@ -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 |