def test_01(self): lmbda = 1e-1 opt = onlinecdl.OnlineConvBPDNDictLearn.Options() try: b = onlinecdl.OnlineConvBPDNDictLearn(self.D0, lmbda, opt=opt) for it in range(10): img_index = np.random.randint(0, self.S.shape[-1]) b.solve(self.S[..., img_index]) except Exception as e: print(e) assert 0
def test_02(self): lmbda = 1e-1 opts = onlinecdl.OnlineConvBPDNDictLearn.Options( {'CBPDN': { 'MaxMainIter': 10, 'AutoRho': { 'Enabled': False } }}) try: b = onlinecdl.OnlineConvBPDNDictLearn(self.D0, lmbda, opt=opts) for it in range(10): img_index = np.random.randint(0, self.S.shape[-1]) b.solve(self.S[..., [img_index]]) except Exception as e: print(e) assert 0
""" lmbda = 0.2 opt = onlinecdl.OnlineConvBPDNDictLearn.Options({ 'Verbose': True, 'ZeroMean': False, 'eta_a': 10.0, 'eta_b': 20.0, 'DataType': np.float32, 'CBPDN': {'rho': 5.0, 'AutoRho': {'Enabled': True}, 'RelaxParam': 1.8, 'RelStopTol': 1e-7, 'MaxMainIter': 50, 'FastSolve': False, 'DataType': np.float32}}) """ Create solver object and solve. """ d = onlinecdl.OnlineConvBPDNDictLearn(D0, lmbda, opt) iter = 50 d.display_start() for it in range(iter): img_index = np.random.randint(0, sh.shape[-1]) d.solve(sh[..., [img_index]]) d.display_end() D1 = d.getdict() print("OnlineConvBPDNDictLearn solve time: %.2fs" % d.timer.elapsed('solve')) """ Display initial and final dictionaries. """