openface
OpenFace
Openface ?. pretrain TorchNuralNet
Appendixes./demo/classifier.py./training/main.luaAPI Reference
Openface Library
papers
Training
Cnn Classification examplehttps://www.youtube.com/watch?v=gEfKfF9Ef3U
Bench Mark
Accuracies
LFWLabeled Faces in the Wildhttp://vis-www.cs.umass.edu/lfw/index.html . , , , , . , , . LFW(Labelled Faces in the Wild) . 6000 13 .http://www.hani.co.kr/arti/economy/it/636535.html
Openface LibraryFree and Open source Face recognition with deep learning networkVersion 0.2.0Accuracy (0.1.0)76.1 -> (0.2.0)92.9%Base on LFW Data setBloghttps://cmusatyalab.github.io/openface/Api http://openface-api.readthedocs.io/en/latest/Github https://github.com/cmusatyalab/openface
Git clone https://github.com/cmusatyalab/openface; python setup.pyAnd torch, cutorch etc.....
Docker 1
Nvidia-Docker 1Docker for cudaNvidia-Docker + openfacehttps://github.com/jaeho-kang/deep-learning/blob/master/openface/DockerfileCuda 7.5, cudnn5
nvidia-docker run -p 9000:9000 p 8000:8000 t I image /bin/bashnvidia cuda docker
Nvidia-Docker 2
./demos/compare.py ./images/examples/{lennon*,clapton*}
lennon \ claptonlennon-1lennon-2clapton-1clapton-2lennon-1-0.7631.1321.145lennon-20.763-1.4471.521clapton-11.1321.447-0.318clapton-21.1451.5210.318-
./demos/classifier.py infer models/openface/celeb-classifier.nn4.small2.v1.pkl ./images/examples/carell.jpg
class, confidence .
pretrain Representations
jpg,png
.
. ./util/prune-dataset.py
Representation representation labels.csv, reps.csv
pretrain --preprocessfor N in {1..8}; do ./util/align-dlib.py align outerEyesAndNose --size 96 & done.
--representation generate./batch-represent/main.lua -outDir -data -- classification training./demos/classifier.py train -- classification test./demos/classifier.py infer ./models/openface/celeb-classifier.nn4.small2.v1.pkl images/examples/{carell,adams,lennon}*n
TorchNuralNet Model Model Model
jpg,png
.
. ./util/prune-dataset.py
Model ./training/main.lua data -lfwDir -peoplePerBatch 15 imagesPerPerson 20
Model ./training/plot-loss.py wordDirs [WordDir]
Model
./demos/classifier.py networkModel [TrainModel] train [Feature Path]networkModel : ./training/work/dir/model_n.t7 DNN Weight
./demos/classifier.py networkModel [TrainModel] infer [TrainedModel] DataSourcenetworkModel : ./training/work/dir/model_n.t7 DNN Weight TrainModel : classifier.py
preTrain VS DNN
DNNpreTrain
Dnn --preprocessfor N in {1..8}; do ./util/align-dlib.py align outerEyesAndNose --size 96 & done.
--representation generate ./batch-represent/main.lua -outDir -data
--training dnn neural network./training/main.lua data -lfwDir -peoplePerBatch 15 imagesPerPerson 20
-- classification training ./demos/classifier.py train --networkModel
-- predict classification./demos/classifier.py infer --networkModel images/examples/{carell,adams,lennon}*n
GPU 1102 DNN
.
< 1000 : preTrain. >= 1000 : DNN
Linux .
CPUGPU32015
DNN . .
SPARK .SPARK + KERAS + ELEPHASNvidia-dockerNvidia-dockerNvidia-dockerCudaCudaCudaOpenfaceTorch/PythonOpenfaceTorch/PythonOpenfaceTorch/PythonSPARKPySparkKERAS/ELEPHAS
Q&A
Appendix Library Reference
./demos/classifier.py --dlibFacePredictor . . : Shape_predictor_68_face_landmarks.dat--networkModelTorch network Model DNN Network Model .DNN network : nn4.small2.v1.t7--imgDim : 96--cudaCuda : store_true* cuda .--verbose . : store_true
Classifier.py [infer|train] , .
./demos/classifier.pytrain--ldaDim . : -1--classifierL2 .LinearSvm, GMM . : LinearSvmworkDirRepresentation inferclassifierModeltrain pkl .imgs
./demos/classifier.py train --networkModel ./demos/classifier.py infer --networkModel images/examples/{carell,adams,lennon}*n
./training/main.luaTorch DNN general-cache WorkData-nDonkeys 2-save -Training-nEpochs Epoch 1000-data -epochSize epoch batch size250-manualSeed -epochNumberEpoch Number 1-cudaCuda 2-peoplePerBatch 15-device cuda device .True-peoplePerPerson 20-nGPU n GPU 1-testing true LFW True-cudnnCudnn True-testBatchSizeTest 800-cudnn_benchCudnn fast option .false-lfwDirTest lfw ../data/lfw/aligned
./training/main.luaTorch DNN model-retrain -modelDefTorch DNN ../models/openface/nn.def.lua-imgDimTorch DNN 94-embSizeTorch DNN embedding128-alphaTripletLoss 2
Appendix LFW Pairs.txtLFW http://vis-www.cs.umass.edu/lfw/README.txt3.c pairs.txt format . /root/openface/data/imgs/test1/aligned/pair_gen.py
Count of iteration : 10 Size of testset : 300 Total line : 1(head) + 10(size of iteration) * 300(match element) + 10(size of iteration) * 300(mismatch element)
[count of iteration] [size of testset]
name n1 n2name n1 n2name n1 n2
name1 n1 name2 n2name1 n1 name2 n2 name1 n1 name2 n2 name n1 n2name n1 n2name n1 n2------------------name1 n1 name2 n2name1 n1 name2 n2 name1 n1 name2 n2----------------------- name n1 n2name n1 n2name n1 n2
name1 n1 name2 n2name1 n1 name2 n2 name1 n1 name2 n2
Match elementSize of testset
misMatch elementSize of testset
Count of iteration
Openface API ReferencepackageclassMethodparameterParameter descriptionReturnOpenfaceAlignDLibcontructorfacePredictorDlib alignimgDimrgbImgBblandmarkIndicesskipMulti , int, numpy,ndarray ,dlib.rectangle , list of ints , boolRgb imageShape(imgDim,imgDim,3)
landmarkIndices INNER_EYES_AND_BOTOOM_LIP = [39.42.57] OUTER_EYES_AND_NOSE = [36,45,33]
Openface API ReferencepackageclassMethodparameterParameter descriptionReturnOpenfaceAlignDLibfindLandmarksrgbImgbb, numpy.ndarray, dlib.rectangleList of (x,y) tuple , getAllFaceboundingBoxedrgbImg, numpy.ndarrayDlib.rectangles getLargestFaceBoundingBoxrgbImgskipMulti, numpy.ndarray, falseDlib.rectangles ,
Openface API ReferencepackageclassMethodparameterParameter descriptionReturnOpenfaceTorchNueralNetconstructormodelimgDimCudaTorch , string , intCuda , boolTorch DNN forwardrgbImg, numpy.ndarrayNumpy.ndarray DNN forwardPathimgPath , stringNumpy.ndarray DNN
Openface API ReferencepackageclassMethodparameterParameter descriptionReturnOpenfacedataImageClassNamePath ,string , string , stringImage , , getBGR()numpy.ndarray BGR getRGB()numpy.ndarray RGB iterImgsdirectory ,stringIterator of images , helpermkdirPpath ,string ,
Predict processAlignDlib()TorchNeuralNet()#Classifier Model Load Cv2.imread()AlignDLib.getLargestBoundingbox()TorchNeuralNet.forward()Classifier.predict_proba().ravel()
Top Related