Face Similarity in React

Guido Salimbeni
2 min readJun 20, 2021

My Khe Nguyen provided to the Kaggle community a dataset that has the last words of death row inmates. The data contains information on inmates executed by the Texas Department of Criminal Justice from 1982 to November 8th, 2017. Texas adjusted its legislation and allowed for capital punishment in 1973. Texas adopted execution by lethal injection in 1977 and in 1982, the starting year of the dataset, the first offender was executed by this method.

The original data comes from the Texas Department of Criminal Justice website and includes the picture of the inmate and the last statements along with other information about the offence and personal data. By levering the face-api.js library for and the data from the dataset (faces and last words) the web application “last words” allows to compare the similarity of the user’s face to the last word in the data.

https://last-words-web-app.vercel.app/

The project has one artistic motivation of trying to grab the attention of the users to capital punishment that is one of the controversial human rights discussion in the United States. Another motivation is the understanding of how Artificial Intelligence influences the generation of artistic ideas and the process of creating an interactive installation. The source code of the project is here https://github.com/Guidosalimbeni/LastWordsWebApp and it uses the library face-api.js

The tiny face detector is used three times in the application. The first time it detects the face in the webcam live stream from the user’s computer and draws a blue box around the face along with a confidence score of having detected a face. The second time it computes the vector representation of the face (a list of 360 values). The third time it loops over the faces of the inmates (the list is in progress) and computes the vector representation of each face and calculate the distance in the euclidian space against the user’s face. The shortest distance is selected and the relative last statements are printed on the screen. The face-api.js library allows the implementation of the entire machine learning pipeline without the need to use a server-side rest API and everything is computed on the browser, which can speed the developing process. React on the other end is a convenient tool to implement responsive user interfaces. If you have time to try the application I would like to hear about your comments. www.guidosalimbeni.it

--

--