def on_epoch_end(self, last_metrics, **kwargs): idx_pairs = [(8, 9), (12, 13), (11, 14), (10, 15), (2, 3), (1, 4), (0, 5)] accuracy = self.correct / self.total pckh = [(accuracy[:, idx0] + accuracy[:, idx1]) / 2 for idx0, idx1 in idx_pairs] # add upper body and total pckh.extend([ self.correct[:, 8:].sum(dim=1) / self.total[:, 8:].sum(dim=1), self.correct[:, self.all_idx].sum(dim=1) / self.total[:, self.all_idx].sum(dim=1) ]) # add multi-label classification accuracy, TP-accuracy, FN-accuracy if self.acc_thresh: pckh.extend([ self.mlc_correct / self.mlc_total if self.mlc_total else np.nan, accuracy[16], accuracy[17] ]) if self.niter > 1: results = pckh[-1].tolist() else: results = [r.item() for r in pckh] return add_metrics(last_metrics, results)
def on_epoch_end(self, last_metrics, **kwargs): matrix = self.cm.matrix objs = list(range(1, len(matrix))) pa = (matrix[objs, objs].sum() / matrix[1:].sum()) gt_count = matrix[1:].sum(axis=1) pred_count = matrix[1:, 1:].sum(axis=0) intersection = matrix[objs, objs] iou = intersection / (gt_count + pred_count - intersection) miou = iou.mean() fp = matrix[1:, self.obj].sum() - matrix[self.obj, self.obj] fn = matrix[self.obj, :].sum() - matrix[self.obj, self.obj] return add_metrics(last_metrics, [pa, miou, fp/fn])
def on_epoch_end(self, last_metrics, **kwargs): results = self.metrics.avg()[:2] results.extend(x.accuracy() for x in (self.overlap, self.no_class, self.precision, self.recall)) return fv.add_metrics(last_metrics, results)
def on_epoch_end(self, last_metrics, **kwargs): results = self.metrics.avg() metrics = fv.add_metrics(last_metrics, results) return metrics
def on_epoch_end(self, last_metrics, **kwargs): return add_metrics(last_metrics, self.total_time / 60)