From 132d2dabcf4b7c2e9f7ce31a9ac68721be24ea96 Mon Sep 17 00:00:00 2001 From: nunzip Date: Tue, 11 Dec 2018 02:32:22 +0000 Subject: Add PCA --- evaluate.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/evaluate.py b/evaluate.py index 848eb84..3475ef8 100755 --- a/evaluate.py +++ b/evaluate.py @@ -54,6 +54,7 @@ parser.add_argument("-C", "--comparison", help="Set to 2 to obtain a comparison parser.add_argument("--data", help="You can either put the data in a folder called 'data', or specify the location with --data 'path' -ARGUMENT REQUIRED, default='data'-", default='data') parser.add_argument("-K", "--kmean", help="Perform Kmean clustering of size specified through -K '$size' -ARGUMENT REQUIRED, default=0-", type=int, default=0) parser.add_argument("-P", "--mAP", help="Display Mean Average Precision for ranklist of size -n '$size'", action='store_true') +parser.add_argument("-2", "--PCA", help="Use PCA", action='store_true') args = parser.parse_args() @@ -208,6 +209,11 @@ def main(): train_cam = camId[gallery_idx] test_cam = camId[query_idx] + if(args.PCA): + pca=PCA(n_components=300) #Reconstruction error of 2.3% @300 + train_data=pca.fit_transform(train_data) + test_data=pca.transform(test_data) + accuracy = np.zeros((2, args.multrank)) test_table = np.arange(1, args.multrank+1) -- cgit v1.2.3-54-g00ecf