-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
69 lines (62 loc) · 5.07 KB
/
config.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import logging
# Configure logging here
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
datefmt='%m/%d/%Y %H:%M:%S',
level=logging.WARNING)
logger = logging.getLogger(__name__)
# Configure parameters for semantic search
# Methods to pick the final expansions
method = 'semq' # [sem1- caption, sem2-caption+question]
version = 'o' # version of semantic search results
dataset = 'aokvqa' # dataset 'vcr', 'okvqa' or 'aokvqa
data_root = "/Users/sahiravi/Documents/Research/VL project/scratch/data" # root of the dataset folder arranged similar to VLC-BERT
data_root = "/ubc/cs/research/nlp/sahiravi/vlc_transformer/scratch/data"
split = 'test'
"""
@param: model_for_qn_search
"clip" - uses clip for both image and semantic search
"text" - uses clip for image search and text model for semantic search
"""
# Configure all paths here
if dataset == "okvqa":
images_path = f'{data_root}/coco/{split}2014/'
questions_path = f'{data_root}/coco/okvqa/OpenEnded_mscoco_{split}2014_questions.json'
question_csv = questions_path.split("json")[0] + 'csv'
captions_path = f'{data_root}/coco/okvqa/commonsense/captions/captions_{split}_vqa.json'
captions_comet_expansions_path = f'{data_root}/coco/okvqa/commonsense/expansions/caption_comet_expansions_{split}_vqa_v3.json'
questions_comet_expansions_path = f'{data_root}/coco/okvqa/commonsense/expansions/objquestion_comet_expansions_{split}_{dataset}.json'
cq_comet_expansions_path = f'{data_root}/coco/okvqa/commonsense/expansions/cq_comet_expansions_{split}_{dataset}.json'
caption_expansion_sentences_path = f'{data_root}/coco/okvqa/commonsense/expansions/caption_expansion_sentences_{split}_{dataset}_{method}.{version}.json'
question_expansion_sentences_path = f'{data_root}/coco/okvqa/commonsense/expansions/question_expansion_sentences_{split}_{dataset}_{method}.{version}.json'
cq_expansion_sentences_path = f'{data_root}/coco/okvqa/commonsense/expansions/cq_expansion_sentences_{split}_{dataset}_{method}.{version}.json'
final_expansion_save_path = f'{data_root}/coco/okvqa/commonsense/expansions/{method}.{version}_{dataset}_{split}'
topk_caption_path = f'{data_root}/coco/okvqa/commonsense/expansions/top_cap_sentences_{split}_{dataset}.json'
topk_qn_path = f'{data_root}/coco/okvqa/commonsense/expansions/top_qn_sentences_{split}_{dataset}.json'
elif dataset == 'vcr':
images_path = f"{data_root}/vcr/vcr1images/"
questions_path = f'{data_root}/vcr/{split}.jsonl'
question_csv = questions_path.split("jsonl")[0] + 'csv'
captions_path = f'{data_root}/vcr/commonsense/captions/captions_{split}_{dataset}.json'
captions_comet_expansions_path = f'{data_root}/vcr/commonsense/expansions/caption_comet_expansions_{split}_{dataset}.json'
questions_comet_expansions_path = f'{data_root}/vcr/commonsense/expansions/objquestion_comet_expansions_{split}_{dataset}.json'
caption_expansion_sentences_path = f'{data_root}/vcr/commonsense/expansions/caption_expansion_sentences_{split}_{dataset}_{method}.{version}.json'
question_expansion_sentences_path = f'{data_root}/vcr/commonsense/expansions/question_expansion_sentences_{split}_{dataset}_{method}.{version}.json'
final_expansion_save_path = f'{data_root}/vcr/commonsense/expansions/{method}.{version}_{dataset}_{split}'
topk_caption_path = f'{data_root}/vcr/commonsense/expansions/top_cap_sentences_{split}_{dataset}.json'
topk_qn_path = f'{data_root}/vcr/commonsense/expansions/top_qn_sentences_{split}_{dataset}.json'
elif dataset == 'aokvqa':
images_path = f'{data_root}/coco/{split}2017/'
questions_path = f'{data_root}/coco/aokvqa/aokvqa_v1p0_{split}.json'
question_csv = questions_path.split("json")[0] + 'csv'
captions_path = f'{data_root}/coco/aokvqa/commonsense/captions/captions_{split}_{dataset}.json'
captions_comet_expansions_path = f'{data_root}/coco/aokvqa/commonsense/expansions/caption_comet_expansions_{split}_{dataset}.json'
questions_comet_expansions_path = f'{data_root}/coco/aokvqa/commonsense/expansions/objquestion_comet_expansions_{split}_{dataset}.json'
cq_comet_expansions_path = f'{data_root}/coco/aokvqa/commonsense/expansions/cq_comet_expansions_{split}_{dataset}.json'
caption_expansion_sentences_path = f'{data_root}/coco/aokvqa/commonsense/expansions/caption_expansion_sentences_{split}_{dataset}_{method}.{version}.json'
question_expansion_sentences_path = f'{data_root}/coco/aokvqa/commonsense/expansions/question_expansion_sentences_{split}_{dataset}_{method}.{version}.json'
cq_expansion_sentences_path = f'{data_root}/coco/aokvqa/commonsense/expansions/cq_expansion_sentences_{split}_{dataset}_{method}.{version}.json'
final_expansion_save_path = f'{data_root}/coco/aokvqa/commonsense/expansions/{method}.{version}_{dataset}_{split}'
topk_caption_path = f'{data_root}/coco/aokvqa/commonsense/expansions/top_cap_sentences_{split}_{dataset}.json'
topk_qn_path = f'{data_root}/coco/aokvqa/commonsense/expansions/top_qn_sentences_{split}_{dataset}.json'
else:
raise ValueError("Dataset must be one of okvqa, vcr or aokvqa")