-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathcreate_datasetspecific_VPRperformance_summary.py
70 lines (54 loc) · 2.37 KB
/
create_datasetspecific_VPRperformance_summary.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Originally created on Sun Oct 11 03:58:46 2020
@author: mubariz
The results of VPR techniques on each dataset are scattered across their individual CSV files (in subfolder 'VPR_Bench_Results') and numpy files (in sub-folder 'precomputed_matches').
Therefore, this code creates a CSV for each dataset that summarises the performance (AUC-PR, AUC-ROC, EP, RMF, RecallRate, Encoding Time, Matching Time) of all VPR techniques and these
summaries are available in the sub-folder 'dataset_specific_VPR_summary'.
"""
import csv
def create_datasetspecific_VPR_summary(techniques, dataset, auc_pr_dict, auc_roc_dict, pcu_dict, ep_dict, encoding_time_all, matching_time_all, RMF_dict, descriptor_shape_dict) :
with open('results/dataset_specific_VPR_summary/'+dataset.replace('/','-')+'.csv', 'a') as csvfile:
my_writer = csv.writer(csvfile, delimiter=',', quotechar=' ', quoting=csv.QUOTE_MINIMAL)
row='Technique Names,'
for tech in techniques:
row=row+tech+','
my_writer.writerow([row])
row='AUC-PR,'
for tech in techniques:
row=row+str(auc_pr_dict[tech])+','
my_writer.writerow([row])
row='AUC-ROC,'
for tech in techniques:
row=row+str(auc_roc_dict[tech])+','
my_writer.writerow([row])
row='EP,'
for tech in techniques:
row=row+str(ep_dict[tech])+','
my_writer.writerow([row])
row='Encoding Time,'
for tech in techniques:
row=row+str(encoding_time_all[tech])+','
my_writer.writerow([row])
row='Matching Time,'
for tech in techniques:
row=row+str(matching_time_all[tech])+','
my_writer.writerow([row])
row='PCU,'
for tech in techniques:
row=row+str(pcu_dict[tech])+','
my_writer.writerow([row])
row='TMF,'
for tech in techniques:
row=row+str(RMF_dict[tech][0])+','
my_writer.writerow([row])
row='RMF,'
for tech in techniques:
row=row+str(RMF_dict[tech][1])+','
my_writer.writerow([row])
# row='Descriptor Size,'
# for tech in techniques:
# row=row+descriptor_shape_dict[tech]+','
# my_writer.writerow([row])
csvfile.close()