Skip to content

Commit 254588b

Browse files
author
Ye Shaokai
committed
Merge branch 'shaokai/dev' of github.com:yeshaokai/LLaVA-NeXT into shaokai/dev
2 parents 2a59ab3 + c650950 commit 254588b

File tree

3 files changed

+172
-81
lines changed

3 files changed

+172
-81
lines changed

llava/action/benchmark.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# benchmark gpt-4o on avion_mcq_top5_500
2+
# benchmark gpt-4o on tim_mcq_top5_500
3+
# benchmark gpt-4o on random_mcq_top5_500
4+
from llava.action.chatgpt_utils import GPTInferenceAnnotator
5+
6+
root = '/data/EK100/EK100_320p_15sec_30fps_libx264'
7+
annotation_file = '/data/epic_kitchen/epic-kitchens-100-annotations/EPIC_100_validation.csv'
8+
avion_prediction_file = '/data/epic_kitchen/AVION_PREDS/avion_pred_ids_val.json'
9+
tim_prediction_file = '/data/epic_kitchen/TIM_PREDS/tim_pred_ids_val.json'
10+
n_frames = 4
11+
topk = 5
12+
action_representation = 'GT_random_narration'
13+
gpt_model = 'gpt-4o-mini-2024-07-18'
14+
# gpt_model = 'gpt-4o-2024-08-06'
15+
perspective = 'third_person'
16+
17+
18+
def benchmark_avion_mcq(n_samples):
19+
20+
inferencer = GPTInferenceAnnotator(gpt_model,
21+
root,
22+
annotation_file,
23+
gen_type = 'avion',
24+
prediction_file = avion_prediction_file,
25+
clip_length = n_frames,
26+
question_type = 'mc_',
27+
action_representation=action_representation,
28+
perspective = perspective,
29+
topk = topk)
30+
inferencer.multi_process_run(n_samples)
31+
32+
def benchmark_tim_mcq(n_samples):
33+
34+
inferencer = GPTInferenceAnnotator(gpt_model,
35+
root,
36+
annotation_file,
37+
gen_type = 'tim',
38+
prediction_file = avion_prediction_file,
39+
clip_length = n_frames,
40+
question_type = 'mc_',
41+
action_representation=action_representation,
42+
perspective = perspective,
43+
topk = topk)
44+
inferencer.multi_process_run(n_samples)
45+
46+
def benchmark_random_mcq(n_samples):
47+
inferencer = GPTInferenceAnnotator(gpt_model,
48+
root,
49+
annotation_file,
50+
gen_type = 'random',
51+
prediction_file = avion_prediction_file,
52+
clip_length = n_frames,
53+
question_type = 'mc_',
54+
action_representation=action_representation,
55+
perspective = perspective,
56+
topk = topk)
57+
58+
inferencer.multi_process_run(n_samples)
59+
60+
61+
if __name__ == '__main__':
62+
benchmark_avion_mcq(100)
63+
benchmark_tim_mcq(100)
64+
benchmark_random_mcq(100)

0 commit comments

Comments
 (0)