-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck_error_reason.py
More file actions
48 lines (30 loc) · 1.37 KB
/
check_error_reason.py
File metadata and controls
48 lines (30 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import json
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--output_dir', required=True)
args = parser.parse_args()
output_dir = "20251113-200803"
base_dir = "/abr/coss32/workspace"
result_json_path = f"{base_dir}/result_alpha/{args.output_dir}/result.json"
error_result_json_path = f"{base_dir}/result_alpha/{args.output_dir}/error_result.json"
# 1. 실험 파일 불러오기
with open(result_json_path, "r", encoding='utf-8') as f:
data = json.load(f)
result = {}
# 2. gt_floor와 pred_floor의 len이 같지 않은 이미지 이름을 result 배열에 추가
for frame in data.keys():
if frame == "summary":
continue
gt_floor = data[frame].get("gt_floor")
pred_floor = data[frame].get("pred_floor")
error_list = []
if len(gt_floor) != len(pred_floor):
error_list.append("상자 개수 불일치")
elif gt_floor != pred_floor:
error_list.append("정답 불일치")
if len(error_list) > 0:
result[frame] = error_list
with open(error_result_json_path, "w", encoding='utf-8') as f:
json.dump(result, f, ensure_ascii=False, indent=4)
print(f"{error_result_json_path} 에 결과가 저장되었습니다.")