示例#1
0
    def test_05(self):
        D = cp.random.randn(4, 32)
        s = cp.random.randn(64)
        Wg = np.concatenate((cp.eye(16), cp.eye(16)), axis=-1)
        lmbda = 0.1
        mu = 0.01
        gamma = 0.01

        # ConvBPDNInhib class
        opt = cbpdnin.ConvBPDNInhib.Options({
            'Verbose': False,
            'MaxMainIter': 10
        })

        try:
            b = cbpdnin.ConvBPDNInhib(D,
                                      s,
                                      Wg=Wg,
                                      lmbda=lmbda,
                                      mu=mu,
                                      gamma=gamma,
                                      opt=opt,
                                      dimN=1)
            b.solve()
        except Exception as e:
            print(e)
            assert 0
示例#2
0
    def test_01(self):
        D = cp.random.randn(4, 4, 32)
        s = cp.random.randn(8, 8)

        # ConvBPDNInhib class
        opt = cbpdnin.ConvBPDNInhib.Options({
            'Verbose': False,
            'MaxMainIter': 10
        })

        try:
            b = cbpdnin.ConvBPDNInhib(D, s, opt=opt)
            b.solve()
        except Exception as e:
            print(e)
            assert 0
示例#3
0
    def test_02(self):
        D = cp.random.randn(4, 4, 32)
        s = cp.random.randn(8, 8)
        Wg = cp.concatenate((cp.eye(16), cp.eye(16)), axis=-1)
        lmbda = 0.1

        # ConvBPDNInhib class
        opt = cbpdnin.ConvBPDNInhib.Options({
            'Verbose': False,
            'MaxMainIter': 10
        })

        try:
            b = cbpdnin.ConvBPDNInhib(D, s, Wg=Wg, lmbda=lmbda, opt=opt)
            b.solve()
        except Exception as e:
            print(e)
            assert 0
示例#4
0
                                     'rho': 100, 'AutoRho': {'Enabled': False}})


"""
Initialise and run CSC solver.
"""

Wg = np.eye(24)
Wg = np.repeat(Wg, M, axis=1)

if CUPY:
    D = np2cp(D)
    Wg = np2cp(Wg)
    audio = np2cp(audio)

b = cbpdnin.ConvBPDNInhib(D.T, audio, Wg, int(
    0.20*16000), None, lmbda, mu, gamma, opt, dimK=None, dimN=1)
X = b.solve()

if CUPY:
    X = cp2np(X)

print("ConvBPDN solve time: %.2fs" % b.timer.elapsed('solve'))


"""
Reconstruct image from sparse representation.
"""

recon = b.reconstruct().squeeze()

if CUPY: