📜 ⬆️ ⬇️

The neural network was taught to minimize all open windows on the screen as the boss approaches.

image

You can automate a lot, although not all. But nevertheless, with the help of automation, one can make life much easier for oneself, making it more comfortable and, in some cases, safer. In a sense, protect yourself from the authorities. One of the developers of neural networks decided to create a system that, when the boss approached, immediately turned off the “inappropriate windows”, hiding them out of sight.

For the user, the actions of the system look quite transparent, since the neural network, after detecting the approaching boss, issues a corresponding notification. And only then turns off the window, giving another warning. The system itself is committed to using the usual good quality webcams to capture the faces of people approaching the desktop, and when identifying superiors, it quickly removes everything from the computer screen, away from sin. When developing, the library Keras was used, which simplified the task. How does all this work?

Yes, nothing particularly difficult, no special problems in the implementation of the system, the developer has not received. By the way, one of the conditions for creating such a system was to teach a neural network to recognize the face of a boss from 5-7 meters, so as not to worry about the fact that the boss can see everything from close range. The time to identify the boss a little - only about 4-5 seconds.
')
Of course, there is nothing good in dealing with outside affairs at work. This example is simply a working system, which was done, rather for fun than for some real problems by the authorities.



So, the developer decided to constantly take pictures of everything that happens around him, in order to notice the boss in time. The detection system is called Boss Sensor.



The system is simple:


That is, in the literal sense of the word, you need to: get face images, recognize, switch screens, which allows you to hide open windows from one of the desktops.

The developer decided not to philosophize slyly, but to use the standard Buffalo BSW20KM11BK camera.



Of course, the image can be created independently, using software. But it is better to trust the system - work on it lasted for quite a long time, besides, the system works quite accurately. As for getting a photo, the developer offers everyone to get acquainted with the source code .

As for training, everything is relatively simple here - such systems have been around for a long time. To fulfill the goal, you need to perform three steps:


Implementation of the idea


Collect images. In order for the neural network to be, on what to train, the creators of the system used thousands of photos. They can be taken both from private collections and from other packages of other users. For self-learning system need a huge number of shots. They decided to take them from:


Initially, the developer received thousands of images with different faces, but his system could not self-educate on the basis of photos. The ImageMagick library was used to extract individuals from a large number of photos.

As a result, the following database of employees and the boss turned out:



If you want to recognize a person’s face, it’s better to try out the Web API, for an image, a tool like the Computer Vision API in Cognitive Services. The developer decided to go his own way. The neural network created by him had a certain structure:

Program structure
____________________________________________________________________________________________________
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 can be found here . The developer says that the system has become almost unmistakable to recognize the boss when he appears near the camera.

Well, now you need to set clear instructions on that account, if the chef does appear next.



Now everything is ready, and the technology has been tested many times. Now you can start the system and make it react to the boss.

After the test, everything turned out to be workable. A few meters before the camera, the boss remained spring and calm. The system took all the necessary images and analyzed it and was able to correctly identify the developer’s boss. A single-digit test showed that everything works.

The source code of such a system can be found at this link .

The identification system first determined that it really was the boss, then she managed to recognize the picture and ... yes, minimize all the windows. At the moment, the definition of a person is using OpenCV. Perhaps Dlib will improve recognition accuracy.

There are, of course, more serious projects, where they prepare, for example, computer vision systems, which are trained in computer games . Neural networks are becoming increasingly popular - car developers, scientists, creators of robotic systems, and other specialists work with them.

Source: https://habr.com/ru/post/400185/


All Articles