:mag: Face recognition with Go
go-face implements face recognition for Go using dlib, a popular machine learning toolkit. Read Face recognition with Go article for some background details if you're new to FaceNet concept.
To compile go-face you need to have dlib (>= 19.10) and libjpeg development packages installed.
Latest versions of Ubuntu and Debian provide suitable dlib package so just run:
# Ubuntu
sudo apt-get install libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg-turbo8-dev
# Debian
sudo apt-get install libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg62-turbo-devMake sure you have Homebrew installed.
brew install dlibMake sure you have MSYS2 installed.
MSYS2 MSYS shell from Start menupacman -Syu and if it asks you to close the shell do thatpacman -Syu againpacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-dlibset MSYS2_PATH_TYPE=inherit line in msys2_shell.cmd located in MSYS2
installation folderpacman -S mingw-w64-x86_64-go gitMSYS2 MinGW 64-bit shell from Start menu to compile and use go-faceTry to install dlib/libjpeg with package manager of your distribution or compile from sources. Note that go-face won't work with old packages of dlib such as libdlib18. Alternatively create issue with the name of your system and someone might help you with the installation process.
Currently shape_predictor_5_face_landmarks.dat, mmod_human_face_detector.dat and
dlib_face_recognition_resnet_model_v1.dat are required. You may download them
from go-face-testdata repo:
wget https://github.com/Kagami/go-face-testdata/raw/master/models/shape_predictor_5_face_landmarks.dat
wget https://github.com/Kagami/go-face-testdata/raw/master/models/dlib_face_recognition_resnet_model_v1.dat
wget https://github.com/Kagami/go-face-testdata/raw/master/models/mmod_human_face_detector.datTo use go-face in your Go code:
import "github.com/Kagami/go-face"To install go-face in your $GOPATH:
go get github.com/Kagami/go-faceFor further details see GoDoc documentation.
…Run with:
mkdir -p ~/go && cd ~/go # Or cd to your $GOPATH
mkdir -p src/go-face-example && cd src/go-face-example
git clone https://github.com/Kagami/go-face-testdata testdata
edit main.go # Paste example code
go get && go run main.goTo fetch test data and run tests:
make testThere are few suggestions:
ClassifyThresholdNewRecognizerWithConfigSetSamples if possibledlib_face_recognition_resnet_model_v1.dat) on your own test datago-face is licensed under CC0.
No open issues yet, or sync has not completed.