This commit is contained in:
chenxuanhong
2022-02-17 16:30:33 +08:00
parent d82e46f0e7
commit 913e4916d4
17 changed files with 45302 additions and 71 deletions
+6 -3
View File
@@ -5,7 +5,7 @@
# Created Date: Tuesday July 20th 2021
# Author: Chen Xuanhong
# Email: chenxuanhongzju@outlook.com
# Last Modified: Monday, 14th February 2022 4:54:28 pm
# Last Modified: Thursday, 17th February 2022 10:20:46 am
# Modified By: Chen Xuanhong
# Copyright (c) 2021 Shanghai Jiao Tong University
#############################################################
@@ -13,9 +13,12 @@ from tokenize import group
from torch import nn
class DeConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size = 3, upsampl_scale = 2, padding="zero"):
def __init__(self, in_channels, out_channels, kernel_size = 3, upsampl_scale = 2, padding="zero", up_mode = "bilinear"):
super().__init__()
self.upsampling = nn.UpsamplingBilinear2d(scale_factor=upsampl_scale)
if up_mode.lower() == "bilinear":
self.upsampling = nn.UpsamplingBilinear2d(scale_factor=upsampl_scale)
elif up_mode.lower() == "nearest":
self.upsampling = nn.UpsamplingNearest2d(scale_factor=upsampl_scale)
padding_size = int((kernel_size -1)/2)
self.conv1x1 = nn.Conv2d(in_channels = in_channels, out_channels = out_channels, kernel_size= 1)
self.conv = nn.Conv2d(out_channels, out_channels, kernel_size=3, padding=padding_size, bias=False, groups=out_channels)