Fang Yunhao commited on
Commit
64bcb0f
·
1 Parent(s): d2dbd7f
Files changed (1) hide show
  1. evaluation.py +5 -3
evaluation.py CHANGED
@@ -20,7 +20,7 @@ QUESTION_POOL = {
20
  "Violation of Non-physical Penetration: Objects unnaturally pass through each other.",
21
  "Violation of Gravity: Objects behave inconsistently with gravity, such as floating in the air.",
22
  ],
23
- "common_sense": [
24
  "Poor Aesthetics: Visually unappealing or low-quality content.",
25
  "Temporal Inconsistency: Noticeable flickering, choppy motion, or abrupt appearance/disappearance of irrelevant objects.",
26
  ],
@@ -66,6 +66,8 @@ if __name__ == "__main__":
66
  ## Load video
67
  video_name = v_i["first_frame"].split("/")[-1].split(".")[0]
68
  video = os.path.join(args.video_dir, video_name + ".mp4")
 
 
69
  video = llava.Video(video)
70
  ## Traverse criterions
71
  for k in ["instruction", "physical_laws", "commonsense"]:
@@ -76,9 +78,9 @@ if __name__ == "__main__":
76
  accs_i = []
77
  for q in qs:
78
  if k == "physical_laws":
79
- text_prompt = prompt_template.format(physical_laws=k.lower())
80
  else:
81
- text_prompt = prompt_template.format(commonsense=k.lower())
82
  if not args.cot:
83
  text_prompt = text_prompt.replace(
84
  "Let's think step-by-step and conclude with", "Answer with"
 
20
  "Violation of Non-physical Penetration: Objects unnaturally pass through each other.",
21
  "Violation of Gravity: Objects behave inconsistently with gravity, such as floating in the air.",
22
  ],
23
+ "commonsense": [
24
  "Poor Aesthetics: Visually unappealing or low-quality content.",
25
  "Temporal Inconsistency: Noticeable flickering, choppy motion, or abrupt appearance/disappearance of irrelevant objects.",
26
  ],
 
66
  ## Load video
67
  video_name = v_i["first_frame"].split("/")[-1].split(".")[0]
68
  video = os.path.join(args.video_dir, video_name + ".mp4")
69
+ if not os.path.exists(video):
70
+ continue
71
  video = llava.Video(video)
72
  ## Traverse criterions
73
  for k in ["instruction", "physical_laws", "commonsense"]:
 
78
  accs_i = []
79
  for q in qs:
80
  if k == "physical_laws":
81
+ text_prompt = prompt_template.format(physical_laws=q.lower())
82
  else:
83
+ text_prompt = prompt_template.format(commonsense=q.lower())
84
  if not args.cot:
85
  text_prompt = text_prompt.replace(
86
  "Let's think step-by-step and conclude with", "Answer with"