Closed camillychen closed 1 year ago
Hi Sir:
how to create raw-captions.pkl & train_list.txt? thank you
Please run the following commands to genearte the index.
def msvd_format_data():
train_list, val_list = "", ""
path = "./aicity23/data/train-tracks.json"
data = {}
with open(path, "r") as f:
data = json.load(f)
suffix = "./aicity23/data"
print(len(data))
aicity_dict = {}
for idx, vid in enumerate(data):
info = data[vid]
new_info = []
for keyword in [info['nl'], info['nl_other_views']]:
for fidx, nl_item in enumerate(keyword):
nl_list = nl_item.strip(".").split()
if nl_list:
new_info.append(nl_list)
aicity_dict[vid] = new_info
train_list += str(vid) + "\n"
val_list, test_list = train_list, train_list
with open('./aicity23/xclip/dataset/aicity/raw-captions.pkl', 'wb') as handle:
pickle.dump(aicity_dict, handle, protocol=pickle.HIGHEST_PROTOCOL)
with open('./aicity23/xclip/dataset/aicity/train_list.txt', 'w') as f:
f.write(train_list)
with open('./aicity23/xclip/dataset/aicity/val_list.txt', 'w') as f:
f.write(val_list)
with open('./aicity23/xclip/dataset/aicity/test_list.txt', 'w') as f:
f.write(test_list)
Hi Den:
i need new create folder in./aicity23? folder name is xclip & datatset... right? but where have raw-captions.pkl? thank you
You may update your local path to save pickle and txt.
with open('./aicity23/xclip/dataset/aicity/raw-captions.pkl', 'wb') as handle: pickle.dump(aicity_dict, handle, protocol=pickle.HIGHEST_PROTOCOL)