[Feature]: Add caption

pull/1577/head
liuyuan 2023-05-19 16:11:01 +08:00
parent 6847d20d57
commit 1b8e86dca6
1 changed files with 38 additions and 37 deletions

View File

@ -62,42 +62,43 @@ class ScienceQA(BaseDataset):
data_list = []
for data_id in current_data_split:
ann = annotations[data_id]
if ann['image'] is not None:
data_info = {
'image_id':
data_id,
'question':
ann['question'],
'choices':
ann['choices'],
'answer':
ann['answer'],
'hint':
ann['hint'],
'image_name':
ann['image'],
'task':
ann['task'],
'grade':
ann['grade'],
'subject':
ann['subject'],
'topic':
ann['topic'],
'category':
ann['category'],
'skill':
ann['skill'],
'lecture':
ann['lecture'],
'solution':
ann['solution'],
'split':
ann['split'],
'img_path':
file_backend.join_path(img_prefix, data_id,
ann['image']), # noqa
}
data_list.append(data_info)
data_info = {
'image_id':
data_id,
'question':
ann['question'],
'choices':
ann['choices'],
'answer':
ann['answer'],
'hint':
ann['hint'],
'image_name':
ann['image'],
'task':
ann['task'],
'grade':
ann['grade'],
'subject':
ann['subject'],
'topic':
ann['topic'],
'category':
ann['category'],
'skill':
ann['skill'],
'lecture':
ann['lecture'],
'solution':
ann['solution'],
'split':
ann['split'],
'img_path':
file_backend.join_path(img_prefix, data_id, ann['image'])
if ann['image'] is not None else None,
'caption':
ann['caption'],
}
data_list.append(data_info)
return data_list