-
Notifications
You must be signed in to change notification settings - Fork 1
/
experiment_test_sf_0.py
67 lines (56 loc) · 2.61 KB
/
experiment_test_sf_0.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#! /usr/bin/env python
# -*- coding: utf8 -*-
from __future__ import division, print_function
"""
Testing some parameters of the SparseEdges framework on its efficiency.
rm -fr cache_dir/edges/testing_* cache_dir/testing_*
rm -fr results/edges/testing_* results/testing_*
frioul_batch -n "14,15,16" -M 36 'python experiment_test_parameters.py'
frioul_batch -M 200 'python experiment_test_parameters.py'
"""
__author__ = "(c) Laurent Perrinet INT - CNRS"
import numpy as np
import matplotlib
matplotlib.use("Agg") # agg-backend, so we can create figures without x-server (no PDF, just PNG etc.)
from SparseEdges import SparseEdges
# TODO: here, we are more interested in the processing of the database, not the comparison - use the correct function
# TODO : annotate the efficiency of different LogGabor bases (RMSE?)
# TODO: make a circular mask to avoid border effects coming with whitening...
#! comparing databases
#!--------------------
mp = SparseEdges('https://raw.githubusercontent.com/bicv/SparseEdges/master/default_param.py')
mp.N = 128
mp.pe.datapath = '../../SLIP/database/'
mp.process('testing_vanilla')
# TODO: CRF
mp.process('testing_noise', noise=mp.pe.noise)
mp.process('testing_vanilla', name_database='serre07_targets')
# TODO : make an experiment showing that using scale does not bring much
mps, experiments = [], []
white_f0s = np.linspace(0.3, .6, 9)
for white_f0 in white_f0s:
mp = SparseEdges('https://raw.githubusercontent.com/bicv/SparseEdges/master/default_param.py')
mp.N = 128
mp.pe.datapath = '../../SLIP/database/'
mp.pe.white_f0 = white_f0
mp.init()
exp = 'testing_white_f0_' + str(white_f0).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' % white_f0 for white_f0 in white_f0s]
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' $Mf_{0}$')
import os
mp.savefig(fig, os.path.join(mp.pe.figpath, 'testing_white_f0'), display=True)
## 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.