当前位置:网站首页>Face recognition software based on deepface model
Face recognition software based on deepface model
2022-06-10 22:50:00 【biyezuopinvip】
Resource download address :https://download.csdn.net/download/sheziqiong/85601096
Face recognition software ( No external API)
V2.0 be based on DeepFace Model design of face recognition software
V1.0 be based on PCA Model design of face recognition software
V2.0
- After watching teacher wuenda's “ Deep learning course ”, Understand the application of deep convolution neural network in face recognition . It says DeepFace The model has an implementation process in the job , So take this opportunity , The model is applied to our own face recognition software .
- introduce DeepFaceNet Model , The recognition accuracy is improved . At the same time One-Shot problem .
The new file
- dir ‘deepface’: Contains model files 、 Identification function 、 Coding function, etc
- ‘deepface.h5’ :DeepFace Model file , use Keras(Tensorflow backend) Load model .
- ‘fr_utils.py’ : Deep face recognition interface , contain : Model coding face function 、 Face recognition function .
- ‘inception_blocks.py’:DeepFace Model interface file , contain : Load model functions 、 Model loss function .
Update the details
- 'face_recognition.py’ New in ’DeepFaceRecognition’ class , For face recognition .
- Add processing of identification details , Unregistered users will display “Unknown”.
- Histogram equalization is added to image preprocessing , Increased recognition accuracy in darker places .
V1.0
- At first , In the database course design part , I use C# A sign in recording system based on face recognition is designed . The face recognition part of this system uses Shangtang technology Face++ API. Because the recognition speed is relatively slow , You also need to be connected to the Internet , I always want to change it to offline recognition . therefore , There is this blog .
- Based on a blog I wrote before 《 Face recognition in image processing 》 Based on PCA The face model is obtained by the training model method .
- Based on face model 、Python Designed this small software . This frees you from using third parties API The shortcomings of , Faster recognition . however , After testing , This method is greatly affected by light .
development tool
Environmental Science
- windows 10
- Anaconda(Spyder)
Language
- software design :Python
- Model training uses :Matlab
frame
- python-opencv
- Realize the function of face detection , Get the face area
- numpy
- Matrix operations
- scipy
- Scientific Computing , Load model file
- tkinter
- GUI Development
Function introduction
Face recognition
In this software design , The model file we use is Matlab Derived .mat file . Two matrices are saved in the file mean_face And V, The former is Average face vector , The latter is the face space matrix .
The size of the user's face image saved by the software is 112 x 92. Every time you start the software , Load all user images into memory , And stretch the two-dimensional image into one-dimensional vector .
v u s e r ( i ) v_{user}^{(i)} vuser(i) On behalf of the user i i i Face image vectorthen , We combine all user image vectors into a user image matrix , Each column of the matrix is the user image vector :
U = [ ( v u s e r ( 0 ) ) T ( v u s e r ( 1 ) ) T ⋯ ( v u s e r ( n ) ) T ] U = \begin{bmatrix} (v_{user}^{(0)})^T \ (v_{user}^{(1)})^T \ \cdots \ (v_{user}^{(n)})^T \end{bmatrix} U=[(vuser(0))T (vuser(1))T ⋯ (vuser(n))T]
- The user image matrix U U U Subtract the average face vector from each column in v m e a n _ f a c e v_{mean \_ face} vmean_face, Then the matrix after the operation is projected to the model space update matrix U U U:
U = V T ⋅ ( U . − v m e a n _ f a c e ) U = V^T \cdot (U .- \ v_{mean \_ face}) U=VT⋅(U.− vmean_face)
- In this way , We get the user face matrix after dimensionality reduction .
Identification process
Collect face images , Extract the face part , And convert the image into vector form : v i n p u t v_{input} vinput
The face vector obtained in the previous step is projected into the model space according to the following formula :
v p c a = V T ⋅ ( v i n p u t − v m e a n _ f a c e ) v_{pca}=V^T \cdot (v_{input} - v_{mean \_ face}) vpca=VT⋅(vinput−vmean_face)Take what you got in the last step v p c a v_{pca} vpca Vector and U U U Each column in the matrix is calculated Euclidean distance , Find the nearest column to identify the target .
Identify function code
def __recognize(self, image, face):
""" the system approves the user's identity according to his face """
name = ''
try:
(x, y, w, h) = face
image = Image.fromarray(image).crop((x, y, x+w, y+h)).resize(self.img_size)
img_vec = self.V.T.dot(np.array(image).reshape([-1, 1]) - self.mean_face)
distances = [la.norm(img_vec - self.user_matrix[:, j].reshape([-1, 1])) \
for j in range(self.user_matrix.shape[1])]
min_dis = np.min(distances)
index = np.where(distances == min_dis)[0][0]
# print(min_dis, index)
name = self.user_names[index]
except:
pass
return name
Portrait import
It is mainly for the convenience of importing user portraits , Therefore, this function is added .
Select the import folder path in the interface , Cycle through all images in the folder . Extract the portrait part and convert it into gray image , Save to the relative path where the software stores the portrait .
Photo entry
- In order to input user portrait information , The user can turn on the camera 、 After entering the name , Click the Photo button on the interface , You can save the portrait information to the software folder .
Software defect
- Light problems
- such as : After entering the portrait in the place with bright light , Users can easily be mistaken in dark places .
- The way to try to solve the problem is : Histogram equalization is used in image preprocessing , But it only played a part .
- So when used , The input environment should be consistent with the detection environment as far as possible .
Resource download address :https://download.csdn.net/download/sheziqiong/85601096
边栏推荐
猜你喜欢
![[tcapulusdb knowledge base] tcapulusdb shard relocation introduction](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
[tcapulusdb knowledge base] tcapulusdb shard relocation introduction

重排 (reflow) 与重绘 (repaint)

Tcapulusdb Jun · industry news collection (VI)

罗永浩:我要是负责人 能让苹果产品上去三个台阶不止

【TcaplusDB知识库】TcaplusDB查看进程状态介绍
![[tcapulusdb knowledge base] Introduction to tcapulusdb push configuration](/img/98/0819d5c30a3f214d97b43f2a949fa2.png)
[tcapulusdb knowledge base] Introduction to tcapulusdb push configuration
![[MySQL] Table constraints](/img/13/b97679cd4ca36d4b8e19acf23df404.png)
[MySQL] Table constraints
![[tcapulusdb knowledge base] tcapulusdb transaction management introduction](/img/cd/dc23cb8bddcbf04efeaf60dfadaec9.png)
[tcapulusdb knowledge base] tcapulusdb transaction management introduction

鲸会务智慧景区管理解决方案

TcaplusDB君 · 行业新闻汇编(六)
随机推荐
leetcode:333. Maximum BST subtree
Web3 ecological decentralized financial platform sealem Finance
C语言内功修炼【整型在内存中的存储】
很流行的状态管理库 MobX 是怎么回事?
[tcapulusdb knowledge base] tcapulusdb shard relocation introduction
1. Introduction to tornado & introduction to tornado project in this column
罗永浩:我要是负责人 能让苹果产品上去三个台阶不止
How to run Plink software -- three methods
[tcapulusdb knowledge base] tcapulusdb machine initialization and launch introduction
[tcapulusdb knowledge base] Introduction to the machine where the tcapulusdb viewing process is located
《暗黑破坏神不朽》数据库资料站地址 暗黑不朽资料库网址
CCF CSP 202109-1数组推导
What should I do if the mobile phone number cannot be updated
鲸会务会议分享:大会难办怎么办?
【TcaplusDB知识库】TcaplusDB事务管理介绍
【TcaplusDB知识库】TcaplusDB TcapProxy扩缩容介绍
【TcaplusDB知识库】TcaplusDB巡检统计介绍
Opencv_100问_第三章 (11-15)
Shell基础概念
Openjudge noi 1.13 15: finding modes in sequences