Skip to content

Commit

Permalink
Merge pull request #16 from DevLinyan/main
Browse files Browse the repository at this point in the history
Refactor Evaluation
  • Loading branch information
ChonghaoSima committed Mar 1, 2024
2 parents 4048fcf + 99fb011 commit 4219a4d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions challenge/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ def forward(self, tag, answer, GT):

with open(args.root_path1, 'r') as f :#, \
pred_file = json.load(f)
pred_file = {pred_file[i]["id"]: pred_file[i] for i in range(len(pred_file))}

with open(args.root_path2, 'r') as f:
test_file = json.load(f)

global_qa = -1
evaluation = evaluation_suit()
output = {"accuracy": [], "chatgpt": [], "language": [], "match": []}
for scene_id in test_file.keys():
Expand All @@ -117,13 +117,13 @@ def forward(self, tag, answer, GT):
frame_data_qa = scene_data[frame_id]['QA']
first_flag = True

for qa in (frame_data_qa["perception"] + frame_data_qa["prediction"] + frame_data_qa["planning"] + frame_data_qa["behavior"]):
global_qa += 1
for i, qa in enumerate(frame_data_qa["perception"] + frame_data_qa["prediction"] + frame_data_qa["planning"] + frame_data_qa["behavior"]):
question = qa['Q']
GT = qa['A']
tag = qa['tag']
predict = pred_file[global_qa]["answer"]
assert pred_file[global_qa]["gt_answer"] == GT, print(pred_file[global_qa]["gt_answer"], GT)
idx = scene_id + "_" + frame_id + "_" + str(i)
predict = pred_file[idx]["answer"]
assert pred_file[idx]["gt_answer"] == GT, print(pred_file[idx]["gt_answer"], GT)
if first_flag:
first_flag = False
evaluation.set_graph(predict, GT)
Expand Down

0 comments on commit 4219a4d

Please sign in to comment.