def predict_raw(self, net, images): tta_masks = [] for tta in self.tta: masks_predictions = net(tta.transform_forward(images)) masks_predictions = tta.transform_backward(masks_predictions) tta_masks.append(masks_predictions) tta_masks = torch.stack(tta_masks, dim=1) return tta_masks
def predict(self, net, images): tta_masks = [] for tta in self.tta: masks_predictions = net(tta.transform_forward(images)) masks_predictions = torch.sigmoid(tta.transform_backward(masks_predictions)) tta_masks.append(masks_predictions) tta_masks = torch.stack(tta_masks, dim=0) masks_predictions = torch.mean(tta_masks, dim=0) return masks_predictions