-
Notifications
You must be signed in to change notification settings - Fork 0
/
export_from_ibs.py
26 lines (21 loc) · 1000 Bytes
/
export_from_ibs.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
import ibeis
from ibeis.control.manual_annot_funcs import *
import pandas as pd
import sys
database_name = sys.argv[1] # IBEIS Database name to work on
csv_dir = sys.argv[2] # The metadata csv generated by the workflow. Will ve overwritten with the new names
def export(database_name, csv_dir):
'''
After human review inside IBEIS, some names might change. Exporting the database will overwrite the predicted
name in the csv originally assigned to the images by the workflow. Other columns beside the predicted name column will remain the same
'''
metadata = pd.read_csv(csv_dir)
ibs = ibeis.opendb(database_name)
aid_list = ibs.get_valid_aids()
for aid in aid_list:
name = ibs.get_annot_names(aid)
ibs.get_annot_name_texts(aid)
metadata.loc[metadata["File Name"] == ibs.get_annot_image_names(aid), "Predicted Name"] = name
metadata.to_csv(csv_dir, index = False)
if __name__ == "__main__":
export(database_name, csv_dir)