paint-brush
Detecting Humans in Smart Homes with Computer Visionby@andreysolovev
1,068 reads
1,068 reads

Detecting Humans in Smart Homes with Computer Vision

by Andrey SolovevJune 16th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Computer vision (CV) is intended to detect, process, and distinguish objects in digital images and videos. OpenCV provides a big choice of tools used for object detection, face recognition, image restoration, and many other applications. Here, you’ll learn how to use OpenCV for real-time human detection in the Internet of Things (IoT) home automation. The Algodroid project was to integrate a CV system into an IoT solution to recognize life-threatening situations and provide safety for the elderly in their homes.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Detecting Humans in Smart Homes with Computer Vision
Andrey Solovev HackerNoon profile picture

Computer vision (CV) is intended to detect, process, and distinguish objects in digital images and videos. Completing such tasks requires different technologies, libraries, and frameworks. OpenCV provides a big choice of tools used for object detection, face recognition, image restoration, and many other applications. Here, you’ll learn how to use OpenCV for real-time human detection in the Internet of Things (IoT) home automation.

The OpenCV Library Overview

OpenCV is a set of libraries with over 2500 solutions that vary from classical machine learning (ML) algorithms, such as linear regression, support vector machines (SVMs), and decision trees, to deep learning and neural networks. OpenCV is open-source—it can be freely used, modified, and distributed under the Apache license

The library can run on Windows, Linux, macOS, Android, iOS and support software written in C/C++, Python, and Java. It has strong cross-platform capability and compatibility with other frameworks. For example, you can easily port and run TensorFlow, Caffe, PyTorch, and other models in OpenCV with almost no adjustments. 

The OpenCV library is equipped with the GPU module that provides high computational power to capture videos, process images, and handle other operations in real-time. Leveraging the OpenCV GPU module, developers can create advanced algorithms for high-performance computer vision applications.

OpenCV in IoT Home Automation 

The OpenCV library has found wide applications in smart homes—the Internet of Things systems that assist people in running household functions. The networks of IoT devices can control lights, regulate indoor temperature, water plants, and turn on the TV. 

Providing security is an integral part of IoT home automation. Deploying computer vision applications for people detecting improves safety in many alarm and video intercom systems. Implementing OpenCV face recognition can prevent strangers from entering a house or apartment.  

Apart from protecting homes from intruders, it is necessary to ensure the safety of people who live alone and cannot always take care of themselves. Computer vision people detection systems based on OpenCV algorithms and neural networks can remotely monitor elderly people and people with health problems and disabilities. In case of emergency, they can alert relatives or caregivers. Here, we’ll share our personal experience in building a remote monitoring system for real-time human detection with OpenCV.  

How to Use Computer Vision to Detect People in Smart Homes with the OpenCV Library

The primary task of the Algodroid project was to integrate a CV system into an IoT solution to recognize life-threatening situations and provide safety for the elderly in their homes. We used OpenCV to implement computer vision for people detecting and skeleton visualization. 

To segment a human skeleton, we used TensorFlow-based BodyPix. This is an open-source ML model that segments a human body into 24 parts and visualizes each part as a set of pixels of the same color. 

BodyPix segments a human body into parts and visualizes each part as a set of pixels of the same color.

After segmenting a body, our human detection system determined its biomechanical data, such as body geometry and movements. These parameters were calculated and classified by OpenCV motion tracking algorithms. 

By using simulation libraries, we created a physical model of a human body based on real proportions, biometric and biomechanical data. We placed the model in a virtual environment and generated probable scenarios of human actions. Based on these scenarios, the algorithms learned to estimate the posture. 

Implementing people detection using computer vision becomes challenging in indoor spaces, such as homes. A person can be hidden behind a piece of furniture, so the camera will not capture the entire body, and the system will not get the complete biometric data. After trying different approaches, we combined neural networks with decision trees—classical machine learning algorithms available in the OpenCV library. These algorithms are fast and easy to understand. They can learn from small amounts of data or when some data is missing.

The biggest advantage of using OpenCV for this project was the opportunity to combine different methods and approaches within one platform. Our fall detection system comprised both machine learning and deep learning solutions. As a result, the system could detect 10 target states out of 10 activities. The DNN module allowed us to train neural networks on other frameworks and then successfully run them on OpenCV. 

We developed a communication system that collected data from all cameras installed in the house. After identifying a fall, it could send the picture and notify an emergency medical service for further help. 

Conclusion 

Modern smart homes and other IoT systems often employ machine learning and artificial intelligence technologies and solutions. For example, remote monitoring systems based on computer vision can secure homes and look after elderly people who live independently. Cameras track people’s activities, and algorithms analyze their behaviors, identifying emergencies.

OpenCV is an open-source library rich in tools for building real-time CV applications. Its algorithms can process images, detect and track objects and people, describe their features, and fulfill many other tasks. To get more information about this library, you can visit our blog and learn how to implement OpenCV for people detection in IoT home automation and what challenges you can face while working on similar projects.  

Also published on https://www.integrasources.com/blog/opencv-computer-vision-algorithms-iot-home-automation/.