示例#1
0
            'RelaxParam': 1.8,
            'RelStopTol': 1e-7,
            'MaxMainIter': 50,
            'FastSolve': False,
            'DataType': np.float32
        }
    })
    lmbda = 0.2

    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))

    data_ra_new = []
    for i in range(1, int(data_ra.shape[0] / 1000)):
        data_ra_new.append(data_ra[(i - 1) * 1000:i * 1000, :])
    data_ra = np.asarray(data_ra_new)
    print(data_ra.shape, "New data_ra shape")

    stimulus_ra_new = []
    for i in range(1, int(stimulus_ra.shape[0] / 1000)):
        stimulus_ra_new.append(stimulus_ra[(i - 1) * 1000:i * 1000, :])
    stimulus_ra = np.asarray(stimulus_ra_new)

    d = online_cdl.OnlineConvBPDNDictLearn(np2cp(np.load('Data_81sets/v_ra')),
示例#2
0
opt = pdcsc.ConvProdDictL1L1Grd.Options(
    {'Verbose': True, 'MaxMainIter': 100, 'RelStopTol': 5e-3,
     'AuxVarObj': False, 'rho': 1e1, 'RelaxParam': 1.8,
     'L1Weight': np2cp(wl1), 'GradWeight': np2cp(wgr)})


"""
Initialise the :class:`.admm.pdcsc.ConvProdDictL1L1Grd` 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 = pdcsc.ConvProdDictL1L1Grd(np2cp(D), np2cp(B), np2cp(pad(imgn)),
                              lmbda, mu, opt=opt, dimK=0)
X = cp2np(b.solve())


"""
The denoised estimate of the image is just the reconstruction from all coefficient maps.
"""

imgdp = cp2np(b.reconstruct().squeeze())
imgd = crop(imgdp)