# Machine learning approach to facial recognition

First of all I'm very new to the field. Maybe my question is a bit too naive or even trivial...

I'm currently trying to understand how can I go about recognizing different faces.

Here is what I tried so far and the main issues with each approach:

1) Haar Cascade -> HOG -> SVM: The main issue is that the algorithm becomes very indecisive when more than four people are trained... The same occurs when we change Haar Cascade for a pre-trained CNN to detect faces...

2) dlib facial landmarks -> distance between points -> SVM or Simple Neural Network Classification: This is the current approach and it behaves very well when when four people are trained... When more people are trained it becomes very messy, jumping from decision to decision and never resolves to a choice.

I've read online that Triplet loss is the way to go... But I very confused as to how I'd go about implementing it... Can I use the current distance vectors found using Dlib or should I scrap everything and train my own CNN?

If I can use the distance vectors, how would I pass the data to the algorithm? Is Triplet loss a trivial neural network only with its loss function altered?

I've took the liberty to show exactly how the distance vectors are being calculated:

The green lines represent the distances being calculated. A 33 float list is returned which is then fed to the classifier.

Here is the relevant code for the classifier (Keras):

def fit_classifier(self):
x_train, y_train = self._get_data(self.train_data_path)
x_test, y_test = self._get_data(self.test_data_path)
encoding_train_y = np_utils.to_categorical(y_train)
encoding_test_y = np_utils.to_categorical(y_test)
model = Sequential()