|
58 | 58 |
|
59 | 59 | SEQS_BY_CLASS = { |
60 | 60 | CLASSES[0]: [ |
61 | | - "Traffic", |
62 | | - "Kimono", |
63 | | - "ParkScene", |
64 | | - "Cactus", |
65 | | - "BasketballDrive", |
66 | | - "BQTerrace", |
| 61 | + "Traffic_2560x1600_30", |
| 62 | + "Kimono_1920x1080_24", |
| 63 | + "ParkScene_1920x1080_24", |
| 64 | + "Cactus_1920x1080_50", |
| 65 | + "BasketballDrive_1920x1080_50", |
| 66 | + "BQTerrace_1920x1080_60", |
67 | 67 | ], |
68 | | - CLASSES[1]: ["BasketballDrill", "BQMall", "PartyScene", "RaceHorses_832x480"], |
69 | | - CLASSES[2]: ["BasketballPass", "BQSquare", "BlowingBubbles", "RaceHorses"], |
70 | | - CLASSES[3]: ["Traffic", "BQTerrace"], |
| 68 | + CLASSES[1]: ["BasketballDrill_832x480_50", "BQMall_832x480_60", "PartyScene_832x480_50", "RaceHorses_832x480_832x480_30"], |
| 69 | + CLASSES[2]: ["BasketballPass_416x240_50", "BQSquare_416x240_60", "BlowingBubbles_416x240_50", "RaceHorses_416x240_30"], |
| 70 | + CLASSES[3]: ["ns_Traffic_2560x1600_30", "ns_BQTerrace_1920x1080_60"], |
71 | 71 | } |
72 | 72 |
|
73 | 73 | SEQUENCE_TO_OFFSET = { |
74 | | - "Traffic": 10000, |
75 | | - "Kimono": 20000, |
76 | | - "ParkScene": 30000, |
77 | | - "Cactus": 40000, |
78 | | - "BasketballDrive": 50000, |
79 | | - "BQTerrace": 60000, |
80 | | - "BasketballDrill": 70000, |
81 | | - "BQMall": 80000, |
82 | | - "PartyScene": 90000, |
83 | | - "RaceHorses_832x480": 100000, |
84 | | - "BasketballPass": 110000, |
85 | | - "BQSquare": 120000, |
86 | | - "BlowingBubbles": 130000, |
87 | | - "RaceHorses": 140000, |
| 74 | + "Traffic_2560x1600_30": 10000, |
| 75 | + "Kimono_1920x1080_24": 20000, |
| 76 | + "ParkScene_1920x1080_24": 30000, |
| 77 | + "Cactus_1920x1080_50": 40000, |
| 78 | + "BasketballDrive_1920x1080_50": 50000, |
| 79 | + "BQTerrace_1920x1080_60": 60000, |
| 80 | + "BasketballDrill_832x480_50": 70000, |
| 81 | + "BQMall_832x480_60": 80000, |
| 82 | + "PartyScene_832x480_50": 90000, |
| 83 | + "RaceHorses_832x480_30": 100000, |
| 84 | + "BasketballPass_416x240_50": 110000, |
| 85 | + "BQSquare_416x240_60": 120000, |
| 86 | + "BlowingBubbles_416x240_50": 130000, |
| 87 | + "RaceHorses_416x240_30": 140000, |
88 | 88 | } |
89 | 89 |
|
90 | 90 | TMP_EVAL_FILE = "tmp_eval.json" |
91 | 91 | TMP_ANCH_FILE = "tmp_anch.json" |
92 | 92 |
|
| 93 | +NS_SEQ_PREFIX = "ns_" # Prefix of non-scaled sequences |
93 | 94 |
|
94 | | -def compute_overall_mAP(class_name, items, no_cactus=False): |
95 | | - seq_root_names = SEQS_BY_CLASS[class_name] |
96 | | - |
97 | | - if no_cactus and class_name == "CLASS-AB": |
98 | | - if "Cactus" in seq_root_names: |
99 | | - seq_root_names.remove("Cactus") |
| 95 | +def compute_overall_mAP(seq_root_names, items): |
100 | 96 |
|
101 | 97 | classwise_instances_results = [] |
102 | 98 | classwise_anchor_images = [] |
103 | 99 | classwise_annotation = [] |
104 | 100 | categories = None |
105 | 101 | annotation_id = 0 |
106 | 102 | for e, (item, root_name) in enumerate(zip(items, seq_root_names)): |
107 | | - assert root_name in item[utils.SEQ_NAME_KEY] |
| 103 | + assert root_name in item[utils.SEQ_NAME_KEY], f"Not found {root_name} in {item[utils.SEQ_NAME_KEY]} {utils.SEQ_NAME_KEY}" |
| 104 | + |
| 105 | + root_name = root_name.replace(NS_SEQ_PREFIX, "") |
108 | 106 |
|
109 | 107 | seq_img_id_offset = SEQUENCE_TO_OFFSET[root_name] |
110 | 108 |
|
@@ -251,7 +249,7 @@ def __init__(self): |
251 | 249 | len(items) > 0 |
252 | 250 | ), "Nothing relevant information found from given directories..." |
253 | 251 |
|
254 | | - summary = compute_overall_mAP(args.class_to_compute, items) |
| 252 | + summary = compute_overall_mAP(SEQS_BY_CLASS[args.class_to_compute], items) |
255 | 253 |
|
256 | 254 | writer.writerow([f"{q}", f"{summary['AP'][0]:.4f}"]) |
257 | 255 | print(f"{'=' * 10} FINAL OVERALL mAP SUMMARY {'=' * 10}") |
|
0 commit comments