Esempio n. 1
0
    def __init__(self, **kwargs):
        super(Net, self).__init__()

        scale = kwargs.get("scale")
        multi_scale = kwargs.get("multi_scale")
        reduce_upsample = kwargs.get("reduce_upsample", False)
        group = kwargs.get("group", 1)

        self.sub_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=True)
        self.add_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=False)

        self.relu = nn.ReLU()
        self.entry = nn.Conv2d(3, 64, 3, 1, 1)

        self.b1 = Block(64, 64, group=group)
        self.b2 = Block(64, 64, group=group)
        self.b3 = Block(64, 64, group=group)
        self.c1 = ops.BasicBlock(64 * 2, 64, 1)
        self.c2 = ops.BasicBlock(64 * 3, 64, 1)
        self.c3 = ops.BasicBlock(64 * 4, 64, 1)

        self.upsample = ops.UpsampleBlock(64,
                                          scale=scale,
                                          multi_scale=multi_scale,
                                          reduce=reduce_upsample)

        self.exit = nn.Sequential(nn.Conv2d(64, 3, 3, 1, 1))
Esempio n. 2
0
    def __init__(self, in_channels, out_channels, group=1):
        super(Block, self).__init__()

        self.b1 = ops.EResidualBlock(64, 64, group=group)
        self.c1 = ops.BasicBlock(64 * 2, 64, 1, 1, 0)
        self.c2 = ops.BasicBlock(64 * 3, 64, 1, 1, 0)
        self.c3 = ops.BasicBlock(64 * 4, 64, 1, 1, 0)
Esempio n. 3
0
 def __init__(self, in_channels, out_channels, group=1):
     super(Block, self).__init__()
     self.channel = 32
     self.b1 = ops.EResidualBlock(self.channel, self.channel, group=1)
     self.b2 = ops.EResidualBlock(self.channel, self.channel, group=1)
     self.c1 = ops.BasicBlock(self.channel * 2, self.channel, 1, 1, 0)
     self.c2 = ops.BasicBlock(self.channel * 3, self.channel, 1, 1, 0)
Esempio n. 4
0
    def __init__(self, **kwargs):
        super(Net, self).__init__()
        self.device = torch.device(
            "cuda" if torch.cuda.is_available() else "cpu")
        self.carnchannel = 32

        #self.conv1_e = nn.Conv2d(1, self.carnchannel//2, 3, 1, 2, bias=False).to(self.device)
        #self.conv2 = nn.Conv2d(self.carnchannel//2, self.carnchannel//2, 3, 1, 1, bias=False).to(self.device)

        #torch.nn.init.xavier_normal_(self.conv1_e.weight)
        #torch.nn.init.xavier_normal_(self.conv2.weight)

        self.entry = nn.Conv2d(3, self.carnchannel, 5, 1, 2,
                               bias=True).to(self.device)
        torch.nn.init.xavier_normal_(self.entry.weight)

        self.b1 = Block(self.carnchannel, self.carnchannel).to(self.device)
        self.b2 = Block(self.carnchannel, self.carnchannel).to(self.device)
        self.c1 = ops.BasicBlock(self.carnchannel * 2, self.carnchannel, 1, 1,
                                 0).to(self.device)
        self.c2 = ops.BasicBlock(self.carnchannel * 3, self.carnchannel, 1, 1,
                                 0).to(self.device)

        self.upsample = ops.UpsampleBlock(self.carnchannel,
                                          scale=4).to(self.device)
        self.exit = nn.Conv2d(self.carnchannel, 3, 3, 1, 1,
                              bias=True).to(self.device)
        torch.nn.init.xavier_normal_(self.exit.weight)
Esempio n. 5
0
 def __init__(self, in_channels, out_channels):
     super(normal_block, self).__init__(in_channels, out_channels)
     self.c0 = ops.BasicBlock(in_channels * 1 + in_channels, out_channels, 1, 1, 0)
     self.c0_fix = ops.BasicBlock(in_channels * 2 + in_channels, out_channels, 1, 1, 0)
     self.c1 = ops.BasicBlock(in_channels * 2 + in_channels, out_channels, 1, 1, 0)
     self.c2 = ops.BasicBlock(in_channels * 3 + in_channels, out_channels, 1, 1, 0)
     self.c3 = ops.BasicBlock(in_channels * 4, out_channels, 1, 1, 0)
Esempio n. 6
0
    def __init__(self, **kwargs):
        super(Net, self).__init__()
        
        #scale = kwargs.get("scale")
        scale = 2
        multi_scale = kwargs.get("multi_scale")
        group = kwargs.get("group", 1)

        self.sub_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=True)
        self.add_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=False)

        #@#@ Protect this convolution operation with ABFT
        self.entry = nn.Conv2d(3, 64, 3, 1, 1)

        self.b1 = Block(64, 64, group=group)
        self.b2 = Block(64, 64, group=group)
        self.b3 = Block(64, 64, group=group)
        self.c1 = ops.BasicBlock(64*2, 64, 1, 1, 0)
        self.c2 = ops.BasicBlock(64*3, 64, 1, 1, 0)
        self.c3 = ops.BasicBlock(64*4, 64, 1, 1, 0)
        
        self.upsample = ops.UpsampleBlock(64, scale=scale, 
                                          multi_scale=multi_scale,
                                          group=group)

        #@#@ Protect this convolution operation with ABFT
        self.exit = nn.Conv2d(64, 3, 3, 1, 1)
Esempio n. 7
0
    def __init__(self, args):
        super(CARN, self).__init__()

        #scale = kwargs.get("scale")
        #multi_scale = kwargs.get("multi_scale")
        #group = kwargs.get("group", 1)
        multi_scale = len(args.scale) > 1
        self.scale_idx = 0
        scale = args.scale[self.scale_idx]
        group = 1
        self.scale = args.scale
        rgb_mean = (0.4488, 0.4371, 0.4040)
        rgb_std = (1.0, 1.0, 1.0)
        self.sub_mean = common.MeanShift(args.rgb_range, rgb_mean, rgb_std)
        self.add_mean = common.MeanShift(args.rgb_range, rgb_mean, rgb_std, 1)
        #self.sub_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=True)
        #self.add_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=False)

        self.entry = nn.Conv2d(3, 64, 3, 1, 1)

        self.b1 = Block(64, 64)
        self.b2 = Block(64, 64)
        self.b3 = Block(64, 64)
        self.c1 = ops.BasicBlock(64 * 2, 64, 1, 1, 0)
        self.c2 = ops.BasicBlock(64 * 3, 64, 1, 1, 0)
        self.c3 = ops.BasicBlock(64 * 4, 64, 1, 1, 0)

        self.upsample = ops.UpsampleBlock(64,
                                          scale=scale,
                                          multi_scale=multi_scale,
                                          group=group)
        self.exit = nn.Conv2d(64, 3, 3, 1, 1)
Esempio n. 8
0
    def __init__(self, args, conv=common.default_conv):
        super(CARN, self).__init__()

        scale = args.scale[0]

        # RGB mean for DIV2K
        self.sub_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=True)
        self.add_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=False)

        #Single Image Mean
        # self.sub_mean = common.SubMeanStd
        # self.add_mean = common.AddMeanStd

        self.entry = nn.Conv2d(3, 64, 3, 1, 1)

        self.b1 = Block(64, 64)
        self.b2 = Block(64, 64)
        self.b3 = Block(64, 64)
        self.c1 = ops.BasicBlock(64 * 2, 64, 1, 1, 0)
        self.c2 = ops.BasicBlock(64 * 3, 64, 1, 1, 0)
        self.c3 = ops.BasicBlock(64 * 4, 64, 1, 1, 0)

        self.denoiser = nn.Sequential(*[ConvBN(64) for _ in range(5)])

        self.upsample = common.Upsampler(conv, scale, 64, act=False)
        self.exit = nn.Conv2d(64, 3, 3, 1, 1)
Esempio n. 9
0
    def __init__(self, channel, reduction=16):
        super(CALayer, self).__init__()

        self.avg_pool = nn.AdaptiveAvgPool2d(1)

        self.c1 = ops.BasicBlock(channel , channel // reduction, 3, 1, 3, 3)
        self.c2 = ops.BasicBlock(channel , channel // reduction, 3, 1, 5, 5)
        self.c3 = ops.BasicBlock(channel , channel // reduction, 3, 1, 7, 7)
        self.c4 = ops.BasicBlockSig((channel // reduction)*3, channel , 3, 1, 1)
Esempio n. 10
0
    def __init__(self, in_channels, out_channels, group=1):
        super(Block, self).__init__()

        self.b1 = ops.EResidualBlock2(in_channels, in_channels)
        self.b2 = ops.EResidualBlock2(in_channels, in_channels)
        self.b3 = ops.EResidualBlock2(in_channels, in_channels)
        self.c1 = ops.BasicBlock(in_channels * 2, in_channels, 1, 1, 0)
        self.c2 = ops.BasicBlock(in_channels * 3, in_channels, 1, 1, 0)
        self.c3 = ops.BasicBlock(in_channels * 4, in_channels, 1, 1, 0)
Esempio n. 11
0
    def __init__(self, args, in_channels, out_channels, group=4):
        super(BlockBucket, self).__init__()

        self.b1 = EResidualBlockBucket(args, args.n_feats, args.n_feats)
        self.b2 = EResidualBlockBucket(args, args.n_feats, args.n_feats)
        self.b3 = EResidualBlockBucket(args, args.n_feats, args.n_feats)
        self.c1 = ops.BasicBlock(args.n_feats * 2, args.n_feats, 1, 1, 0)
        self.c2 = ops.BasicBlock(args.n_feats * 3, args.n_feats, 1, 1, 0)
        self.c3 = ops.BasicBlock(args.n_feats * 4, args.n_feats, 1, 1, 0)
Esempio n. 12
0
    def __init__(self, in_channels, out_channels):
        super(Block, self).__init__()

        self.b1 = ops.ResidualBlock(64, 64)
        self.b2 = ops.ResidualBlock(64, 64)
        self.b3 = ops.ResidualBlock(64, 64)
        self.b4 = ops.ResidualBlock(64, 64)
        self.c1 = ops.BasicBlock(64 * 2, 64, 1)
        self.c2 = ops.BasicBlock(64 * 3, 64, 1)
        self.c3 = ops.BasicBlock(64 * 4, 64, 1)
        self.c4 = ops.BasicBlock(64 * 5, 64, 1)
Esempio n. 13
0
    def __init__(self, channel, reduction=16):
        super(CALayer, self).__init__()

        # global pooling
        self.avg_pool = nn.AdaptiveAvgPool2d(1)

        # laplacian attention
        self.c1 = ops.BasicBlock(channel, channel // reduction, 3, 1, 3, 3)
        self.c2 = ops.BasicBlock(channel, channel // reduction, 3, 1, 5, 5)
        self.c3 = ops.BasicBlock(channel, channel // reduction, 3, 1, 7, 7)
        self.c4 = ops.BasicBlockSig((channel // reduction) * 3, channel, 3, 1,
                                    1)  # sigmoid
Esempio n. 14
0
    def __init__(self, args):
        super(Net, self).__init__()
        self.args = args
        #scale = args.scale[0]
        self.scale = args.scale[0]
        #print(self.scale)
        multi_scale = args.multi_scale
        group = args.group
        #group = kwargs.get("group", 1)
        self.num_types = args.num_types
        self.neuf = args.neuf
        self.neufed = False
        self.part = args.part

        #self.sub_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=True)
        #self.add_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=False)
        if self.args.use_real:
            self.input_channels = self.args.n_colors + 3
        else:
            self.input_channels = self.args.n_colors
        self.entry = nn.Conv2d(self.input_channels, self.args.n_feats, 3, 1, 1)
        if self.args.split:
            self.b1 = BlockBucket(self.args, self.args.n_feats,
                                  self.args.n_feats)
            if self.args.bottom_only:
                self.b2 = Block(self.args.n_feats, self.args.n_feats)
                self.b3 = Block(self.args.n_feats, self.args.n_feats)
            else:
                self.b2 = BlockBucket(self.args, self.args.n_feats,
                                      self.args.n_feats)
                self.b3 = BlockBucket(self.args, self.args.n_feats,
                                      self.args.n_feats)
        else:
            self.b1 = Block(self.args.n_feats, self.args.n_feats)
            self.b2 = Block(self.args.n_feats, self.args.n_feats)
            self.b3 = Block(self.args.n_feats, self.args.n_feats)
        self.c1 = ops.BasicBlock(self.args.n_feats * 2, self.args.n_feats, 1,
                                 1, 0)
        self.c2 = ops.BasicBlock(self.args.n_feats * 3, self.args.n_feats, 1,
                                 1, 0)
        self.c3 = ops.BasicBlock(self.args.n_feats * 4, self.args.n_feats, 1,
                                 1, 0)

        if self.scale != 1:
            self.upsample = ops.UpsampleBlock(self.args.n_feats,
                                              scale=self.scale,
                                              multi_scale=multi_scale,
                                              group=group)
        else:
            self.upsample = None
        #print(self.upsample)
        self.exit = nn.Conv2d(self.args.n_feats, args.n_colors, 3, 1, 1)
Esempio n. 15
0
    def __init__(self,
                 in_channels,
                 out_channels,
                 group=1,
                 act=nn.ReLU(inplace=True)):
        super(Block, self).__init__()

        self.b1 = ops.EResidualBlock(64, 64, group=group)
        self.c1 = ops.BasicBlock(64 * 2, 64, 1)
        self.c2 = ops.BasicBlock(64 * 3, 64, 1)
        self.c3 = ops.BasicBlock(64 * 4, 64, 1)

        self.act = act
Esempio n. 16
0
    def __init__(self, channel, reduction=16):
        super(CALayer, self).__init__()

        self.avg_pool = nn.AdaptiveAvgPool2d(1)

        self.c1 = ops.BasicBlock(channel , channel // reduction, 1, 1, 0)
        self.c2 = ops.BasicBlockSig(channel // reduction, channel , 1, 1, 0)
Esempio n. 17
0
    def __init__(self, in_channels, out_channels, group=1):
        super(Block, self).__init__()

        self.r1 = ops.ResidualBlock(in_channels, out_channels)
        self.r2 = ops.ResidualBlock(in_channels*2, out_channels*2)
        self.r3 = ops.ResidualBlock(in_channels*4, out_channels*4)
        self.g = ops.BasicBlock(in_channels*8, out_channels, 1, 1, 0)
        self.ca = CALayer(in_channels)
Esempio n. 18
0
    def __init__(self, in_channels, out_channels, group=1):
        super(Block, self).__init__()

        self.r1 = ops.ResidualBlock(in_channels, out_channels)
        self.r2 = ops.ResidualBlock(in_channels * 2, out_channels * 2)
        self.r3 = ops.ResidualBlock(in_channels * 4, out_channels * 4)
        self.g = ops.BasicBlock(in_channels * 8, out_channels, 1, 1,
                                0)  # compression unit
        self.ca = CALayer(in_channels)  # laplacian attention
Esempio n. 19
0
    def __init__(self):
        super(Net, self).__init__()
        self.entry = ops.BasicBlock(3, 64, 3, act=nn.ReLU())
        self.progression = nn.ModuleList([CARN(), CARN(), CARN()])

        self.to_rgb = nn.ModuleList([
            nn.Conv2d(64, 3, 3, 1, 1),
            nn.Conv2d(64, 3, 3, 1, 1),
            nn.Conv2d(64, 3, 3, 1, 1),
        ])
Esempio n. 20
0
    def __init__(self, args, conv=common.default_conv):
        super(CARN, self).__init__()

        scale = args.scale[0]

        # RGB mean for DIV2K
        self.sub_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=True)
        self.add_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=False)

        self.entry = nn.Conv2d(3, 64, 3, 1, 1)

        self.b1 = Block(64, 64)
        self.b2 = Block(64, 64)
        self.b3 = Block(64, 64)
        self.c1 = ops.BasicBlock(64 * 2, 64, 1, 1, 0)
        self.c2 = ops.BasicBlock(64 * 3, 64, 1, 1, 0)
        self.c3 = ops.BasicBlock(64 * 4, 64, 1, 1, 0)

        self.upsample = common.Upsampler(conv, scale, 64, act=False)
        self.exit = nn.Conv2d(64, 3, 3, 1, 1)
Esempio n. 21
0
    def __init__(self):
        super(carn, self).__init__()

        group = 2

        self.sub_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=True)
        self.add_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=False)

        self.entry = nn.Conv2d(3, 64, 3, 1, 1)

        self.b1 = Block(64, 64)
        self.b2 = Block(64, 64)
        self.b3 = Block(64, 64)
        self.c1 = ops.BasicBlock(64 * 2, 64, 1, 1, 0)
        self.c2 = ops.BasicBlock(64 * 3, 64, 1, 1, 0)
        self.c3 = ops.BasicBlock(64 * 4, 64, 1, 1, 0)

        self.upsample = ops.UpsampleBlock(64,
                                          scale=2,
                                          multi_scale=False,
                                          group=group)
        self.exit = nn.Conv2d(64, 3, 3, 1, 1)
Esempio n. 22
0
    def __init__(self, **kwargs):
        super(Net, self).__init__()

        self.scale = kwargs.get("scale")
        self.multi_scale = kwargs.get("multi_scale")
        self.group = kwargs.get("group", 1)

        self.sub_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=True)
        self.add_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=False)

        self.entry = nn.Conv2d(3, 64, 3, 1, 1)

        self.b1 = Block(64, 64)
        self.b2 = Block(64, 64)
        self.b3 = Block(64, 64)
        self.c1 = ops.BasicBlock(64 * 2, 64, 1, 1, 0)
        self.c2 = ops.BasicBlock(64 * 3, 64, 1, 1, 0)
        self.c3 = ops.BasicBlock(64 * 4, 64, 1, 1, 0)

        self.upsamplex2 = ops.UpsampleBlockX2(64)
        self.upsamplex3 = ops.UpsampleBlockX3(64)
        self.upsamplex4 = ops.UpsampleBlockX4(64)
        self.exit = nn.Conv2d(64, 3, 3, 1, 1)
Esempio n. 23
0
    def __init__(self):
        super(CARN, self).__init__()

        self.b1 = Block(64, 64)
        self.b2 = Block(64, 64)
        self.b3 = Block(64, 64)
        self.b4 = Block(64, 64)
        self.b5 = Block(64, 64)
        self.b6 = Block(64, 64)
        self.b7 = Block(64, 64)
        self.b8 = Block(64, 64)
        self.c1 = ops.BasicBlock(64 * 2, 64, 1)
        self.c2 = ops.BasicBlock(64 * 3, 64, 1)
        self.c3 = ops.BasicBlock(64 * 4, 64, 1)
        self.c4 = ops.BasicBlock(64 * 5, 64, 1)
        self.c5 = ops.BasicBlock(64 * 6, 64, 1)
        self.c6 = ops.BasicBlock(64 * 7, 64, 1)
        self.c7 = ops.BasicBlock(64 * 8, 64, 1)
        self.c8 = ops.BasicBlock(64 * 9, 64, 1)

        self.up = ops.UpsampleBlock(64, scale=2)
Esempio n. 24
0
    def __init__(self, args):
        super(RIDNET, self).__init__()
        
        n_feats = args.n_feats
        kernel_size = 3
        reduction = args.reduction 
        
        rgb_mean = (0.4488, 0.4371, 0.4040)
        rgb_std = (1.0, 1.0, 1.0)

        self.sub_mean = common.MeanShift(args.rgb_range, rgb_mean, rgb_std)       
        self.add_mean = common.MeanShift(args.rgb_range, rgb_mean, rgb_std, 1)

        self.head = ops.BasicBlock(3, n_feats, kernel_size, 1, 1)

        self.b1 = Block(n_feats, n_feats)
        self.b2 = Block(n_feats, n_feats)
        self.b3 = Block(n_feats, n_feats)
        self.b4 = Block(n_feats, n_feats)

        self.tail = nn.Conv2d(n_feats, 3, kernel_size, 1, 1, 1)
Esempio n. 25
0
 def __init__(self, in_channels, out_channels, group=1, mode='None'):
     super(first_block, self).__init__(in_channels, out_channels)
     self.c1 = ops.BasicBlock(in_channels * 2, out_channels, 1, 1, 0)
     self.c2 = ops.BasicBlock(in_channels * 3, out_channels, 1, 1, 0)
     self.c3 = ops.BasicBlock(in_channels * 4, out_channels, 1, 1, 0)
Esempio n. 26
0
 def __init__(self, filter):
     super(normal_carn_cell, self).__init__()
     self.cell1 = first_block(filter, filter)
     self.cell2 = normal_block(filter, filter)
     self.cell3 = normal_block(filter, filter)
     self.c0 = ops.BasicBlock(filter * 1 + filter, filter, 1, 1, 0)
Esempio n. 27
0
    def __init__(self, args):
        super(DRLN, self).__init__()
        
        self.stop_block = 1
        self.scale = 3#args.scale[0]
        chs=64

        self.sub_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=True)
        self.add_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=False)
        
        self.head = nn.Conv2d(3, chs, 3, 1, 1)

        self.b1 = Block(chs, chs)
        self.b2 = Block(chs, chs)
        self.b3 = Block(chs, chs)
        self.b4 = Block(chs, chs)
        self.b5 = Block(chs, chs)
        self.b6 = Block(chs, chs)
        self.b7 = Block(chs, chs)
        self.b8 = Block(chs, chs)
        self.b9 = Block(chs, chs)
        self.b10 = Block(chs, chs)
        self.b11 = Block(chs, chs)
        self.b12 = Block(chs, chs)
        self.b13 = Block(chs, chs)
        self.b14 = Block(chs, chs)
        self.b15 = Block(chs, chs)
        self.b16 = Block(chs, chs)
        self.b17 = Block(chs, chs)
        self.b18 = Block(chs, chs)
        self.b19 = Block(chs, chs)
        self.b20 = Block(chs, chs)
        
        self.b21 = Block(chs, chs)
        self.b22 = Block(chs, chs)
        self.b23 = Block(chs, chs)
        self.b24 = Block(chs, chs)

        self.c1 = ops.BasicBlock(chs*2, chs, 3, 1, 1)
        self.c2 = ops.BasicBlock(chs*3, chs, 3, 1, 1)
        self.c3 = ops.BasicBlock(chs*4, chs, 3, 1, 1)
        self.c4 = ops.BasicBlock(chs*2, chs, 3, 1, 1)
        self.c5 = ops.BasicBlock(chs*3, chs, 3, 1, 1)
        self.c6 = ops.BasicBlock(chs*4, chs, 3, 1, 1)
        self.c7 = ops.BasicBlock(chs*2, chs, 3, 1, 1)
        self.c8 = ops.BasicBlock(chs*3, chs, 3, 1, 1)
        self.c9 = ops.BasicBlock(chs*4, chs, 3, 1, 1)
        self.c10 = ops.BasicBlock(chs*2, chs, 3, 1, 1)
        self.c11 = ops.BasicBlock(chs*3, chs, 3, 1, 1)
        self.c12 = ops.BasicBlock(chs*4, chs, 3, 1, 1)
        self.c13 = ops.BasicBlock(chs*2, chs, 3, 1, 1)
        self.c14 = ops.BasicBlock(chs*3, chs, 3, 1, 1)
        self.c15 = ops.BasicBlock(chs*4, chs, 3, 1, 1)
        self.c16 = ops.BasicBlock(chs*5, chs, 3, 1, 1)
        self.c17 = ops.BasicBlock(chs*2, chs, 3, 1, 1)
        self.c18 = ops.BasicBlock(chs*3, chs, 3, 1, 1)
        self.c19 = ops.BasicBlock(chs*4, chs, 3, 1, 1)
        self.c20 = ops.BasicBlock(chs*5, chs, 3, 1, 1)
        
        self.c21 = ops.BasicBlock(chs*2, chs, 3, 1, 1)
        self.c22 = ops.BasicBlock(chs*3, chs, 3, 1, 1)
        self.c23 = ops.BasicBlock(chs*4, chs, 3, 1, 1)
        self.c24 = ops.BasicBlock(chs*5, chs, 3, 1, 1)

        self.upsample = ops.UpsampleBlock(chs, self.scale , multi_scale=False)
    
        self.tail = nn.Conv2d(chs, 3, 3, 1, 1)
Esempio n. 28
0
    def __init__(self, args):
        super(DRLN, self).__init__()

        #n_resgroups = args.n_resgroups
        #n_resblocks = args.n_resblocks
        #n_feats = args.n_feats
        #kernel_size = 3
        #reduction = args.reduction
        #scale = args.scale[0]
        #act = nn.ReLU(True)

        self.scale = args.scale[0]
        chs = 64

        self.sub_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=True)
        self.add_mean = ops.MeanShift((0.4488, 0.4371, 0.4040), sub=False)

        self.head = nn.Conv2d(3, chs, 3, 1, 1)  # feature extraction

        self.b1 = Block(chs, chs)  # DRLM
        self.b2 = Block(chs, chs)
        self.b3 = Block(chs, chs)
        self.b4 = Block(chs, chs)
        self.b5 = Block(chs, chs)
        self.b6 = Block(chs, chs)
        self.b7 = Block(chs, chs)
        self.b8 = Block(chs, chs)
        self.b9 = Block(chs, chs)
        self.b10 = Block(chs, chs)
        self.b11 = Block(chs, chs)
        self.b12 = Block(chs, chs)
        self.b13 = Block(chs, chs)
        self.b14 = Block(chs, chs)
        self.b15 = Block(chs, chs)
        self.b16 = Block(chs, chs)
        self.b17 = Block(chs, chs)
        self.b18 = Block(chs, chs)
        self.b19 = Block(chs, chs)
        self.b20 = Block(chs, chs)

        self.c1 = ops.BasicBlock(chs * 2, chs, 3, 1, 1)
        self.c2 = ops.BasicBlock(chs * 3, chs, 3, 1, 1)
        self.c3 = ops.BasicBlock(chs * 4, chs, 3, 1, 1)
        self.c4 = ops.BasicBlock(chs * 2, chs, 3, 1, 1)
        self.c5 = ops.BasicBlock(chs * 3, chs, 3, 1, 1)
        self.c6 = ops.BasicBlock(chs * 4, chs, 3, 1, 1)
        self.c7 = ops.BasicBlock(chs * 2, chs, 3, 1, 1)
        self.c8 = ops.BasicBlock(chs * 3, chs, 3, 1, 1)
        self.c9 = ops.BasicBlock(chs * 4, chs, 3, 1, 1)
        self.c10 = ops.BasicBlock(chs * 2, chs, 3, 1, 1)
        self.c11 = ops.BasicBlock(chs * 3, chs, 3, 1, 1)
        self.c12 = ops.BasicBlock(chs * 4, chs, 3, 1, 1)
        self.c13 = ops.BasicBlock(chs * 2, chs, 3, 1, 1)
        self.c14 = ops.BasicBlock(chs * 3, chs, 3, 1, 1)
        self.c15 = ops.BasicBlock(chs * 4, chs, 3, 1, 1)
        self.c16 = ops.BasicBlock(chs * 5, chs, 3, 1, 1)
        self.c17 = ops.BasicBlock(chs * 2, chs, 3, 1, 1)
        self.c18 = ops.BasicBlock(chs * 3, chs, 3, 1, 1)
        self.c19 = ops.BasicBlock(chs * 4, chs, 3, 1, 1)
        self.c20 = ops.BasicBlock(chs * 5, chs, 3, 1, 1)

        self.upsample = ops.UpsampleBlock(chs, self.scale, multi_scale=False)
        #self.convert = ops.ConvertBlock(chs, chs, 20)
        self.tail = nn.Conv2d(chs, 3, 3, 1, 1)