MiniGPT-4/minigpt4/common/vqa_tools/aokvqa/evaluation/load_aokvqa.py

14 lines
378 B
Python
Raw Normal View History

2023-10-25 18:56:14 +00:00
import os
import json
def load_aokvqa(aokvqa_dir, split, version='v1p0'):
assert split in ['train', 'val', 'test', 'test_w_ans']
dataset = json.load(open(
os.path.join(aokvqa_dir, f"aokvqa_{version}_{split}.json")
))
return dataset
def get_coco_path(split, image_id, coco_dir):
return os.path.join(coco_dir, f"{split}2017", f"{image_id:012}.jpg")