def accumulate(self, learn): pred, targ = flatten_check(torch.sigmoid(learn.pred), learn.y) for i, th in enumerate(self.ths): p = (pred > th).float() self.inter[i] += (p * targ).float().sum().item() self.union[i] += (p + targ).float().sum().item()
def accumulate(self, learn): pred, targ = flatten_check(torch.sigmoid(learn.pred), learn.y) self.inter += (pred * targ).float().sum().item() self.union += (pred + targ).float().sum().item()