Security Bot

Security Bot

This page is a case study of the "Security Bot" solution we at Kmbara created using some advanced machine learning and computer vision technology.

security bot

The Problem

We don't live in a perfect world. Every firm is concerned about security, especially firms with very valuable physical assets on their premises. Security solutions can be costly, sometimes requiring large staffs, expensive cameras and equipment, and often both. Firms face the problem of needing to minimize costs, while also needing to maximize security. Achieving high security for minimal costs is a significant problem that requires an innovative solution.

The Opportunity

At Kmbara, we believe that every problem can be an opportunity. An obstacle that seems insurmountable is a chance to innovate, and find a solution that can help a firm and maybe even improve the world. We jumped on the opportunity to use data science to create a low-cost, effective security solution.

Our Solution

Our solution is "Security Bot," a software tool that analyzes video streams and recognizes the faces of preapproved personnel. You can see Security Bot in action recognizing the face of our founder BradTuckfield here:

security bot

You can see that Security Bot can detect a human face, and draw a rectangle around the approximate area taken up by the face. More importantly, it can recognize a face. You can see the text above Brad's face that indicates that Security Bot has recognized that this particular face belongs to Brad. Recognizing faces from video streams can be extremely helpful as part of a security solution. A firm may have about 100 employees and partners who are authorized to access a restricted area. A camera alone could record people on the premises, but wouldn't be able to know in real time whether a person it was recording was one of the 100 people authorized to be present, or an unknown, unauthorized stranger. Even a human security guard could struggle to recognize all of the members of a dynamic roster of 100 people, and perfect security would be hard to achieve in this situation without large investments of time, labor, and capital. You can see here that Security Bot can easily recognize several pre-approved faces in a crowd, and also identify which faces, if any, are "Unknown":

security bot

In this screenshot, you can see that Brad, Manish, and Rohit are recognized by Security Bot, and their faces are labeled. But one person is labeled "Unknown." Security Bot doesn't recognize his face, indicating that he's not authorized to be on the premises. Upon recognizing an unknown person, Security Bot can log an event or send an alert to appropriate parties.

Our solution is lightweight, and consists of several scripts that implement some advanced machine learning and computer vision methods. It costs much less than a security staff, and can be just as effective and timely. Contact us now to get in touch about how we can implement computer vision and machine learning methods like Security Bot for your business.

Technical Details

The first step in our solution is to collect photos of the faces of people who should be recognized by the bot because they are authorized to be present on premises. Face photos can be manually taken and collected, even from social media accounts if necessary. But it's easier to use our face collection tool. With our tool, you can sit in front of a webcam for about a minute and get 100 photos of your face collected from various angles. These 100 photos are uploaded to our server, where detection and encoding can take place.

Detecting a face is easier than recognizing it. It's easy to know that a face is there than to know whose face it is. So the first thing we do with the 100 photos of each authorized person is to detect the faces in each of their photos. We use a method called Histogram of Oriented Gradients (HOG) to detect faces before we recognize them. This method is fast and reliable. It depends on calculating oriented gradients for portions of images. An oriented gradient is a vector that indicates the degree to which a part of an image represents a transition from light to dark. When oriented gradients of face images are summarized in histograms, they tend to yield histograms that are substantially similar, since human faces are substantially similar to each other. Since histograms of face images tend to be similar, we can identify whether any image is a face or not by comparing its HOG to the HOG "signature" that is commonly encountered with human faces. The following image from a research paper shows oriented gradients overlaid on an image of a human face:

security bot

After detecting faces, we encode them. We use a standard method in computer vision implementations that takes every face and converts it to a 128-dimensional numeric vector. This vector conversion is accomplished with a type of deep neural network called a residual net or "ResNet." A neural network is a machine learning method that relies on some complicated nonlinear calculations to make highly accurate classifications and predictions with complex data. Neural networks can be illustrated with images like the one below that shows the resemblance they bear to brains with their neurons and synapses:

security bot

The ResNet type of neural network that we rely on was described in an academic paper by He, Zhang, Ren, and Sun. At Kmbara, we keep up with academic research so that we can use the latest innovations and ideas in our solutions:

security bot

After encoding the faces of authorized people in 128-dimensional vectors, the rest is fairly straightforward. Security Bot reads live video streams from any type of camera. Then, in real time, it detects any faces in a frame of the stream (using HOG), and every time it detects a face, it encodes the face using the same ResNet encoding. It compares face encodings from the live stream to the face encodings previously generated for approved people. If a face encoding from a live stream is substantially similar to a face encoding of a pre-approved person, then it labels their face and recognizes them as an approved person. If a face encoding from a live stream is, on the other hand, not similar to any of the pre-approved faces, then Security Bot identifies this as an "unknown" person. If Security Bot sees an unknown person, it can integrate with logging systems, alert systems, and alarms to take the appropriate action.

We have implementations of Security Bot in Python and also C++, running on Linux servers with at least 8GB of CPU and GPU RAM.

Flexible Innovation

At Kmbara, we're flexible and agile. We can implement the Security Bot's features for you as they are. But every business is different and has different needs. We pride ourselves on our ability to tailor-make custom solutions for every firm, so that our innovations match exactly what your business needs. We can implements of computer vision solutions, including security solutions, attendance tracking for schools, automated inventory management, and much more. Computer vision solutions like Security Bot can also be integrated with more traditional security bot solutions that Kmbara can develop, like live web dashboards for personnel tracking or intelligent demand forecasting tools for supply chain planning. We can get creative and find a way to accomplish anything your business needs in an innovative way. Let us at Kmbara help you make things better.

Kmbara © 2019 - 2020