/Facial-Recognition

An implementation of Siamese Neural Networks for facial recognition

Primary LanguagePythonMIT LicenseMIT

Facial-Recognition

Approach

An implementation of Siamese Neural Networks for facial recognition

Data

Using yale face dataset Collection of greyscale faces of differing light and facial expressions

example:

Siamese Network

Contrastive loss implementation

d=||f(x_1) - f(x_2)||_2

L = yd^2 + (1 - y)[max(m - d,0)]^2

def contrastive_loss(y, t):
    nonmatch = F.relu(1 - y) # max(margin - y, 0)
    return torch.mean(t * y**2 + (1 - t) * nonmatch**2)

Findings

Training losses (not very representative due to imbalanced classes)

Evaluating the results

With an ad hoc threshold of 0.7.

Sensitivity (true positive rate): 0.91

Specificity (true negative rate): 0.96