eadst / MLVR

Multimodal Language Vehicle Retrieval (MLVR). The code is for our paper in the 7th AI City Challenge Track 2, Tracked-Vehicle Retrieval by Natural Language Descriptions, reaching the 2nd rank on the public leaderboard.
7 stars 4 forks source link

create_vrm #1

Closed camillychen closed 1 year ago

camillychen commented 1 year ago

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)
camillychen commented 1 year ago

Hi Sir:

how to create raw-captions.pkl & train_list.txt? thank you

eadst commented 1 year ago

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)
camillychen commented 1 year ago

Hi Den:

i need new create folder in./aicity23? folder name is xclip & datatset... right? but where have raw-captions.pkl? thank you

eadst commented 1 year ago

You may update your local path to save pickle and txt.