Blog Home

Estimating indoor CO2 levels using tinyML and computer vision

Arduino TeamMay 6th, 2022

The ongoing COVID-19 pandemic has drawn attention to how clean our indoor environments are, and by measuring the CO2 levels within a room, infection risks can be approximated since more CO2 is correlated with poor ventilation. Software engineer Swapnil Verma had the idea to use computer vision to count the number of occupants within a space and attempt to gauge the concentration of the gas accordingly.

The hardware powering this project is an Arduino Portenta H7 combined with a Vision Shield add-on that allows the board to capture images. From here, Verma used a subset of the PIROPO dataset, which contains recordings of indoor rooms and ran the YOLOv5-based auto labeling utility within Edge Impulse to draw bounding boxes around people. Once labeled, a FOMO model was trained with a respectable F1 score of 91.6%.

Testing the system was done by observing how well the Portenta H7, running the object detection model from Edge Impulse, did at tracking a person moving throughout a room. Even though the model only takes an input of 240x240px image data, it still performed admirably in this task. For the last step of estimating CO2 levels, Verma’s code simply takes the number of people detected in the frame and multiplies it by a constant. For more details, you can read his post here.