def test_14(self): N = 16 Nd = 5 Cs = 3 M = 4 D = cp.random.randn(Nd, Nd, M) s = cp.random.randn(N, N, Cs) lmbda = 1e-1 try: opt = cbpdn.ConvBPDNJoint.Options({'LinSolveCheck': True}) b = cbpdn.ConvBPDNJoint(D, s, lmbda, opt=opt, dimK=0) b.solve() except Exception as e: print(e) assert 0 assert list2array(b.getitstat().XSlvRelRes).max() < 1e-5
def test_15(self): N = 16 Nd = 5 K = 2 M = 4 D = cp.random.randn(Nd, Nd, M) s = cp.random.randn(N, N, K) dt = cp.float32 opt = cbpdn.ConvBPDNJoint.Options( {'Verbose': False, 'MaxMainIter': 20, 'AutoRho': {'Enabled': True}, 'DataType': dt}) lmbda = 1e-1 mu = 1e-2 b = cbpdn.ConvBPDNJoint(D, s, lmbda, mu, opt=opt) b.solve() assert b.X.dtype == dt assert b.Y.dtype == dt assert b.U.dtype == dt
}, 'rho': 1e3 * lmbda }) """ Initialise a ``sporco.cupy`` version of a :class:`.admm.cbpdn.ConvBPDNJoint` object and call the ``solve`` method. """ if not cupy_enabled(): print('CuPy/GPU device not available: running without GPU acceleration\n') else: id = select_device_by_load() info = gpu_info() if info: print('Running on GPU %d (%s)\n' % (id, info[id].name)) b = cbpdn.ConvBPDNJoint(np2cp(D), np2cp(pad(imgnh)), lmbda, mu, opt, dimK=0) X = cp2np(b.solve()) """ The denoised estimate of the image is just the reconstruction from the coefficient maps. """ imgdp = cp2np(b.reconstruct().squeeze()) imgd = np.clip(crop(imgdp) + imgnl, 0, 1) """ Display solve time and denoising performance. """ print("ConvBPDNJoint solve time: %5.2f s" % b.timer.elapsed('solve')) print("Noisy image PSNR: %5.2f dB" % metric.psnr(img, imgn)) print("Denoised image PSNR: %5.2f dB" % metric.psnr(img, imgd)) """