Skip to content
Snippets Groups Projects
Commit 57d0638e authored by Olegs NIKISINS's avatar Olegs NIKISINS
Browse files

Added a tutorial on how to train an MLP using AE embeddings

parent 2480dabe
Branches
Tags
1 merge request!14MLP class and config to train it
...@@ -10,4 +10,27 @@ Multilayer perceptron training ...@@ -10,4 +10,27 @@ Multilayer perceptron training
This section introduces a work-flow for training a Multilayer perceptron (MLP). Training details, as well as the structure of the MLP are identical to the ones introduced the following publication [NGM19]_. It is recommended to check the publication for better understanding of the below discussions. This section introduces a work-flow for training a Multilayer perceptron (MLP). Training details, as well as the structure of the MLP are identical to the ones introduced the following publication [NGM19]_. It is recommended to check the publication for better understanding of the below discussions.
In [NGM19]_, an MLP is trained on concatenation of latent embeddings of multiple autoencoders. For an explicit example on how to compute latent embeddings for MLP training, please refer to the section entitled **Multi-channel face PAD using autoencoders** in the documentation of ``bob.pad.face`` package. In general, latent embeddings of a sample is just a 1D numpy array.
As an example, to train an autoencoder on latent embeddings extracted from an entire multi-channel (BW-NIR-D) faces of WMCA database, one can use the following command:
.. code-block:: sh
./bin/train_autoencoder.py \ # script used for MLP training, can be used for other networks as-well
<FOLDER_CONTAINING_TRAINING_DATA> \ # substitute the path pointing to training data
<FOLDER_TO_SAVE_THE_RESULTS>/ \ # substitute the path to save the results to
-c mlp/batl_db_1296x10_relu_mlp.py \ # configuration file defining the database, training parameters, transformation to be applied to training data, and an MLP architecture
-cg bob.learn.pytorch.config \ # name of the group containing the configuration file
-cv \ # compute the loss on the cross-validation set as-well
-vv # set verbosity level
Please inspect the corresponding configuration file, ``batl_db_1296x10_relu_mlp.py``, for more details on how to define the database, network architecture and training parameters. Additionally, ``batl_db_1296x10_relu_mlp.py`` defines a transformation function, applying mean-std normalization to the input training samples.
After above script is completed, models are saved in ``<FOLDER_TO_SAVE_THE_RESULTS>`` directory, and one can select the "best" model having the lowest loss on the cross-validation set, by inspecting the log file located in the same directory.
.. note::
People in Idiap can benefit from GPU cluster, running training commands similar to an example from section on **Convolutional autoencoder**.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment