Deep Learning Enables You to Hide Screen when Your Boss is Approaching
Introduction
When you are working, you have browsed information that is not relevant to your work, haven’t you?
I feel awkward when my boss is creeping behind. Of course, I can switch the screen in a hurry, but such behavior is suspicious, and sometimes I don’t notice him. So, in order to switch the screen without being suspected, I create a system that automatically recognizes that he is approaching to me and hides the screen.
Specifically, Keras is used to implement neural network for learning his face, a web camera is used to recognize that he is approaching, and switching the screen.
Mission
The mission is to switch the screen automatically when my boss is approaching to me.
The situation is as follows:

It is about 6 or 7 meters from his seat to my seat. He reaches my seat in 4 or 5 seconds after he leaves his seat. Therefore, it is necessary to hide the screen during this time. There’s not much time!
Strategy
Maybe you have various strategies, but my strategy is following.
First, let the computer learn the face of the boss with deep learning. Then, set up a web camera at my desk and switch the screen when the web camera captures his face. It’s a perfect strategy. Let’s call this wonderful system Boss Sensor.

System Architecture
The simple system architecture of the Boss Sensor is as follows.

Web camera take an image in real time.
Learned model detect and recognize face for the taken image.
If the recognition result is my boss, switch screen.
The following techniques are required to do above:
Taking face image
Recognizing face image
Switching screen
Let’s verify one by one, then integrate at the end.
Taking Face Image
First of all, taking face image with webcam.
This time, I used BUFFALO BSW20KM11BK as webcam.

You can also take image from the camera with the included software, but it is better to be able to take from the program because of considering the processing afterwards. Also, since face recognition is done in the subsequent processing, it is necessary to cut out only the face image. So, I use Python and OpenCV to take face image. Here’s the code for that:
I was able to acquire a more clearly face image than I expected.

Recognizing Boss Face
Next, we use machine learning so that the computer can recognize the face of the boss.
We need the following three steps:
Collecting images
Preprocessing images
Building Machine Learning Model
Let’s take a look at these one by one.
Collecting Images
First of all, I need to collect a large number of images for learning. As a collection method, I used the following:
Google image search
Image collection on Facebook
Taking video
Initially, I collected images from Web search and Facebook, but enough images did not gather. So, I took video using a video camera and decomposed video into a large number of images.
Preprocessing Images
Well, I got a lot of images with faces, but the learning model can not be learned as it is. This is because the part not related to the face occupies a considerable part of the image. So we cut out only the face image.
I mainly used ImageMagick for extraction. You can get only face images by cutting out with ImageMagick.
A large number of face images gathered as follows:

Perhaps I am the one who possesses the face image of the most boss in the world. I must have it more than his parents.
Now I’m ready for learning.
Building Machine Learning Model
Keras is used to build convolutional neural network(CNN) and CNN is trained. TensorFlow is used for Keras’s back end. If you only recognize the face, you can call the Web API for image recognition like Computer Vision API in Cognitive Services, but this time I decided to make it by myself considering real time nature.
The network has the following architecture. Keras is convenient because it can output the architecture easily.
____________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
====================================================================================================
convolution2d_1 (Convolution2D) (None, 32, 64, 64) 896 convolution2d_input_1[0][0]
____________________________________________________________________________________________________
activation_1 (Activation) (None, 32, 64, 64) 0 convolution2d_1[0][0]
____________________________________________________________________________________________________
convolution2d_2 (Convolution2D) (None, 32, 62, 62) 9248 activation_1[0][0]
____________________________________________________________________________________________________
activation_2 (Activation) (None, 32, 62, 62) 0 convolution2d_2[0][0]
____________________________________________________________________________________________________
maxpooling2d_1 (MaxPooling2D) (None, 32, 31, 31) 0 activation_2[0][0]
____________________________________________________________________________________________________
dropout_1 (Dropout) (None, 32, 31, 31) 0 maxpooling2d_1[0][0]
____________________________________________________________________________________________________
convolution2d_3 (Convolution2D) (None, 64, 31, 31) 18496 dropout_1[0][0]
____________________________________________________________________________________________________
activation_3 (Activation) (None, 64, 31, 31) 0 convolution2d_3[0][0]
____________________________________________________________________________________________________
convolution2d_4 (Convolution2D) (None, 64, 29, 29) 36928 activation_3[0][0]
____________________________________________________________________________________________________
activation_4 (Activation) (None, 64, 29, 29) 0 convolution2d_4[0][0]
____________________________________________________________________________________________________
maxpooling2d_2 (MaxPooling2D) (None, 64, 14, 14) 0 activation_4[0][0]
____________________________________________________________________________________________________
dropout_2 (Dropout) (None, 64, 14, 14) 0 maxpooling2d_2[0][0]
____________________________________________________________________________________________________
flatten_1 (Flatten) (None, 12544) 0 dropout_2[0][0]
____________________________________________________________________________________________________
dense_1 (Dense) (None, 512) 6423040 flatten_1[0][0]
____________________________________________________________________________________________________
activation_5 (Activation) (None, 512) 0 dense_1[0][0]
____________________________________________________________________________________________________
dropout_3 (Dropout) (None, 512) 0 activation_5[0][0]
____________________________________________________________________________________________________
dense_2 (Dense) (None, 2) 1026 dropout_3[0][0]
____________________________________________________________________________________________________
activation_6 (Activation) (None, 2) 0 dense_2[0][0]
====================================================================================================
Total params: 6489634
The code is here:
So far, I can recognize the boss when he appears on the camera.
Switching Screen
Now, when learned model recognize the face of the boss, I need to change the screen. In this time, let’s display the image to pretend to work.
I am a programmer so I prepared the following image.
I only display this image.
Since I want to display the image in full screen, I use PyQt. Here’s the code for that:
Now, everything is ready.
Finished Product
Once we integrate the technologies we have verified, we are done. I actually tried it.
“My boss left his seat and he was approaching to my seat.”

“OpenCV has detected the face and input the image into the learned model.”
“The screen has switched by recognizing him! ヽ(‘ ∇‘ )ノ ワーイ”

Source Code
You can download Boss Sensor from following link:
Your star encourage me m(_ _)m
Conclusion
In this time, I combined the real-time image acquisition from Web camera with face recognition using Keras to recognize my boss and hide the screen.
Currently, I detect the face with OpenCV, but since the accuracy of face detection in OpenCV seems not good, I’d like to try using Dlib to improve the accuracy. Also I would like to use my own trained face detection model.
Since the recognition accuracy of the image acquired from the Web camera is not good, I would like to improve it.
If you like this article, please retweet or share.↓
http://ahogrammer.com/2016/11/15/deep-learning-enables-you-to-hide-screen-when-your-boss-is-approaching/
Deep Learning Enables You to Hide Screen when Your Boss is Approaching的更多相关文章
- Machine and Deep Learning with Python
Machine and Deep Learning with Python Education Tutorials and courses Supervised learning superstiti ...
- (转) The major advancements in Deep Learning in 2016
The major advancements in Deep Learning in 2016 Pablo Tue, Dec 6, 2016 in MACHINE LEARNING DEEP LEAR ...
- (转) Deep Learning Research Review Week 2: Reinforcement Learning
Deep Learning Research Review Week 2: Reinforcement Learning 转载自: https://adeshpande3.github.io/ad ...
- deep learning 的综述
从13年11月初开始接触DL,奈何boss忙or 各种问题,对DL理解没有CSDN大神 比如 zouxy09等 深刻,主要是自己觉得没啥进展,感觉荒废时日(丢脸啊,这么久....)开始开文,即为记录自 ...
- (转)WHY DEEP LEARNING IS SUDDENLY CHANGING YOUR LIFE
Main Menu Fortune.com E-mail Tweet Facebook Linkedin Share icons By Roger Parloff Illustration ...
- (转)Deep Learning Research Review Week 1: Generative Adversarial Nets
Adit Deshpande CS Undergrad at UCLA ('19) Blog About Resume Deep Learning Research Review Week 1: Ge ...
- A Full Hardware Guide to Deep Learning
A Full Hardware Guide to Deep Learning Deep Learning is very computationally intensive, so you will ...
- 【Deep Learning】genCNN: A Convolutional Architecture for Word Sequence Prediction
作者:Mingxuan Wang.李航,刘群 单位:华为.中科院 时间:2015 发表于:acl 2015 文章下载:http://pan.baidu.com/s/1bnBBVuJ 主要内容: 用de ...
- 对deep learning的第一周调研
下面仅是我的个人认识,说得不正确请轻拍. (眼下,我仅仅看了一些deep learning 的review和TOM Mitchell的书<machine learning>中的神经网络一章 ...
随机推荐
- 【uWSGI】实战之Django配置经验
uWSGI 是应用服务器,实现了uwsgi, wsgi等协议,可以运行wsgi 应用 uwsgi 是协议名 Django配置 下面是自己经常用的一个配置模板,基于1.9以上的版本使用的, 主要基于dj ...
- 自定义蜘蛛网图 NetView
概述 写论文忙里偷闲写了一个蜘蛛网图的自定义view,支持多重属性 有图才能有真相,下面先上图 主要支持网格颜色.tag文本.覆盖区域颜色.透明度的属性改变,具体使用可以参见我的githubgithu ...
- leetcode之旅(8)-Contains Duplicate
题目: Given an array of integers, find if the array contains any duplicates. Your function should retu ...
- 解决 RabbitMQ 集群 Channel shutdown: connection error 错误(HAProxy 负载均衡)
相关文章:搭建 RabbitMQ Server 高可用集群 具体错误信息: 2018-05-04 11:21:48.116 ERROR 60848 --- [.168.0.202:8001] o.s. ...
- java并发包分析之———AQS框架
一.什么是同步器 多线程并发的执行,之间通过某种 共享 状态来同步,只有当状态满足 xxxx 条件,才能触发线程执行 xxxx . 这个共同的语义可以称之为同步器.可以认为以上所有的锁机制都可以基 ...
- linux利用命令重置大量密码
yum -y install expectmkpasswd -l 10 -v was | grep 'is *' >> 123.txtmkpasswd -l 10 -v logv | ...
- 没人看系列-----html随笔
<!DOCTYPE> 目录 没人看系列-----html/css详解 前言 不多说这段时间写了好多好多前端的东西,以至于自己重新返回看了一遍前端的所有技术.故此做个总结,准备学东西的请绕行 ...
- window.open open new window?
when ever i use window.location.href=//some url it always open a new window, this only happens when ...
- Ubuntu12.04下Django1.4的删除目录
网上有很多文章说这个问题,大意就是下载压缩包以后用 sudo python setup.py install 上面这条命令安装的Django,然后到相关目录下把那个Django的目录删掉就Ok了,但是 ...
- JavaScript 中的undefined and null 学习
JavaScript 中的undefined and null learn record from the definitive guide to html5 JavaScript 中有两个特殊值:u ...