22# benchmark gpt-4o on tim_mcq_top5_500
33# benchmark gpt-4o on random_mcq_top5_500
44from llava .action .chatgpt_utils import GPTInferenceAnnotator
5-
5+ import glob
6+ import json
7+ import os
68# root = '/data/EK100/EK100_320p_15sec_30fps_libx264'
79# annotation_file = '/data/epic_kitchen/epic-kitchens-100-annotations/EPIC_100_validation.csv'
810# avion_prediction_file = '/data/epic_kitchen/AVION_PREDS/avion_pred_ids_val.json'
1416tim_prediction_file = '/data/shaokai/TIM_PREDS/tim_pred_ids_val.json'
1517
1618
17- n_frames = 16
19+ n_frames = 8
1820topk = 5
1921action_representation = 'GT_random_narration'
2022perspective = 'first_person'
@@ -67,12 +69,24 @@ def benchmark_random_mcq(n_samples, gpt_model):
6769
6870 inferencer .multi_process_run (n_samples = n_samples , offset = 0 )
6971
72+ def calcuate_acc_from_jsons (json_folder ):
73+ files = glob .glob (os .path .join (json_folder , '*.json' ))
74+ for file in files :
75+ print (file )
76+ preds = json .load (open (file ))
77+ correct = 0
78+ for k ,v in preds .items ():
79+ if v ['gt_name' ] == v ['chatgpt_answer' ]:
80+ correct += 1
81+ print ('acc ' , correct / len (preds ))
82+
83+
7084
7185if __name__ == '__main__' :
72- benchmark_avion_mcq (- 1 , 'gpt-4o-mini-2024-07-18' )
73- benchmark_tim_mcq (- 1 , 'gpt-4o-mini-2024-07-18' )
74- benchmark_random_mcq (- 1 , 'gpt-4o-mini-2024-07-18' )
75- benchmark_avion_mcq (- 1 , 'gpt-4o-2024-08-06' )
76- benchmark_tim_mcq (- 1 , 'gpt-4o-2024-08-06' )
77- benchmark_random_mcq (- 1 , 'gpt-4o-2024-08-06' )
78-
86+ # benchmark_avion_mcq(-1, 'gpt-4o-mini-2024-07-18')
87+ # benchmark_tim_mcq(-1, 'gpt-4o-mini-2024-07-18')
88+ # benchmark_random_mcq(-1, 'gpt-4o-mini-2024-07-18')
89+ # benchmark_avion_mcq(-1, 'gpt-4o-2024-08-06')
90+ # benchmark_tim_mcq(-1, 'gpt-4o-2024-08-06')
91+ # benchmark_random_mcq(-1, 'gpt-4o-2024-08-06')
92+ calcuate_acc_from_jsons ( 'gpt_full_benchmark_results' )
0 commit comments