| 14 | } |
| 15 | |
| 16 | def load_data_std(args): |
| 17 | problems = json.load(open(os.path.join(args.data_root, 'scienceqa/problems.json'))) |
| 18 | pid_splits = json.load(open(os.path.join(args.data_root, 'scienceqa/pid_splits.json'))) |
| 19 | captions = json.load(open(args.caption_file))["captions"] |
| 20 | |
| 21 | for qid in problems: |
| 22 | problems[qid]['caption'] = captions[qid] if qid in captions else "" |
| 23 | |
| 24 | train_qids = pid_splits['%s' % (args.train_split)] |
| 25 | val_qids = pid_splits['%s' % (args.val_split)] |
| 26 | test_qids = pid_splits['%s' % (args.test_split)] |
| 27 | print(f"number of train problems: {len(train_qids)}\n") |
| 28 | print(f"number of val problems: {len(val_qids)}\n") |
| 29 | print(f"number of test problems: {len(test_qids)}\n") |
| 30 | |
| 31 | qids = {'train': train_qids, 'val':val_qids,'test':test_qids} |
| 32 | return problems, qids, |
| 33 | |
| 34 | def load_data_img(args): |
| 35 | problems = json.load(open(os.path.join(args.data_root, 'scienceqa/problems.json'))) |