MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / _get_scores

Method _get_scores

PATH/core/utils.py:856–878  ·  view source on GitHub ↗

Returns accuracy score evaluation result. - overall accuracy - mean accuracy - mean IU - fwavacc

(self)

Source from the content-addressed store, hash-verified

854 self.reduced_confusion_matrix = hist
855
856 def _get_scores(self):
857 """Returns accuracy score evaluation result.
858 - overall accuracy
859 - mean accuracy
860 - mean IU
861 - fwavacc
862 """
863 if self.reduced_confusion_matrix is None:
864 self.reduce_scores()
865 hist = self.reduced_confusion_matrix
866
867 acc = np.diag(hist).sum() / hist.sum()
868 acc_cls_list = acc_cls = np.diag(hist) / hist.sum(axis=1)
869
870 acc_cls = np.nanmean(acc_cls)
871 iu = np.diag(hist) / (hist.sum(axis=1) + hist.sum(axis=0) - np.diag(hist))
872
873 mean_iu = np.nanmean(iu)
874 freq = hist.sum(axis=1) / hist.sum()
875 fwavacc = (freq[freq > 0] * iu[freq > 0]).sum()
876 cls_iu = dict(zip(range(self.n_classes), iu))
877
878 return acc, acc_cls_list, fwavacc, mean_iu, cls_iu
879
880 def get_mean_iou(self):
881 return self._get_scores()[3]

Callers 3

get_mean_iouMethod · 0.95
get_pixel_accMethod · 0.95
get_mean_accMethod · 0.95

Calls 1

reduce_scoresMethod · 0.95

Tested by

no test coverage detected