예제 #1
0
                                          sigma.size()[-1])

        x = self.m_down(x)
        # m = torch.ones(sigma.size()[0], sigma.size()[1], x.size()[-2], x.size()[-1]).type_as(x).mul(sigma)
        #m = sigma.repeat(1, 1, x.size()[-2], x.size()[-1])
        print(sigma.size())
        m = sigma
        print('coco')
        print(x.size())
        print(m.size())
        print('caca')
        x = torch.cat((x, m), 1)
        x = self.model(x)
        x = self.m_up(x)

        x = x[..., :h, :w]
        return x


if __name__ == '__main__':
    from utils import utils_model
    model = FFDNet(in_nc=1, out_nc=1, nc=64, nb=15, act_mode='R')
    print(utils_model.describe_model(model))

    x = torch.randn((2, 1, 240, 240))
    sigma = torch.randn(2, 1, 1, 1)
    x = model(x, sigma)
    print(x.shape)

    #  run models/network_ffdnet.py
예제 #2
0
            B.conv(nc, nc, mode='C' + act_mode, bias=bias)
            for _ in range(nb - 2)
        ]
        m_tail = B.conv(nc, out_nc, mode='C', bias=bias)

        self.model = B.sequential(m_head, *m_body, m_tail)

    def forward(self, x):
        x = self.model(x)
        return x


if __name__ == '__main__':
    from utils import utils_model
    import torch
    model1 = DnCNN(in_nc=1, out_nc=1, nc=64, nb=20, act_mode='BR')
    print(utils_model.describe_model(model1))

    model2 = FDnCNN(in_nc=2, out_nc=1, nc=64, nb=20, act_mode='R')
    print(utils_model.describe_model(model2))

    x = torch.randn((1, 1, 240, 240))
    x1 = model1(x)
    print(x1.shape)

    x = torch.randn((1, 2, 240, 240))
    x2 = model2(x)
    print(x2.shape)

    #  run models/network_dncnn.py