Skip to content

Commit 8d8a381

Browse files
chyomin06fracape
authored andcommitted
[feat] dumping coco instance json for YOLO-Eval such that class-wise mAP computation is available
1 parent 4c46d55 commit 8d8a381

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

compressai_vision/evaluators/base_evaluator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ def get_jde_eval_info_name(name):
6969
return f"{name}_info_to_eval.h5"
7070

7171
@staticmethod
72-
def get_coco_eval_info_name(name):
72+
def get_coco_eval_info_name(name=None):
73+
# the not used input is intended to interface with the function computing class-wise peformance
7374
return "coco_instances_results.json"
7475

7576
def reset(self):

compressai_vision/evaluators/evaluators.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,18 @@ def results(self, save_path: str = None):
690690
self.data_list, dummy_statistics
691691
)
692692

693+
assert self.output_dir is not None
694+
695+
file_path = Path(f"{self.output_dir}")
696+
if not file_path.is_dir():
697+
self._logger.info(f"creating output folder: {file_path}")
698+
file_path.mkdir(parents=True, exist_ok=True)
699+
self._logger.info("Saving results to {}".format(file_path))
700+
701+
with open(f"{file_path}/{self.get_coco_eval_info_name()}", "w") as f:
702+
f.write(json.dumps(self.data_list))
703+
f.flush()
704+
693705
if save_path:
694706
self.write_results(eval_results, save_path)
695707

0 commit comments

Comments
 (0)