def __init__(self, args, conv=common.default_conv, BBlock=common.BBlock): super(BSR, self).__init__() n_colors = args.n_colors self.scale_idx = 0 #self.in_channels = args.in_channels self.is_fcSim = args.is_fcSim self.toRGB = common.ApplyBayer2RGB(normalize=False) # Initial Reconstruction self.init_recon1 = common.KronConv(in_channels=1, out_channels=1, mid_channels=1, act=args.is_act) self.init_recon2 = common.KronConv(in_channels=1, out_channels=1, mid_channels=1, act=args.is_act) self.init_recon3 = common.KronConv(in_channels=1, out_channels=1, mid_channels=1, act=args.is_act) self.init_recon4 = common.KronConv(in_channels=1, out_channels=1, mid_channels=1, act=args.is_act) self.init_simp = common.FlatCamSimInverse() self.conv = nn.Conv2d(4, 3, kernel_size=1, stride=1, padding=0, bias=False)
def __init__(self, args, conv=common.default_conv, BBlock=common.BBlock): super(BSR, self).__init__() n_colors = args.n_colors self.scale_idx = 0 #self.in_channels = args.in_channels self.is_fcSim = args.is_fcSim self.toRGB = common.ApplyBayer2RGB(normalize=False) # Sampling layer if args.is_fcSim: self.fc_sim = common.FlatCamSampSim(args.batch_size) self.add_noise = common.AddNoise(nSig=args.sigma) self.toBayer = common.ApplyRaw2Bayer() # Initial Reconstruction self.init_recon1 = common.KronConv(in_channels=1, out_channels=1, mid_channels=1, act=args.is_act) self.init_recon2 = common.KronConv(in_channels=1, out_channels=1, mid_channels=1, act=args.is_act) self.init_recon3 = common.KronConv(in_channels=1, out_channels=1, mid_channels=1, act=args.is_act) self.init_recon4 = common.KronConv(in_channels=1, out_channels=1, mid_channels=1, act=args.is_act)
def __init__(self, args, conv=common.default_conv, BBlock=common.BBlock): super(BSR, self).__init__() self.out_channels = 4 self.scale_idx = 0 self.is_fcSim = args.is_fcSim self.toRGB = common.ApplyBayer2RGB(normalize=False) self.n_colors = args.n_colors # Sampling layer if args.is_fcSim: self.fc_sim = common.FlatCamSampSim(args.batch_size) self.add_noise = common.AddNoise(nSig=args.sigma) self.toBayer = common.ApplyRaw2Bayer() # Initial Reconstruction self.init_recon = common.KronConv(in_channels = 4, out_channels=self.out_channels,\ mid_channels=args.mid_channels, act = args.is_act) self.conv = nn.Conv2d(4, 3, kernel_size=1, stride=1, padding=0, bias=False)
def __init__(self, args, conv=common.default_conv, BBlock = common.BBlock): super(BSR, self).__init__() self.out_channels = 4 self.scale_idx = 0 self.is_fcSim = args.is_fcSim self.toRGB = common.ApplyBayer2RGB(normalize = False) n_colors = args.n_colors n_feats = args.n_feats # Sampling layer if args.is_fcSim: self.fc_sim = common.FlatCamSampSim(args.batch_size) self.add_noise = common.AddNoise(nSig = args.sigma) self.toBayer = common.ApplyRaw2Bayer() # Initial Reconstruction self.init_recon = common.KronConv(in_channels = 4, out_channels=self.out_channels,\ mid_channels=args.mid_channels, act = args.is_act) self.conv = nn.Conv2d(4, 3, kernel_size = 1, stride= 1, padding= 0, bias= False) # Enhance reconstruction act = nn.ReLU(True) self.DWT = common.DWT() self.IWT = common.IWT() n = 3 m_head = [BBlock(conv, 4 * n_colors, 160, 3, act=act)] d_l1 = [] for _ in range(n): d_l1.append(BBlock(conv, 160, 160, 3, act=act)) d_l2 = [BBlock(conv, 640, n_feats * 4, 3, act=act)] for _ in range(n): d_l2.append(BBlock(conv, n_feats * 4, n_feats * 4, 3, act=act)) pro_l3 = [BBlock(conv, n_feats * 16, n_feats * 4, 3, act=act)] for _ in range(n*2): pro_l3.append(BBlock(conv, n_feats * 4, n_feats * 4, 3, act=act)) pro_l3.append(BBlock(conv, n_feats * 4, n_feats * 16, 3, act=act)) i_l2 = [] for _ in range(n): i_l2.append(BBlock(conv, n_feats * 4, n_feats * 4, 3, act=act)) i_l2.append(BBlock(conv, n_feats * 4,640, 3, act=act)) i_l1 = [] for _ in range(n): i_l1.append((BBlock(conv,160, 160, 3, act=act))) m_tail = [conv(160, 4 * n_colors, 3)] self.head = nn.Sequential(*m_head) self.d_l2 = nn.Sequential(*d_l2) self.d_l1 = nn.Sequential(*d_l1) self.pro_l3 = nn.Sequential(*pro_l3) self.i_l2 = nn.Sequential(*i_l2) self.i_l1 = nn.Sequential(*i_l1) self.tail = nn.Sequential(*m_tail)
def __init__(self, args, conv=common.default_conv, BBlock=common.BBlock): super(BSR, self).__init__() self.out_channels = 4 self.scale_idx = 0 self.is_fcSim = args.is_fcSim self.toRGB = common.ApplyBayer2RGB(normalize=False) self.n_colors = args.n_colors self.init_recon = common.KronConv(in_channels = 4, out_channels=self.out_channels,\ mid_channels=args.mid_channels, act = args.is_act) self.conv = nn.Conv2d(4, 3, kernel_size=1, stride=1, padding=0, bias=False)