I’m running a 3-d unet segmentation model on medical images.
On the inference phase, I have to upsample the output of the model to a bigger size to finally get what I want.
Simplified version of the code is as below.
net = Unet3d(n_classes=4)
for image in test_loader:
with torch.no_grad():
image = image.to(device)
pred = net(image) # (1, 4, 192, 256, 256)
pred = F.interpolate(pred, size=(384, 512, 512), mode='trilinear', align_corners=True)
pred = torch.argmax(pred[0], 0)
output = pred.cpu().numpy().astype(np.uint8)
When using trilinear interpolation, I’m not sure whether I should to use align_corners=True or align_corners=False.
Which one gives better(or more precise) results considering that the upsampled image is argmaxed and thus contains integer labels(0,1,2,3)?