<p>My first thought would be for you to use a library as <a href="https://cmusatyalab.github.io/openface/" rel="nofollow noreferrer">Openface</a>, which is already trained with lots of faces and has a great face representation (with the same 128 dimensions you need).</p>

<p>However, you mentioned that you want to train it yourself. I'd recommend you to start taking a look at Siamese Neural Networks. Siamese Neural Networks receive a pair of images (genuine pair - e.g. images from the same person; impostor pair - e.g. images from different persons) and try to learn a similarity/dissimilarity metric (also called Metric Learning). It is very useful for learning face embeddings since your goal seems to be related to that. They basically learn a way to map the input images to a representation that "benefits comparison". Other implementations (as OpenFace) are trained with Triplet Embeddings, where instead of a pair of images you receive a triple (two similar and one dissimilar).</p>

<p>Here are some references to start with Siamese Networks:</p>

<ul>
<li>Signature recognition (a little old but good to understand about them): <a href="https://papers.nips.cc/paper/769-signature-verification-using-a-siamese-time-delay-neural-network.pdf" rel="nofollow noreferrer">https://papers.nips.cc/paper/769-signature-verification-using-a-siamese-time-delay-neural-network.pdf</a></li>
<li>Siamese networks for face embeddings: <a href="http://yann.lecun.com/exdb/publis/pdf/chopra-05.pdf" rel="nofollow noreferrer">http://yann.lecun.com/exdb/publis/pdf/chopra-05.pdf</a></li>
<li>Triplet Embeddings paper: <a href="https://arxiv.org/pdf/1503.03832.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/1503.03832.pdf</a></li>
</ul>

<p>Just keep in mind that training these architectures is quite difficult, since selecting the best pairs is a very important and challenging part of the problem. One paper that mentions some of the challenges for creating image pairs  but is not related to faces is this <a href="https://www.cs.cornell.edu/~kb/publications/SIG15ProductNet.pdf" rel="nofollow noreferrer">one</a>.</p>

<p>Hope that helps!</p>
Extract face embedding - face recognition
<p>I want to train a neural network to extract a number of (128) face features from an image. </p>

<p>The features are numbers that measure things like the distance between middles of the eyes, or the distance between middle of the left eyes and middle point of mouth.</p>

<p>I need this to find the dissimilarity between two faces: given a database with users, by analyzing a photo I'll be able to tell if it's a photo of Jhon.</p>

<p>I began my study using <a href="https://medium.com/@ageitgey/machine-learning-is-fun-part-4-modern-face-recognition-with-deep-learning-c3cffc121d78http://" rel="nofollow noreferrer">this</a> link, which states: <em>Researchers have discovered that the most accurate approach is to let the computer figure out the measurements to collect itself.</em></p>

<p>Ok, so the output of the network is an array of 128 numbers, I'll use some formula to adjust the weights so the output numbers are as accurate as possible.</p>

<p><strong>What should I use as input?</strong> Will my input nodes be three photos, like in <a href="https://medium.com/@ageitgey/machine-learning-is-fun-part-4-modern-face-recognition-with-deep-learning-c3cffc121d78http://" rel="nofollow noreferrer">this</a> article, and I'll extract the features based on the comparisons between the photos?</p>