diff options
author | nunzip <np.scarh@gmail.com> | 2018-12-13 16:28:40 +0000 |
---|---|---|
committer | nunzip <np.scarh@gmail.com> | 2018-12-13 16:28:40 +0000 |
commit | 628420dbd4183a91cc976bca0102df6d70204333 (patch) | |
tree | c9f46cd9c830e175f26e2d925a99cd1d227e5825 | |
parent | 99deea0b69ccd1d7ad8ef889e6da052beda37fef (diff) | |
download | vz215_np1915-628420dbd4183a91cc976bca0102df6d70204333.tar.gz vz215_np1915-628420dbd4183a91cc976bca0102df6d70204333.tar.bz2 vz215_np1915-628420dbd4183a91cc976bca0102df6d70204333.zip |
Add examples to README
-rw-r--r-- | README.md | 41 | ||||
-rwxr-xr-x | evaluate.py | 2 | ||||
-rwxr-xr-x | opt.py | 5 |
3 files changed, 43 insertions, 5 deletions
@@ -18,7 +18,7 @@ optional arguments: -b RERANKB, --rerankb RERANKB Parameter k2 for rerank -l RERANKL, --rerankl RERANKL - Parameter lambda fo rerank + Parameter lambda for rerank -n NEIGHBORS, --neighbors NEIGHBORS Use customized ranklist size NEIGHBORS -v, --verbose Use verbose output @@ -36,3 +36,42 @@ optional arguments: -P PCA, --PCA PCA Perform pca with PCA eigenvectors ``` +EXAMPLES for `evaluate.py`: + + EXAMPLE 1: Run euclidean distance with top n + `evaluate.py -e -n 10` or simply `evaluate.py -n 10` + + EXAMPLE 2: Run euclidean distance for the first 10 values of top n and graph them + `evaluate.py -M 10` + + EXAMPLE 3: Run comparison between baseline and rerank for the first 5 values of top n and graph them + `evaluate.py -M 5 -C` + + EXAMPLE 4: Run for kmeans, 10 clusters + `evaluate.py -K 10` + + EXAMPLE 5: Run for mahalanobis, using PCA for top 100 eigenvectors to speed up the calculation + `evaluate.py -m -P 100` + + EXAMPLE 6: Run rerank for customized values of RERANKA, RERANKB and RERANKL + `evaluate.py -r -a 11 -b 3 -l 0.3` + + EXAMPLE 7: Run on the training set with euclidean distance and normalize feature vectors. Draw confusion matrix at the end. + `evaluate.py -t -1 -c` + + EXAMPLE 8: Run for rerank top 10 and save the names of the images that compose the ranklist for the first 5 queries: query.txt, ranklist.txt. + `evaluate.py -r -s 5 -n 10` + + EXAMPLE 9: Display mAP. It is advisable to use high n to obtain an accurate results. + `evaluate.py -A -n 5000` + + EXAMPLE 10: Run euclidean distance specifying a different data folder location + `evaluate.py --data` + +EXAMPLES for `opt.py`: + + EXAMPLE 1: optimize top 1 accuracy for k1, k2, lambda speeding up the process with PCA, top 50 eigenvectors + `opt.py -P 50` + + EXAMPLE 2: optimize mAP for k1, k2, lambda speeding up the process with PCA, top 50 eigenvectors + `opt.py -P 50 -A` diff --git a/evaluate.py b/evaluate.py index a19a7a9..9d41424 100755 --- a/evaluate.py +++ b/evaluate.py @@ -39,7 +39,7 @@ parser.add_argument("-e", "--euclidean", help="Use standard euclidean distance", parser.add_argument("-r", "--rerank", help="Use k-reciprocal rernaking", action='store_true') parser.add_argument("-a", "--reranka", help="Parameter k1 for rerank", type=int, default = 9) parser.add_argument("-b", "--rerankb", help="Parameter k2 for rerank", type=int, default = 3) -parser.add_argument("-l", "--rerankl", help="Parameter lambda fo rerank", type=float, default = 0.3) +parser.add_argument("-l", "--rerankl", help="Parameter lambda for rerank", type=float, default = 0.3) parser.add_argument("-n", "--neighbors", help="Use customized ranklist size NEIGHBORS", type=int, default = 1) parser.add_argument("-v", "--verbose", help="Use verbose output", action='store_true') parser.add_argument("-s", "--showrank", help="Save ranklist pics id in a txt file for first SHOWRANK queries", type=int, default = 0) @@ -42,7 +42,7 @@ parser.add_argument("-e", "--euclidean", help="Use standard euclidean distance", parser.add_argument("-r", "--rerank", help="Use k-reciprocal rernaking", action='store_true') parser.add_argument("-a", "--reranka", help="Parameter k1 for rerank", type=int, default = 9) parser.add_argument("-b", "--rerankb", help="Parameter k2 for rerank", type=int, default = 3) -parser.add_argument("-l", "--rerankl", help="Parameter lambda fo rerank", type=float, default = 0.3) +parser.add_argument("-l", "--rerankl", help="Parameter lambda for rerank", type=float, default = 0.3) parser.add_argument("-n", "--neighbors", help="Use customized ranklist size NEIGHBORS", type=int, default = 1) parser.add_argument("-v", "--verbose", help="Use verbose output", action='store_true') parser.add_argument("-s", "--showrank", help="Save ranklist pics id in a txt file for first SHOWRANK queries", type=int, default = 0) @@ -52,7 +52,7 @@ parser.add_argument("-C", "--comparison", help="Compare baseline and improved me parser.add_argument("--data", help="Folder containing data", default='data') parser.add_argument("-K", "--kmean", help="Perform Kmean clustering, KMEAN number of clusters", type=int, default=0) parser.add_argument("-A", "--mAP", help="Display Mean Average Precision", action='store_true') -parser.add_argument("-P", "--PCA", help="Perform pca with PCA eigenvectors", type=int, default=0) +parser.add_argument("-P", "--PCA", help="Perform pca with PCA eigenvectors", type=int, default=50) args = parser.parse_args() @@ -118,7 +118,6 @@ def kopt(camId, filelist, labels, gallery_idx, train_idx, feature_vectors, args) start = np.array([1,1]) if args.mAP: args.neighbors = 10 - args.PCA = 50 args.train = True args.rerank = True args.reranka = 1 |