コード例 #1
0
    def __init__(self, args):
        super(EDSR, self).__init__()
        nResBlock = args.nResBlock
        nFeat = args.nFeat
        scale = args.scale[0]

        self.args = args

        # Submean layer
        self.subMean = common.meanShift(
            args.rgbRange,
            (0.4488, 0.4371, 0.4040), -1 * args.subMean)

        # Head convolution for feature extracting
        self.headConv = common.conv3x3(args.nChannel, nFeat)

        # Main branch
        modules = [common.ResBlock(nFeat) for _ in range(nResBlock)]
        modules.append(common.conv3x3(nFeat, nFeat))
        self.body = nn.Sequential(*modules)

        # Upsampler
        self.upsample = common.upsampler(scale, nFeat)

        # Tail convolution for reconstruction
        self.tailConv = common.conv3x3(nFeat, args.nChannel)

        # Addmean layer
        self.addMean = common.meanShift(
            args.rgbRange,
            (0.4488, 0.4371, 0.4040), 1 * args.subMean)
コード例 #2
0
    def __init__(self, args):
        super(EDSR_scale, self).__init__(args)
        nResBlock = args.nResBlock
        nFeat = args.nFeat

        # Main branch
        modules = [
            common.ResBlock_scale(nFeat, scale=0.1) for _ in range(nResBlock)]
        modules.append(common.conv3x3(nFeat, nFeat))
        self.body = nn.Sequential(*modules)
コード例 #3
0
    def __init__(self, args):
        super(MDSR, self).__init__()
        nResBlock = args.nResBlock
        nFeat = args.nFeat
        self.args = args

        subMul, addMul = -1 * args.subMean, 1 * args.subMean

        # Submean layer
        self.subMean = common.meanShift(
            args.rgbRange,
            (0.4488, 0.4371, 0.4040),
            subMul)

        # Head convolution for feature extracting
        self.headConv = common.conv3x3(args.nChannel, nFeat)

        # Scale-dependent pre-processing module
        self.preProcess = nn.ModuleList([
            nn.Sequential(
                common.ResBlock(nFeat, kernel_size=5),
                common.ResBlock(nFeat, kernel_size=5)) for _ in args.scale])

        # Main branch
        modules = [common.ResBlock(nFeat) for _ in range(nResBlock)]
        modules.append(common.conv3x3(nFeat, nFeat))
        self.body = nn.Sequential(*modules)

        # Scale-dependent upsampler
        self.upsample = nn.ModuleList([
            common.upsampler(s, nFeat) for s in args.scale])

        # Tail convolution for reconstruction
        self.tailConv = common.conv3x3(nFeat, args.nChannel)

        # Addmean layer
        self.addMean = common.meanShift(
            args.rgbRange,
            (0.4488, 0.4371, 0.4040),
            addMul)

        self.scaleIdx = 0