Importing


In [ ]:
%matplotlib inline
from menpo.visualize import visualize_images
from menpofit.visualize import visualize_shape_model, visualize_fitting_results
from menpo.landmark import ibug_face_49, ibug_face_51, ibug_face_68, ibug_face_66

from antonakoscvpr2015.benchmark.base import train_aps, fit_aps
from antonakoscvpr2015.utils.base import plot_deformation_model, plot_appearance_graph, plot_shape_graph

Options

General Options

In [ ]:
experiments_path = '/home/ea1812/Desktop/EXPERIMENTS/'
fast = True
group = ibug_face_66
verbose = True
Training Options

In [ ]:
training_images_options = {'path_to_images':'/home/ea1812/Desktop/data/nontas/Documents/Research/Databases/LFPWtrain/trainset/',
                           'db_name':'lfpwtrain',
                           'crop_percentage':0.5}
training_options = {'features':'no_op',                 # {'no_op', 'igo', 'double_igo', 'sift'}
                    'graph_deformation':'mst_66',       # see benchmark.base.parse_deformation_graph()
                    'graph_appearance':'chain_per_area_66',# see benchmark.base.parse_appearance_graph()
                    'graph_shape':'full_single_gaussian',             # see benchmark.base.parse_appearance_graph()
                    'patch_shape':(17, 17),             # {(13, 13), (15, 15), (17, 17), (19, 19), (21, 21)}
                    'normalization_diagonal':100,       # {100, 150}
                    'n_levels':2,                       # 2
                    'downscale':2,                      # {2, 1.5}
                    'scaled_shape_models':False,        # {False, True}
                    'use_procrustes':True,              # {True, False}
                    'n_appearance_parameters':150}      # {50, 100, 150, 200, 400}
save_model = True
Fitting Options

In [ ]:
fitting_options = {'algorithm': 'inverse', # {'forward', 'inverse'}
                   'n_shape': [3, 12],
                   'use_deformation': False,
                   'noise_std': 0.04,
                   'max_iters': 50}

#fitting_images_options = {'path_to_images':'/home/ea1812/Documents/databases/lfpw/testset/',
#                          'db_name':'lfpwtest',
#                          'crop_percentage':0.5}

fitting_images_options = {'path_to_images':'/home/ea1812/Documents/databases/afw/',
                          'db_name':'afw',
                          'crop_percentage':0.5}

Train Model


In [ ]:
aps, model_filename, training_images = train_aps(experiments_path, fast, group, training_images_options, training_options, save_model, verbose)

Fit Model


In [ ]:
fitting_results, results_filename = fit_aps(aps, model_filename, experiments_path, fast, group, fitting_images_options, fitting_options, verbose)

Visualize


In [ ]:
visualize_images(training_images)

In [ ]:
plot_deformation_model(aps, 0, 1)

In [ ]:
plot_shape_graph(aps, 0)

In [ ]:
plot_appearance_graph(aps, 0)

In [ ]:
print range(16)

In [ ]:
visualize_fitting_results(fitting_results)

In [ ]:
aps.view_widget(n_parameters=None, mode='single', parameters_bounds=(-10., 10.))

In [ ]:
print aps.appearance_models[0][0].shape

In [ ]: