# ==================================================================================================# mps, experiments = [], [] v_B_sf = np.logspace(-.2, .2, 5, base=10, endpoint=True)*mp.pe.B_sf for B_sf in v_B_sf: mp = init_mp() mp.pe.B_sf = B_sf exp = 'efficiency_B_sf_' + str(B_sf).replace('.', '_') mp.process(exp) experiments.append(exp) mps.append(mp) databases = ['serre07_distractors'] * len(experiments) labels = ['%0.2f' % B_sf for B_sf in v_B_sf] try: fig, A, inset = mp.plot(mps=mps, experiments=experiments, databases=databases, labels=labels, ref=2, fig=fig, ax=A, color=[0., 1., 0.], threshold=threshold, scale=False) A.set_xlabel(r'frequency bandwith $B_{sf}$') #A.set_yticks([0., 0.02, 0.04, 0.06]) except Exception as e: print('Failed to plot with error : %s ' % e ) # ==================================================================================================# mps, experiments = [], [] v_B_theta = np.logspace(-.5, .5, 5, base=10, endpoint=True)*mp.pe.B_theta for B_theta in v_B_theta: mp = init_mp() mp.pe.B_theta = B_theta exp = 'efficiency_B_theta_' + str(B_theta).replace('.', '_') mp.process(exp) experiments.append(exp)
v_alpha = np.linspace(0.3, 1., 9) for MP_alpha in v_alpha: mp = SparseEdges('https://raw.githubusercontent.com/bicv/SparseEdges/master/default_param.py') mp.N = 128 mp.pe.datapath = '../../SLIP/database/' mp.pe.MP_alpha = MP_alpha mp.init() exp = 'testing_MP_alpha_' + str(MP_alpha).replace('.', '_') mp.process(exp) experiments.append(exp) mps.append(mp) import matplotlib.pyplot as plt fig_width_pt = 900 #318.670*.61 # Get this from LaTeX using \showthe\columnwidth inches_per_pt = 1.0/72.27 # Convert pt to inches fig_width = fig_width_pt*inches_per_pt # width in inches threshold = None threshold = .25 databases = ['serre07_distractors'] * len(experiments) labels = ['%0.2f' % MP_alpha for MP_alpha in v_alpha] fig = plt.figure(figsize=(fig_width, fig_width/1.618)) fig, a, ax = mp.plot(mps=mps, experiments=experiments, databases=databases, labels=labels, fig=fig, color=[0., 1., 0.], threshold=threshold, scale=True) a.set_xlabel(r' $\alpha$') import os for ext in FORMATS: fig.savefig(os.path.join(mp.pe.figpath, 'testing_alpha.' + ext)) ## TODO: would be interesting to see how that changes with number of image patches used, i.e. whether it settles down to that particular pattern or just jumps around.
sizes = [16, 32, 64, 128, 256] N_image = 32 N = 1024 for size, size_str in zip(sizes, ['_016', '_032', '_064', '_128', '']): mp = SparseEdges('https://raw.githubusercontent.com/bicv/SparseEdges/master/default_param.py') mp.pe.seed = 42 mp.pe.datapath = '../../SLIP/database/' mp.set_size((size, size)) downscale_factor = sizes[-1]/size # > 1 mp.pe.N_image = int(N_image*downscale_factor) mp.pe.N = int(N/downscale_factor**2) mp.init() mp.process('SparseLets' + size_str) mps.append(mp) import matplotlib.pyplot as plt fig_width_pt = 600 # Get this from LaTeX using \showthe\columnwidth inches_per_pt = 1.0/72.27 # Convert pt to inches fig_width = fig_width_pt*inches_per_pt # width in inches fig = plt.figure(figsize=(fig_width, fig_width/1.618)) sizes = [16, 32, 64, 128, 256] experiments = ['SparseLets_' + '%0.3d' % size for size in sizes] experiments[-1] = 'SparseLets' databases = ['serre07_distractors'] * len(experiments) labels = [str(size) for size in sizes] fig, ax, inset = mp.plot(fig=fig, mps=mps, experiments=experiments, databases=databases, labels=labels, scale=True) FORMATS = ['pdf', 'eps'] for ext in FORMATS: fig.savefig(mps[0].pe.figpath + 'SparseLets_B.' + ext)