From 24111e519674a6c4a4203ca545a1498af1c2d372 Mon Sep 17 00:00:00 2001 From: Antoine Viallon Date: Mon, 22 Feb 2021 17:02:20 +0100 Subject: [PATCH] Fix align_corners warnings and fix flickering issue --- model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model.py b/model.py index bc3e350..e5f42ce 100644 --- a/model.py +++ b/model.py @@ -127,7 +127,7 @@ def forward(self, x, skpCn): """ # Bilinear interpolation with scaling 2. - x = F.interpolate(x, scale_factor=2, mode='bilinear') + x = F.interpolate(x, scale_factor=2, mode='bilinear', align_corners=True) # Convolution + Leaky ReLU x = F.leaky_relu(self.conv1(x), negative_slope = 0.1) # Convolution + Leaky ReLU on (`x`, `skpCn`) @@ -281,7 +281,7 @@ def forward(self, img, flow): # stacking X and Y grid = torch.stack((x,y), dim=3) # Sample pixels using bilinear interpolation. - imgOut = torch.nn.functional.grid_sample(img, grid) + imgOut = torch.nn.functional.grid_sample(img, grid, align_corners=True) return imgOut