Thursday, April 19, 2018

playing with facial recognition library

Deep learning and facial recognition is getting easier to implement these days. Tried to recognize japanese actresses with a face recognition library.

Instructions to build and run it in docker
1. Clone it from github
git clone https://......

2. docker build .

3. Create a directory that shared with the docker container.
mkdir face_recognition_docker

4. Run the docker image and link the new directory to the container
docker run -i -t -v ~/face_recognition_docker:/home /bin/bash

5. put images in face_recognition_docker directory. 
training data in face_recognition_docker/known_people. 
unknown image in face_recognition_docker/unknown.



6. run the command in the docker container. To know more about the parameters check the github page.
For example,
root@123456:/home# face_recognition --cpus -1 --tolerance 0.45 known_people/ unknown/
unknown/shiseido.jpg,yui
unknown/temple.jpg,yui
unknown/komatsu_u.jpg,komatsu
unknown/obama_unknown.jpg,unknown_person
unknown/obama_unknown.jpg,President_Barack_Obama

I needed to adjust the tolerance value as the pre-trained face model does not work very well on asians. You can see that face is recognized even if it is from difference angle for komatsu_u.jpg. Also unknown face is identified on the obama_unknown.jpg. Interesting result.

link
medium article
github code
docker image (didn't try)