Face Recognition/Raspberry Pi: your own security alarm system

栏目: IT技术 · 发布时间: 6年前

内容简介: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).

Face Recognition/Raspberry Pi: your own security alarm system

fig.1 (rights: own image)

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).

Face Recognition/Raspberry Pi: your own security alarm system

fig.2 (rights: own image)

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 .


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

金字塔原理

金字塔原理

[美] 巴巴拉·明托 / 王德忠、张珣 / 民主与建设出版社 / 2002-12 / 39.80元

《金字塔原理》是一本讲解写作逻辑与思维逻辑的读物,全书分为四个部分。 第一篇主要对金字塔原理的概念进行了解释,介绍了如何利用这一原理构建基本的金字塔结构。目的是使读者理解和运用简单文书的写作技巧。 第二篇介绍了如何深入细致地把握思维的环节,以保证使用的语句能够真实地反映希望表达的思想要点。书中列举了许多实例,突出了强迫自己进行“冷静思维”对明确表达思想的重要性。 第三篇主要针对的......一起来看看 《金字塔原理》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

URL 编码/解码
URL 编码/解码

URL 编码/解码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具