In [1]:
%matplotlib inline
%pylab inline
In [2]:
from menpofast.feature import no_op, fast_dsift
from alabortijcv2015.utils import pickle_load
path = '/data/'
db = 'afw'
aam_type = 'GlobalAAM_PWA'
features_type = fast_dsift.__name__
#noise_std = [0, 0.02, 0.04, 0.06, 0.08]
noise_std = [0.04]
sicn, sfcn, ssc, sbc = [], [], [], []
aicn, afcn, asc, abc = [], [], [], []
bicn, bfcn, bsc, bbc = [], [], [], []
for n in noise_std:
#sicn.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_SICN_' + db + '_' + str(n)))
#sfcn.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_SFCN_' + db + '_' + str(n)))
ssc.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_SSC_' + db + '_' + str(n)))
sbc.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_SBC_' + db + '_' + str(n)))
#aicn.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_AICN_' + db + '_' + str(n)))
#afcn.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_AFCN_' + db + '_' + str(n)))
asc.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_ASC_' + db + '_' + str(n)))
abc.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_ABC_' + db + '_' + str(n)))
#bicn.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_BICN_' + db + '_' + str(n)))
#bfcn.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_BFCN_' + db + '_' + str(n)))
bsc.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_BSC_' + db + '_' + str(n)))
bbc.append(pickle_load(path + 'PhD/Results/ijcv2015/exp3_' + aam_type + '_' + features_type + '_BBC_' + db + '_' + str(n)))
results = [sicn, sfcn, ssc, sbc,
aicn, afcn, asc, abc,
bicn, bfcn, bsc, bbc]
In [3]:
results = [ssc, sbc,
asc, abc,
bsc, bbc]
legend_entries = ['SSC', 'SBC',
'ASC', 'ABC',
'BSC', 'BBC']
In [4]:
all_errors = []
for fitter_results in results:
mean_errors = []
for frs in fitter_results:
errors = [fr.final_error() for fr in frs]
mean_error = np.mean(errors)
mean_errors.append(mean_error)
all_errors.append(mean_errors)
all_errors = np.asarray(all_errors)
x_values = noise_std
In [5]:
plot(x_values, all_errors.T, linewidth=1, marker='o', ms=5)
legend(legend_entries, bbox_to_anchor=(1.3, 1.025))
xlabel('Initialization')
ylabel('Mean Normalized Point-to-Point Error')
Out[5]:
In [6]:
all_errors = []
for fitter_results in results:
mean_errors = []
for frs in fitter_results:
errors = [fr.errors() for fr in frs]
mean_errors.append(np.mean(errors, axis=0))
all_errors.append(mean_errors)
all_errors = np.asarray(all_errors)
x_values = xrange(0, fr.n_iters + 2)
In [7]:
n = 0
plot(x_values, all_errors[:, n].T, linewidth=1, marker='o', ms=5)
legend(legend_entries, bbox_to_anchor=(1.3, 1.025))
xlabel('Iteration')
ylabel('Mean Normalized Point-to-Point Error')
Out[7]:
In [8]:
all_costs = []
for fitter_results in results:
mean_costs = []
for frs in fitter_results:
costs = [fr.costs() for fr in frs]
mean_costs.append(np.mean(costs, axis=0))
all_costs.append(mean_costs)
all_costs = np.asarray(all_costs)
x_values = xrange(0, fr.n_iters)
In [9]:
n = 0
plot(x_values, all_costs[:, n].T, linewidth=1, marker='o', ms=5)
legend(legend_entries, bbox_to_anchor=(1.3, 1.025))
xlabel('Iteration')
ylabel('Mean Normalized Cost')
Out[9]:
In [10]:
sic = []
aic = []
for n in noise_std:
sic.append(pickle_load(path + 'PhD/Results/ijcv2015/exp2_' + aam_type + '_' + features_type + '_SIC_' + db + '_' + str(n)))
aic.append(pickle_load(path + 'PhD/Results/ijcv2015/exp2_' + aam_type + '_' + features_type + '_AIC_' + db + '_' + str(n)))
In [16]:
results = [sic,
aic,
ssc, sbc,
asc, abc,
bsc]
legend_entries = ['SIC',
'AIC',
'SSC', 'SBC',
'ASC', 'ABC',
'BSC']
In [17]:
all_errors = []
for fitter_results in results:
mean_errors = []
for frs in fitter_results:
errors = [fr.final_error() for fr in frs]
mean_error = np.mean(errors)
mean_errors.append(mean_error)
all_errors.append(mean_errors)
all_errors = np.asarray(all_errors)
x_values = noise_std
In [18]:
plot(x_values, all_errors.T, linewidth=1, marker='o', ms=5)
legend(legend_entries, bbox_to_anchor=(1.3, 1.025))
xlabel('Initialization')
ylabel('Mean Normalized Point-to-Point Error')
Out[18]:
In [19]:
all_errors = []
for fitter_results in results:
mean_errors = []
for frs in fitter_results:
errors = [fr.errors() for fr in frs]
mean_errors.append(np.mean(errors, axis=0))
all_errors.append(mean_errors)
all_errors = np.asarray(all_errors)
x_values = xrange(0, fr.n_iters + 2)
In [20]:
n = 0
plot(x_values, all_errors[:, n].T, linewidth=1, marker='o', ms=5)
legend(legend_entries, bbox_to_anchor=(1.3, 1.025))
xlabel('Iteration')
ylabel('Mean Normalized Point-to-Point Error')
Out[20]:
In [21]:
all_costs = []
for fitter_results in results:
mean_costs = []
for frs in fitter_results:
costs = [fr.costs() for fr in frs]
mean_costs.append(np.mean(costs, axis=0))
all_costs.append(mean_costs)
all_costs = np.asarray(all_costs)
x_values = xrange(0, fr.n_iters)
In [22]:
n = 0
plot(x_values, all_costs[:, n].T, linewidth=1, marker='o', ms=5)
legend(legend_entries, bbox_to_anchor=(1.3, 1.025))
xlabel('Iteration')
ylabel('Mean Normalized Cost')
Out[22]:
In [23]:
n = 0
errors = [[fr.initial_error() for fr in results[0][n]]]
for fitter_results in results:
errors.append([fr.final_error() for fr in fitter_results[n]])
In [24]:
from menpofit.visualize import plot_ced
legend_entries2 = ['Ini'] + legend_entries
plot_ced(errors, legend_entries=legend_entries2)
In [25]:
from __future__ import division
print '\t', 'Mean \t', 'STD \t', 'Median \t', 'Convergence \t'
for err, method in zip(errors, legend_entries2):
print method, '\t',
print np.round(np.mean(err), decimals=4), '\t',
print np.round(np.std(err), decimals=4), '\t',
print np.round(np.median(err), decimals=4), '\t',
c = 0
for e, ini_e in zip(err, errors[0]):
if e < ini_e:
c+=1
print np.round(c / len(err), decimals=4)