-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport_csv.py
More file actions
30 lines (27 loc) · 1.13 KB
/
export_csv.py
File metadata and controls
30 lines (27 loc) · 1.13 KB
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
from lost.pyapi import script
import os
import pandas as pd
import pickle
ENVS = ['lost']
ARGUMENTS = {'annos_results_name' : { 'value':'annos.csv',
'help': 'Name of the file with exported bbox annotations.'}
}
class ExportCsv(script.Script):
'''This Script creates a csv file from image annotations and adds a data_export
to the output of this script in pipeline.
'''
def main(self):
shared_variables_path = self.get_path("shared_variables.p", context="pipe")
shared_variables = pickle.load( open( shared_variables_path, "rb" ) )
self.logger.info("PIPE IS RUNNING")
self.logger.info(shared_variables['pipe_is_running'])
if(shared_variables['pipe_is_running']):
df = self.inp.to_df()
csv_path = self.get_path(self.get_arg('annos_results_name'), context='instance')
df.to_csv(path_or_buf=csv_path,
sep=',',
header=True,
index=False)
self.outp.add_data_export(file_path=csv_path)
if __name__ == "__main__":
my_script = ExportCsv()