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")