They are using openface: https://cmusatyalab.github.io/openface/#openface
The library gets the picture as input and spits out a 128-element vector. The more similar the vectors are for two pictures the more likely they are of the same person.
You don't need to train it, there is a pretrained version available.