-
Notifications
You must be signed in to change notification settings - Fork 9.5k
/
grounding_dino_swin-t-pretrain_flickr30k.py
57 lines (48 loc) · 1.64 KB
/
grounding_dino_swin-t-pretrain_flickr30k.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
_base_ = '../grounding_dino_swin-t_pretrain_obj365.py'
dataset_type = 'Flickr30kDataset'
data_root = 'data/flickr30k_entities/'
test_pipeline = [
dict(
type='LoadImageFromFile', backend_args=None,
imdecode_backend='pillow'),
dict(
type='FixScaleResize',
scale=(800, 1333),
keep_ratio=True,
backend='pillow'),
dict(type='LoadAnnotations', with_bbox=True),
dict(
type='PackDetInputs',
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
'scale_factor', 'text', 'custom_entities',
'tokens_positive', 'phrase_ids', 'phrases'))
]
dataset_Flickr30k_val = dict(
type=dataset_type,
data_root=data_root,
ann_file='final_flickr_separateGT_val.json',
data_prefix=dict(img='flickr30k_images/'),
pipeline=test_pipeline,
)
dataset_Flickr30k_test = dict(
type=dataset_type,
data_root=data_root,
ann_file='final_flickr_separateGT_test.json',
data_prefix=dict(img='flickr30k_images/'),
pipeline=test_pipeline,
)
val_evaluator_Flickr30k = dict(type='Flickr30kMetric')
test_evaluator_Flickr30k = dict(type='Flickr30kMetric')
# ----------Config---------- #
dataset_prefixes = ['Flickr30kVal', 'Flickr30kTest']
datasets = [dataset_Flickr30k_val, dataset_Flickr30k_test]
metrics = [val_evaluator_Flickr30k, test_evaluator_Flickr30k]
val_dataloader = dict(
dataset=dict(_delete_=True, type='ConcatDataset', datasets=datasets))
test_dataloader = val_dataloader
val_evaluator = dict(
_delete_=True,
type='MultiDatasetsEvaluator',
metrics=metrics,
dataset_prefixes=dataset_prefixes)
test_evaluator = val_evaluator