Exemple #1
0
# Specification of model type and training parameters
model_type = 'mrd'
model_num_inducing = 40
model_num_iterations = 200
model_init_iterations = 1100
#fname = 'm_' + model_type + '_exp' + str(experiment_number) #+ '.pickle'
fname = modelPath + '/models/' + 'm_' + model_type + '_exp' + str(experiment_number) #+ '.pickle'


# Enable to save the model and visualise GP nearest neighbour matching
save_model=True
visualise_output=True

# Reading face data, preparation of data and training of the model
mySAMpy.readData(root_data_dir, participant_index, pose_index)
mySAMpy.prepareFaceData(model_type, Ntr, pose_selection)
mySAMpy.training(model_num_inducing, model_num_iterations, model_init_iterations, fname, save_model)


# This is for visualising the mapping of the test face back to the internal memory
if visualise_output: 
    ax = mySAMpy.SAMObject.visualise()
    visualiseInfo=dict()
    visualiseInfo['ax']=ax
    ytmp = mySAMpy.SAMObject.recall(0)
    ytmp = numpy.reshape(ytmp,(mySAMpy.imgHeightNew,mySAMpy.imgWidthNew))
    fig_nn = pb.figure()
    pb.title('Training NN')
    pl_nn = fig_nn.add_subplot(111)
    ax_nn = pl_nn.imshow(ytmp, cmap=plt.cm.Greys_r)
Exemple #2
0
model_num_iterations = 200
model_init_iterations = 1200
#fname = 'm_' + model_type + '_exp' + str(experiment_number) #+ '.pickle'
fname = modelPath + '/models/mFaces_' + model_type + '_exp' + str(
    experiment_number)  #+ '.pickle'

# Enable to save the model and visualise GP nearest neighbour matching
save_model = True
economy_save = True  # ATTENTION!! This is still BETA!!
visualise_output = True

#####################################  SET-UP and TRAIN #############################################
#####################################################################################################

# Reading face data, preparation of data and training of the model
mySAMpy.readData(root_data_dir, participant_index, pose_index)
mySAMpy.prepareFaceData(model_type,
                        Ntr,
                        pose_selection,
                        randSeed=experiment_number)
mySAMpy.training(model_num_inducing, model_num_iterations,
                 model_init_iterations, fname, save_model, economy_save)

#####################################  VISUALISATION    #############################################
#####################################################################################################

# This is for visualising the mapping of the test face back to the internal memory
if visualise_output:
    ax = mySAMpy.SAMObject.visualise()
    visualiseInfo = dict()
    visualiseInfo['ax'] = ax