GithubHelp home page GithubHelp logo

lincolnhard / facenet-darknet-inference Goto Github PK

View Code? Open in Web Editor NEW
29.0 8.0 10.0 79 KB

Face recognition using facenet

C 63.86% C++ 35.16% Makefile 0.98%
darknet facenet face-recognition face-detection dlib knn cnn

facenet-darknet-inference's Introduction

facenet-darknet-inference

Face recognition using facenet

1. Intro

Facenet is developed by Google in 2015, the result of the net is the Euclidean embedding of human face.

By careful defined triplet loss function, facenet achieves high accuracy on LFW(0.9963) and FacesDB(0.9512).

Darknet is a fast, easy to read DL framework. Yolo is running based on it.

2. Dependencies

OpenCV for video i/o, face detection, image resizing, warping, and 3D pose estimation.

Dlib for facial landmark detection.

NNPACK for faster neural network computations.

Zenity for text input.

3. Installation and run

sudo apt-get install zenity
cd facenet-darknet-inference
#edit makefile
#specify your OPENCV_HEADER_DIR, OPENCV_LIBRARY_DIR, DLIB_HEADER_DIR, DLIB_LIBRARY_DIR, NNPACK_HEADER_DIR, NNPACK_LIBRARY_DIR
make
mkdir data
cd data
touch name
cd ..
mkdir model

download weights and extract in facenet-darknet-inference folder

cd facenet-darknet-inference
./facenet-darknet-inference

4. Note

OpenCV VJ face + Dlib landmark detection is used rather than MTCNN. VJ method is faster, but the unstable cropping may slightly influence recognition accuracy.

KNN is the final classification method, but it is suffered for openset problem. The 1792-d feature before bottleneck layer with normalization is used for KNN, because it has better result in openset than original facenet model, but you can still try the original network configure yourself just replacing facenet.cfg to facenet_full.cfg

The facenet.weight is converted from facenet inception-resnet v1 20180402-114759 model

5. Result

peek 2018-04-19 14-11

facenet-darknet-inference's People

Contributors

lincolnhard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facenet-darknet-inference's Issues

make error ??

root@ubuntu16:/home/eud/Downloads/facenet-darknet-inference-master# make
g++ -c -pipe -std=c++11 -O2 -D OPENCV -D NNPACK -I /usr/local/include/opencv2 -I /usr/local/include/dlib -I /home/eud/Downloads/NNPACK/include test.cpp
In file included from /usr/include/c++/5/iostream:38:0,
from test.cpp:1:
/usr/local/include/dlib/bits/c++config.h:1:45: fatal error: ../dlib_include_path_tutorial.txt: No such file or directory
compilation terminated.
makefile:27: recipe for target 'test.o' failed
make: *** [test.o] Error 1

make not running ... how to edit make?

g++ -c -pipe -std=c++11 -O2 -D OPENCV -D NNPACK -I /usr/local/include -I /home/lincolnhard/Documents/dlib -I /home/lincolnhard/Documents/NNPACK-darknet/include test.cpp
test.cpp:6:25: fatal error: dlib/opencv.h: No such file or directory
compilation terminated.
makefile:27: recipe for target 'test.o' failed
make: *** [test.o] Error 1
this the error i get.

Segmentation fault (core dumped)

I am getting segmenation fault after running project in the terminal
here is the output
san@san-aa:~/Desktop/facenet-darknet-inference$ ./facenet-darknet-inference
learning_rate: Using default '0.001000'
momentum: Using default '0.900000'
decay: Using default '0.000100'
subdivisions: Using default '1'
policy: Using default 'constant'
max_batches: Using default '0'
layer filters size input output
0 conv 32 3 x 3 / 2 160 x 160 x 3 -> 79 x 79 x 32
1 conv 32 3 x 3 / 1 79 x 79 x 32 -> 77 x 77 x 32
2 conv 64 3 x 3 / 1 77 x 77 x 32 -> 77 x 77 x 64
3 max 3 x 3 / 2 77 x 77 x 64 -> 38 x 38 x 64
4 conv 80 1 x 1 / 1 38 x 38 x 64 -> 38 x 38 x 80
5 conv 192 3 x 3 / 1 38 x 38 x 80 -> 36 x 36 x 192
6 conv 256 3 x 3 / 2 36 x 36 x 192 -> 17 x 17 x 256
7 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
8 route 6
9 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
10 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
11 route 6
12 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
13 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
14 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
15 route 7 10 14
16 conv 256 1 x 1 / 1 17 x 17 x 96 -> 17 x 17 x 256
17 Shortcut Layer: 6
18 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
19 route 17
20 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
21 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
22 route 17
23 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
24 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
25 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
26 route 18 21 25
27 conv 256 1 x 1 / 1 17 x 17 x 96 -> 17 x 17 x 256
28 Shortcut Layer: 17
29 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
30 route 28
31 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
32 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
33 route 28
34 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
35 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
36 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
37 route 29 32 36
38 conv 256 1 x 1 / 1 17 x 17 x 96 -> 17 x 17 x 256
39 Shortcut Layer: 28
40 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
41 route 39
42 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
43 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
44 route 39
45 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
46 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
47 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
48 route 40 43 47
49 conv 256 1 x 1 / 1 17 x 17 x 96 -> 17 x 17 x 256
50 Shortcut Layer: 39
51 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
52 route 50
53 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
54 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
55 route 50
56 conv 32 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 32
57 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
58 conv 32 3 x 3 / 1 17 x 17 x 32 -> 17 x 17 x 32
59 route 51 54 58
60 conv 256 1 x 1 / 1 17 x 17 x 96 -> 17 x 17 x 256
61 Shortcut Layer: 50
62 conv 384 3 x 3 / 2 17 x 17 x 256 -> 8 x 8 x 384
63 route 61
64 conv 192 1 x 1 / 1 17 x 17 x 256 -> 17 x 17 x 192
65 conv 192 3 x 3 / 1 17 x 17 x 192 -> 17 x 17 x 192
66 conv 256 3 x 3 / 2 17 x 17 x 192 -> 8 x 8 x 256
67 route 61
68 max 3 x 3 / 2 17 x 17 x 256 -> 8 x 8 x 256
69 route 62 66 68
70 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
71 route 69
72 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
73 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
74 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
75 route 70 74
76 conv 896 1 x 1 / 1 8 x 8 x 256 -> 8 x 8 x 896
77 Shortcut Layer: 69
78 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
79 route 77
80 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
81 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
82 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
83 route 78 82
84 conv 896 1 x 1 / 1 8 x 8 x 256 -> 8 x 8 x 896
85 Shortcut Layer: 77
86 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
87 route 85
88 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
89 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
90 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
91 route 86 90
92 conv 896 1 x 1 / 1 8 x 8 x 256 -> 8 x 8 x 896
93 Shortcut Layer: 85
94 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
95 route 93
96 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
97 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
98 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
99 route 94 98
100 conv 896 1 x 1 / 1 8 x 8 x 256 -> 8 x 8 x 896
101 Shortcut Layer: 93
102 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
103 route 101
104 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
105 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
106 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
107 route 102 106
108 conv 896 1 x 1 / 1 8 x 8 x 256 -> 8 x 8 x 896
109 Shortcut Layer: 101
110 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
111 route 109
112 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
113 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
114 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
115 route 110 114
116 conv 896 1 x 1 / 1 8 x 8 x 256 -> 8 x 8 x 896
117 Shortcut Layer: 109
118 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
119 route 117
120 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
121 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
122 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
123 route 118 122
124 conv 896 1 x 1 / 1 8 x 8 x 256 -> 8 x 8 x 896
125 Shortcut Layer: 117
126 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
127 route 125
128 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
129 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
130 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
131 route 126 130
132 conv 896 1 x 1 / 1 8 x 8 x 256 -> 8 x 8 x 896
133 Shortcut Layer: 125
134 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
135 route 133
136 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
137 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
138 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
139 route 134 138
140 conv 896 1 x 1 / 1 8 x 8 x 256 -> 8 x 8 x 896
141 Shortcut Layer: 133
142 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
143 route 141
144 conv 128 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 128
145 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
146 conv 128 7 x 7 / 1 8 x 8 x 128 -> 8 x 8 x 128
147 route 142 146
148 conv 896 1 x 1 / 1 8 x 8 x 256 -> 8 x 8 x 896
149 Shortcut Layer: 141
150 conv 256 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 256
151 conv 384 3 x 3 / 2 8 x 8 x 256 -> 3 x 3 x 384
152 route 149
153 conv 256 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 256
154 conv 256 3 x 3 / 2 8 x 8 x 256 -> 3 x 3 x 256
155 route 149
156 conv 256 1 x 1 / 1 8 x 8 x 896 -> 8 x 8 x 256
157 conv 256 3 x 3 / 1 8 x 8 x 256 -> 8 x 8 x 256
158 conv 256 3 x 3 / 2 8 x 8 x 256 -> 3 x 3 x 256
159 route 149
160 max 3 x 3 / 2 8 x 8 x 896 -> 3 x 3 x 896
161 route 151 154 158 160
162 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
163 route 161
164 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
165 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
166 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
167 route 162 166
168 conv 1792 1 x 1 / 1 3 x 3 x 384 -> 3 x 3 x1792
169 Shortcut Layer: 161
170 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
171 route 169
172 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
173 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
174 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
175 route 170 174
176 conv 1792 1 x 1 / 1 3 x 3 x 384 -> 3 x 3 x1792
177 Shortcut Layer: 169
178 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
179 route 177
180 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
181 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
182 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
183 route 178 182
184 conv 1792 1 x 1 / 1 3 x 3 x 384 -> 3 x 3 x1792
185 Shortcut Layer: 177
186 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
187 route 185
188 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
189 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
190 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
191 route 186 190
192 conv 1792 1 x 1 / 1 3 x 3 x 384 -> 3 x 3 x1792
193 Shortcut Layer: 185
194 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
195 route 193
196 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
197 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
198 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
199 route 194 198
200 conv 1792 1 x 1 / 1 3 x 3 x 384 -> 3 x 3 x1792
201 Shortcut Layer: 193
202 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
203 route 201
204 conv 192 1 x 1 / 1 3 x 3 x1792 -> 3 x 3 x 192
205 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
206 conv 192 3 x 3 / 1 3 x 3 x 192 -> 3 x 3 x 192
207 route 202 206
208 conv 1792 1 x 1 / 1 3 x 3 x 384 -> 3 x 3 x1792
209 Shortcut Layer: 201
210 avg 3 x 3 x1792 -> 1792
Loading weights from weights/facenet.weights...Done!
Segmentation fault (core dumped)
I am very new to the peogramming i dont know how to solve this issuse
PC specification
intell I3 7th gen 2.7 GHz dual core
nvidia geforce 940mx 2gb Dedicated VRAM
4gb DDR4 RAM
ubuntu 18.04 os

@lincolnhard can you help please !

how to convert tf model to darknet model

Thanks for your work. I need to use self-trained tensorflow squeezenet model in darknet, but do not know how to convert it to darknet format. I searched the darkflow and MMdnn tool, but cannot find one that helps. How do you convert the tf facenet model to darknet's format? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.