内容简介:For face recognition, refer to the article here where we do in-depth on the machine learning side of this article and refer toIn the previous article we use a button to organize the circuit and to send current to the transistor in order to switch the buzze
The goal of this project is to have your own security system in your desk using Face recognition and alarm that we will build from scratch!
For face recognition, refer to the article here where we do in-depth on the machine learning side of this article and refer to this one on where we handle the electrical components in more detail.
Hardware: Alarm ringing
In the previous article we use a button to organize the circuit and to send current to the transistor in order to switch the buzzer on and off, this time, we need a more programmatic way of doing this. Which can actually be done simply by connecting the two resistors like the image below (fig.1).
next thing is to modify the code of face_recognition.py to add the alarm buzzer everytime it detects an unknown face for 10 frames which can be done by the following code.
threswill be refreshed when a known face is detected.
Software: Face Recognition
For face recognition the general idea to combine HaarCascade face detection and Local Binary Pattern Histogram (LBPH) methods. As stated previously, we will not pry deeper in these topics in this article since we are explaining them here.
Since LBPH requires grayscale cropped face from HaarCascade detection, we will use this detection to take couples of pictures of the user so that we recognise the user later on. Here is the source code for this part that we will explain shortly.
We take 5 pictures that is detected by the face detection model. These pictures should be if possible as different to each other as possible.
Now onto the face recognition part here is the source code for both face_detection.py and face_recognition.py.
The face detection is standard: we output the cropped grayscale face and also the bounding box. While for the recognition there are multiple things that we can remark and that we made arbitrarily:
- We put at 65 the confidence. This scalar is actually a value that is counterintuitive since it expresses the difference between pictures, (explained in LBPH article) and therefore the higher it is the less confident we are.
- We also decide to consider anyone that does not have less than 65 in terms of similarity (to anyone in the database), to be unknown.
- After 10 consecutive unknown detection we will consider the person detected to be someone that is not in the database and therefore an outsider, so we ring the alarm.
Results: the combination of the two parts
As mentioned, what you will have to do is to run get_faces.py. You should be prompted to a window similar to this one (fig.2).
After running get_faces.py, you should be ready to get your face recognised. If you want to add more people to the database simply redo get_faces.py step again.
Now by running the main.py script, the full project should be deployed. Now you will know when a thief comes by your computer or your room! Here is our own result (vid.1) for you to take into consideration.
https://aitechfordummies.com/wp-content/uploads/2020/03/video.mp4
The full source code and instructions can be found on this repository .
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
The Ruby Programming Language
David Flanagan、Yukihiro Matsumoto / O'Reilly Media, Inc. / 2008 / USD 39.99
Ruby has gained some attention through the popular Ruby on Rails web development framework, but the language alone is worthy of more consideration -- a lot more. This book offers a definition explanat......一起来看看 《The Ruby Programming Language》 这本书的介绍吧!