MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / evaluate

Method evaluate

detectron2/evaluation/lvis_evaluation.py:86–113  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

84 self._predictions.append(prediction)
85
86 def evaluate(self):
87 if self._distributed:
88 comm.synchronize()
89 predictions = comm.gather(self._predictions, dst=0)
90 predictions = list(itertools.chain(*predictions))
91
92 if not comm.is_main_process():
93 return
94 else:
95 predictions = self._predictions
96
97 if len(predictions) == 0:
98 self._logger.warning("[LVISEvaluator] Did not receive valid predictions.")
99 return {}
100
101 if self._output_dir:
102 PathManager.mkdirs(self._output_dir)
103 file_path = os.path.join(self._output_dir, "instances_predictions.pth")
104 with PathManager.open(file_path, "wb") as f:
105 torch.save(predictions, f)
106
107 self._results = OrderedDict()
108 if "proposals" in predictions[0]:
109 self._eval_box_proposals(predictions)
110 if "instances" in predictions[0]:
111 self._eval_predictions(set(self._tasks), predictions)
112 # Copy so the caller can do whatever with results
113 return copy.deepcopy(self._results)
114
115 def _eval_predictions(self, tasks, predictions):
116 """

Callers

nothing calls this directly

Calls 3

_eval_box_proposalsMethod · 0.95
_eval_predictionsMethod · 0.95
saveMethod · 0.80

Tested by

no test coverage detected