Skip to content

Commit 5661790

Browse files
committed
chores: remove unused scripts
1 parent 6898a12 commit 5661790

File tree

5 files changed

+3
-245
lines changed

5 files changed

+3
-245
lines changed

scripts/metrics/compute_overall_map.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
import json
4242
import os
4343

44-
from typing import Any, List
45-
4644
import numpy as np
4745
import pandas as pd
4846
import utils
@@ -183,15 +181,6 @@ def coco_evaluation(ann_file, detections):
183181

184182
import logging
185183

186-
class dummyclass:
187-
def __init__(self):
188-
self._logger = logging.getLogger(__name__)
189-
190-
# things = [i["name"] for i in coco_eval.cocoGt.cats.values()]
191-
# out_all = COCOEvaluator._derive_coco_results(
192-
# dummyclass(), coco_eval, iou_type="bbox", class_names=things
193-
# )
194-
195184
headers = ["AP", "AP50", "AP75", "APS", "APM", "APL"]
196185
npstat = np.array(coco_eval.stats[:6])
197186
npstat = npstat * 100 # Percent

scripts/metrics/compute_overall_miou.py

Lines changed: 0 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -36,63 +36,8 @@
3636

3737
from __future__ import annotations
3838

39-
import argparse
40-
import csv
4139
import json
4240

43-
import compute_overall_mot
44-
import utils
45-
46-
from compressai_vision.evaluators.evaluators import BaseEvaluator
47-
48-
CLASSES = ["PANDAM1", "PANDAM2", "PANDAM2"]
49-
50-
SEQS_BY_CLASS = {
51-
CLASSES[0]: [
52-
"PANDA057",
53-
"PANDA058",
54-
"PANDA069",
55-
"PANDA070",
56-
"PANDA072",
57-
"PANDA073",
58-
"PANDA077",
59-
],
60-
CLASSES[1]: [
61-
"PANDA003",
62-
"PANDA011",
63-
"PANDA016",
64-
"PANDA017",
65-
"PANDA021",
66-
"PANDA023",
67-
"PANDA027",
68-
"PANDA029",
69-
"PANDA030",
70-
"PANDA033",
71-
"PANDA035",
72-
"PANDA037",
73-
"PANDA039",
74-
"PANDA043",
75-
"PANDA053",
76-
"PANDA056",
77-
"PANDA097",
78-
],
79-
CLASSES[2]: [
80-
"PANDA088",
81-
"PANDA089",
82-
"PANDA090",
83-
"PANDA095",
84-
"PANDA109",
85-
"PANDA112",
86-
"PANDA113",
87-
"PANDA115",
88-
"PANDA117",
89-
"PANDA119",
90-
"PANDA122",
91-
"PANDA124",
92-
],
93-
}
94-
95-
9641
def compute_overall_mIoU(class_name, items):
9742
miou_acc = 0.0
9843
for item in items:
@@ -103,79 +48,3 @@ def compute_overall_mIoU(class_name, items):
10348
miou_acc = miou_acc / len(items)
10449

10550
return miou_acc
106-
107-
108-
if __name__ == "__main__":
109-
parser = argparse.ArgumentParser()
110-
111-
parser.add_argument(
112-
"-r",
113-
"--result_path",
114-
required=True,
115-
help="For example, '.../logs/runs/[pipeline]/[codec]/[datacatalog]/' ",
116-
)
117-
parser.add_argument(
118-
"-q",
119-
"--quality_index",
120-
required=False,
121-
default=-1,
122-
type=int,
123-
help="Provide index of quality folders under the `result_path'. quality_index is only meant to point the orderd folders by qp names because there might be different range of qps are used for different sequences",
124-
)
125-
parser.add_argument(
126-
"-a",
127-
"--all_qualities",
128-
action="store_true",
129-
help="run all 6 rate points in MPEG CTCs",
130-
)
131-
parser.add_argument(
132-
"-d",
133-
"--dataset_path",
134-
required=True,
135-
help="For example, '.../vcm_testdata/[dataset]' ",
136-
)
137-
parser.add_argument(
138-
"-c",
139-
"--class_to_compute",
140-
type=str,
141-
choices=CLASSES,
142-
required=True,
143-
)
144-
145-
args = parser.parse_args()
146-
if args.all_qualities:
147-
qualities = range(0, 6)
148-
else:
149-
qualities = [args.quality_index]
150-
151-
with open(
152-
f"{args.result_path}/{args.class_to_compute}.csv", "w", newline=""
153-
) as file:
154-
writer = csv.writer(file)
155-
for q in qualities:
156-
items = utils.search_items(
157-
args.result_path,
158-
args.dataset_path,
159-
q,
160-
SEQS_BY_CLASS[args.class_to_compute],
161-
BaseEvaluator.get_jde_eval_info_name,
162-
)
163-
164-
assert (
165-
len(items) > 0
166-
), "Nothing relevant information found from given directories..."
167-
168-
summary, names = compute_overall_mot.compute_overall_mota(
169-
args.class_to_compute, items
170-
)
171-
172-
motas = [100.0 * sv[13] for sv in summary.values]
173-
174-
print(f"{'=' * 10} FINAL OVERALL MOTA SUMMARY {'=' * 10}")
175-
print(f"{'-' * 35} : MOTA")
176-
177-
for key, val in zip(names, motas):
178-
print(f"{str(key):35} : {val:.4f}%")
179-
if key == "Overall":
180-
writer.writerow([str(q), f"{val:.4f}"])
181-
print("\n")

scripts/metrics/compute_overall_mot.py

Lines changed: 2 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,13 @@
3636

3737
from __future__ import annotations
3838

39-
import argparse
40-
import csv
41-
42-
from typing import Any, Dict, List
39+
from typing import Dict
4340

4441
import motmetrics as mm
4542
import torch
4643
import utils
4744

48-
from compressai_vision.evaluators.evaluators import BaseEvaluator, MOT_JDE_Eval
49-
50-
CLASSES = ["TVD", "HIEVE-1080P", "HIEVE-720P"]
51-
52-
SEQS_BY_CLASS = {
53-
CLASSES[0]: ["TVD-01", "TVD-02", "TVD-03"],
54-
CLASSES[1]: ["HIEVE-13", "HIEVE-16"],
55-
CLASSES[2]: ["HIEVE-2", "HIEVE-17", "HIEVE-18"],
56-
}
45+
from compressai_vision.evaluators.evaluators import MOT_JDE_Eval
5746

5847

5948
def get_accumulator_res_for_tvd(item: Dict):
@@ -103,87 +92,4 @@ def compute_overall_mota(class_name, items):
10392
metrics=mm.metrics.motchallenge_metrics,
10493
generate_overall=True,
10594
)
106-
# rendered_summary = mm.io.render_summary(
107-
# summary, formatters=mh.formatters, namemap=mm.io.motchallenge_metric_names
108-
# )
109-
110-
# print("\n\n")
111-
# print(rendered_summary)
112-
# print("\n")
113-
114-
# names.append("Overall")
11595
return summary, names
116-
117-
118-
if __name__ == "__main__":
119-
parser = argparse.ArgumentParser()
120-
121-
parser.add_argument(
122-
"-r",
123-
"--result_path",
124-
required=True,
125-
help="For example, '.../logs/runs/[pipeline]/[codec]/[datacatalog]/' ",
126-
)
127-
parser.add_argument(
128-
"-q",
129-
"--quality_index",
130-
required=False,
131-
default=-1,
132-
type=int,
133-
help="Provide index of quality folders under the `result_path'. quality_index is only meant to point the orderd folders by qp names because there might be different range of qps are used for different sequences",
134-
)
135-
parser.add_argument(
136-
"-a",
137-
"--all_qualities",
138-
action="store_true",
139-
help="run all 6 rate points in MPEG CTCs",
140-
)
141-
parser.add_argument(
142-
"-d",
143-
"--dataset_path",
144-
required=True,
145-
help="For example, '.../vcm_testdata/[dataset]' ",
146-
)
147-
parser.add_argument(
148-
"-c",
149-
"--class_to_compute",
150-
type=str,
151-
choices=CLASSES,
152-
required=True,
153-
)
154-
155-
args = parser.parse_args()
156-
if args.all_qualities:
157-
qualities = range(0, 6)
158-
else:
159-
qualities = [args.quality_index]
160-
161-
with open(
162-
f"{args.result_path}/{args.class_to_compute}.csv", "w", newline=""
163-
) as file:
164-
writer = csv.writer(file)
165-
for q in qualities:
166-
items = utils.search_items(
167-
args.result_path,
168-
args.dataset_path,
169-
q,
170-
SEQS_BY_CLASS[args.class_to_compute],
171-
BaseEvaluator.get_jde_eval_info_name,
172-
)
173-
174-
assert (
175-
len(items) > 0
176-
), "Nothing relevant information found from given directories..."
177-
178-
summary, names = compute_overall_mota(args.class_to_compute, items)
179-
180-
motas = [100.0 * sv[13] for sv in summary.values]
181-
182-
print(f"{'=' * 10} FINAL OVERALL MOTA SUMMARY {'=' * 10}")
183-
print(f"{'-' * 35} : MOTA")
184-
185-
for key, val in zip(names, motas):
186-
print(f"{str(key):35} : {val:.4f}%")
187-
if key == "Overall":
188-
writer.writerow([str(q), f"{val:.4f}"])
189-
print("\n")

scripts/metrics/curve_fitting.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535

3636
import copy
3737
import math
38-
import sys
39-
4038
import numpy as np
4139
import pandas as pd
4240

scripts/metrics/gen_mpeg_cttc_csv.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@
4747
from compute_overall_map import compute_overall_mAP
4848
from compute_overall_miou import compute_overall_mIoU
4949
from compute_overall_mot import compute_overall_mota
50-
from curve_fitting import (
51-
convert_to_monotonic_points_SFU,
52-
convert_to_monotonic_points_TVD,
53-
)
50+
from curve_fitting import convert_to_monotonic_points_SFU
5451

5552
from compressai_vision.datasets import get_seq_info
5653
from compressai_vision.evaluators.evaluators import BaseEvaluator
@@ -308,7 +305,6 @@ def generate_csv_classwise_video_miou(
308305

309306
for classwise_name, classwise_seqs in dict_of_classwise_seq.items():
310307
class_wise_mious = []
311-
# rate_range = [-1] if nb_operation_points == 1 else range(nb_operation_points)
312308
for q in range(nb_operation_points):
313309
items = utils.search_items(
314310
result_path,

0 commit comments

Comments
 (0)