You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
trackeval/metrics/_base_metric.py
def summary_results(self, table_res):
"""Returns a simple summary of final results for a tracker"""
res = {}
for k in table_res.keys():
res[k] = dict(zip(self.summary_fields, self._summary_row(table_res[k])))
return res
trackeval/utils.py
from pandas import DataFrame
def write_summary_results(summaries, cls, output_folder):
"""Write summary results to file"""
out_file = os.path.join(output_folder, cls + '_summary.csv')
if os.path.exists(out_file):
os.remove(out_file)
os.makedirs(os.path.dirname(out_file), exist_ok=True)
for sums in summaries:
x = DataFrame(sums)
x = DataFrame(x.values.T, index=x.columns, columns=x.index)
with open(out_file, 'a', newline='') as f:
x.to_csv(f, mode="a", index=True)
f.write("\n")
def write_detailed_results(details, cls, output_folder):
"""Write detailed results to file"""
out_file = os.path.join(output_folder, cls + 'detailed.csv')
if os.path.exists(out_file):
os.remove(out_file)
os.makedirs(os.path.dirname(out_file), exist_ok=True)
for detail in details:
x = DataFrame(detail)
x = DataFrame(x.values.T, index=x.columns, columns=x.index)
col_classes = {"ori": []}
for col in x.columns.tolist():
if "" in col:
the_class = col.split("_", 1)[0]
if the_class not in col_classes.keys():
col_classes[the_class] = [col]
else:
col_classes[the_class].append(col)
else:
col_classes["ori"].append(col)
for v in col_classes.values():
tmp_df = x[v]
with open(out_file, 'a', newline='') as f:
tmp_df.to_csv(f, mode="a", index=True)
f.write("\n")
The text was updated successfully, but these errors were encountered:
unfollow7
changed the title
a method to modify the resultfile to csv
a method to modify the result file to csv
Apr 10, 2023
trackeval/metrics/_base_metric.py
def summary_results(self, table_res):
"""Returns a simple summary of final results for a tracker"""
res = {}
for k in table_res.keys():
res[k] = dict(zip(self.summary_fields, self._summary_row(table_res[k])))
return res
trackeval/utils.py
from pandas import DataFrame
def write_summary_results(summaries, cls, output_folder):
"""Write summary results to file"""
out_file = os.path.join(output_folder, cls + '_summary.csv')
if os.path.exists(out_file):
os.remove(out_file)
os.makedirs(os.path.dirname(out_file), exist_ok=True)
for sums in summaries:
x = DataFrame(sums)
x = DataFrame(x.values.T, index=x.columns, columns=x.index)
with open(out_file, 'a', newline='') as f:
x.to_csv(f, mode="a", index=True)
f.write("\n")
def write_detailed_results(details, cls, output_folder):
"""Write detailed results to file"""
out_file = os.path.join(output_folder, cls + 'detailed.csv')
if os.path.exists(out_file):
os.remove(out_file)
os.makedirs(os.path.dirname(out_file), exist_ok=True)
for detail in details:
x = DataFrame(detail)
x = DataFrame(x.values.T, index=x.columns, columns=x.index)
col_classes = {"ori": []}
for col in x.columns.tolist():
if "" in col:
the_class = col.split("_", 1)[0]
if the_class not in col_classes.keys():
col_classes[the_class] = [col]
else:
col_classes[the_class].append(col)
else:
col_classes["ori"].append(col)
for v in col_classes.values():
tmp_df = x[v]
with open(out_file, 'a', newline='') as f:
tmp_df.to_csv(f, mode="a", index=True)
f.write("\n")
The text was updated successfully, but these errors were encountered: