#NEWLINE# def run_build_model( ) : #NEWLINE# #INDENT# import glob #NEWLINE# from scipy import io , misc #NEWLINE# DATA_DIR = '../others/icaam/examples/cootes' #NEWLINE# training_files = sorted ( glob . glob ( ( DATA_DIR + '/*.bmp.mat' ) ) ) #NEWLINE# fst_im = misc . imread ( training_files [ 0 ] [ : ( - 4 ) ] ) #NEWLINE# ( ni , nj , nc ) = fst_im . shape #NEWLINE# ns = len ( training_files ) #NEWLINE# ( np , nd ) = io . loadmat ( training_files [ 0 ] ) [ 'annotations' ] . shape #NEWLINE# appearances = zeros ( ( ns , ni , nj , nc ) ) #NEWLINE# shapes = zeros ( ( ns , np , nd ) ) #NEWLINE# for i in range ( ns ) : #NEWLINE# #INDENT# name = training_files [ i ] #NEWLINE# app = misc . imread ( name [ : ( - 4 ) ] ) #NEWLINE# appearances [ i , : , : , : ] = app #NEWLINE# d = io . loadmat ( name ) #NEWLINE# annotations = d [ 'annotations' ] #NEWLINE# shapes [ i , : , : ] = xy2ij ( annotations , nc ) #NEWLINE# #UNINDENT# AAM = build_model ( shapes , appearances )