|
ARDUINO MEGA 2560 REV3 |
x 1 | |
|
Neuton Tiny MLNeuton
|
x 1 |
|
arduino IDEArduino
|
Tabular Data VS Computer Vision: Detecting Room Occupancy
Story
Today, room occupancy detection is widely used in public places as a way to provide safety, manage energy consumption, etc. Most people tend to think that occupancy detection based on computer vision is the most common way to monitor presence in specific rooms and areas.
But what if I say that there’s a more budget-friendly way to detect occupancy than real-time video analysis? In my tutorial, I want to show an alternative way to detect people in the room, which is easier and cheaper to implement and doesn’t require any special data science knowledge.
Vision-based Method
Computer vision executes various techniques and approaches to identify objects in digital images, such as R-CNN, Fast R-CNN, Faster R-CNN, and YOLO, among others. The process of object recognition is quite complex and consists of a range of related tasks, including image classification, object localization, and object detection.
For better understanding, I attach the example of image recognition using a Region-based Convolutional Neural Network (R-CNN):
Resource: www.researchgate.net
However, such technologies are quite demanding in use due to the following factors:
- High time and energy consumption
- Complex scaling of computer vision systems
- Use of complex deep learning algorithms that require the participation of data scientists
- Need for a large amount of equipment such as surveillance video cameras
- High costs for equipment and human resources
Since I believe that technologies should be easy to implement and available to more users, I’d like to offer a no less effective way to detect room occupancy, which will help to overcome the challenges mentioned above.
Sensor Data + TinyML Algorithms
In this tutorial, I’ll demonstrate how to efficiently use tabular data and automatically build a tiny machine learning model based on environmental sensor data to detect room occupancy.
But before describing the process in detail, I want to share the main advantages of my method:
- The resulting model is incomparably more compact than any computer vision model. And consequently, technologies and HW for the model operation will be cheaper and consume less energy and memory.
- It’s budget-friendly since I use a free platform and sensors cost less than cameras.
- It requires minor time and energy consumption.
Model Training
Now let me proceed with the step-by-step procedure of the TinyML model creation.
This is a binary classification task as we need to predict whether a room is occupied or not, based on data from environmental sensors, such as temperature, humidity, light, and CO2.
For my experiment, I used an open-source “Occupancy Detection” dataset available on the UCI Machine Learning Repository: https://archive.ics.uci.edu/ml/datasets/Occupancy+Detection+
For model training, I use a free no-code platform, Neuton TinyML. Here are the steps of the process:
- I created a new solution and uploaded a training dataset that I downloaded from the UCI Machine Learning repository.
- Then I selected a target variable “Target” and the target metric “Accuracy”.
- To make a truly compact model that would fit into the tiniest sensor, I enabled the TinyML mode and selected 8-bit depth.
That’s all I needed to start model training :)
The trained model turned out to be super small and accurate, according to all the canons of TinyML. Looking ahead, I also provide Total footprint and RAM usage in the table :)
Just note the small number of coefficients (only 60!). And, most importantly, the model’s accuracy (which is 98%) is not affected by the small size which is fantastic!
For the purity of the experiment, I wanted to compare the metrics of Neuton’s model with the model built with one of the most used platforms, TensorFlow Lite for microcontrollers. But unlike Neuton, TF Lite for Microcontrollers requires a 32-bit platform, and therefore it would not be possible to deploy it to Arduino Mega 2560 which has an 8-bit MCU (ATmega2560).
Model Deployment
For model deployment, generate the C library on the Neuton platform by clicking on the “Download” button. The contents of the library include the model, a set of functions used to perform preprocessing operations, and a set of functions used by the application logic to execute the model and read prediction results.
The code is available here: https://github.com/Neuton-tinyML/arduino-room-occupancy
To integrate the library, take the following steps:
- Include the library
- Declare input variable and set input values
- Run predictions
Since I use CSV data as input, I will send 4 different conditions (which are described by values of features) of the room to detect its occupancy.
To emulate the work of a model, I connected a microcontroller to a computer via a serial port, and the communication took place in a binary format.
A sound signal on the video notifies that there is a person in the room.
I hope that my tutorial proved that you don’t need to be a computer vision genius to implement real-world projects. Now you know an alternative way to detect room occupancy by leveraging the power of TinyML, which doesn’t require high costs or efforts, just a free no-code platform!
Tabular Data VS Computer Vision: Detecting Room Occupancy
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by AlexMiller112
- Gesture-based remote control device IntroductionThis project demonstrates a gesture based remote control device using Silabs xG24 Dev Ki...
- Ultra-Tiny Solution of Daily Activities Recognition IntroDespite the incredible variety of wearable devices today, most of the AI features come down to ...
- TinyML experiment on building a weather station StoryLately, I’ve been really passionate about the field of TinyML, actively researching how to enab...
- Tiny ML Air Writing Recognition with Nicla Sense ME StoryLess than half a year ago, a new Arduino’s board, Nicla Sense ME (Motion & Environment), hi...
- Making Famous Magic Wand 33x Faster IntroThis case is a remake of a well-known “magic wand” experiment. Last year, Pete Warden, the famo...
- Real-time Food Quality Prediction With each passing year, the issue of food waste becomes more acute for the environment. A recent Foo...
- TinyML Monitoring Air Quality on 8-bit Microcontroller StoryI’d like to share my experiment on how to easily create your own tiny machine learning model an...
- Detecting Unstable Electrical Grid with TinyML IntroductionElectricity is the heart of modern social and economic development. More and more countr...
- Tabular Data VS Computer Vision: Detecting Room Occupancy StoryToday, room occupancy detection is widely used in public places as a way to provide safety, man...
- Tiny ML for Big Hearts on an 8-bit Microcontroller StoryIn the course of the pandemic, the interest in creating more innovative medical devices has run...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
124 0 0 -
DIY Laser Power Meter with Arduino
173 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
163 0 2 -