Blurred crowd of unrecognizable at the street

Using IoT Devices (Raspberry PI) To Count People For Occupancy or Traffic

The capstone project ventures into the realm of the Internet of Things (IoT) with the creation of an innovative device designed to accurately count and monitor occupancy in designated spaces. The technology aims to capture and analyze images to quantify the number of individuals present, transforming this data into actionable insights. Effortlessly deployable in various environments (e.g., academic settings, corporate offices, public transportation), the solution enhances user convenience. The endeavour stretches beyond simply counting; the prototype focuses on refining process efficiency, cost-effectivity, and data security to meet contemporary demands.’

— Capstone Team CG-22

Using IOT Devices (Raspberry PI) To Count For Occupancy or Traffic

Published:

Using IoT Devices to Count People for Occupancy or Traffic is a capstone project developed by students in the Department of Electrical and Computer Engineering to demonstrate a solution that helps transform occupancy data into actionable insights, geared towards smart resource management. Capstone Team CG-22 created the open-source prototype with the guidance and support of the UBC CIC.

Approach

Team CG-22 developed an IoT proof of concept utilizing an edge device equipped with a camera to capture images of the area, which are then sent to the deep learning model for further analysis. The generated occupancy data is stored in a database and displayed on a user-friendly web application built with React. This system enables users to seamlessly monitor real-time occupancy statistics, aiding timely decision-making. In addition to showing current occupancy, the proof of concept also offers historical occupancy trends from the past 3 months. Administrators have the ability to select specific sub-areas for monitoring and view associated costs.

The result is an unobtrusive and accurate method to count and monitor occupancy in a given area, while abiding to data protection mandates and financial prudence, which can be applicable to all sectors. The comprehensive occupancy monitoring system analyzes images to quantify the number of individuals present and transforms the data into actionable insights. The application can be deployed in diverse environments. In addition to counting, process efficiency, cost-effectivity, and security are optimized, all of which contributes to smart resource management.

The above video was created by Team CG-22. The video describes the goal of the project and includes a demonstration of the solution

See more about the project in the 2024 Capstone Design & Innovation Day showcase, under Emerging Technologies and Innovations.

Solution Details

The solution consists of 4 main components: the IoT device (RaspberryPi Module 4B and RaspberryPi Camera Module 3 Wide Lens) and the machine learning model (PyTorch FastRCNN), and AWS for the cloud and the web application. Specifically for AWS, the team used ReactJS and Semantic UI, Amplify, Cognito, AppSync, TimeStream and DynamoDB.

For more information on the technical components, see the GitHub repository: https://github.com/UBC-CIC/Room-Occupancy.

Screenshots of UI

UI screenshot for the Using IoT Devices Capstone Project: users can view occupancy trends based on historical data
All users land on this page and can see the occupancy history trend for the selected area.

Architecture Diagram

Technical Components

Expand below to learn more about the architecture in detail:

IoT Device

The RaspberryPi Module 4B and RaspberryPi Camera Module 3 Wide Lens takes images of the area and counts the number of people using a locally deployed machine learning model. Module 4B was used as the IoT device because of its powerful local processing capability. The model facilitates low-latency operations and supports optimal imaging processing needs. Module 3 was used for the camera because of its wide field of view, which is essential for accurately capturing images in the defined area.

Machine Learning Model

The PyTorch FastRCNN model is deployed on the IoT device, which then processes images locally and deletes it instantly for security purposes. PyTorch was chosen for its accuracy and ability to perform optimal inferences, which is crucial to maintain privacy and reduce data transfer.

Cloud

The database were the AWS TimeStream and DynamoDB. TimeStream offers scalable data handling, while DynamoDB stores mutable camera information.

Web Application

The web application is built using ReactJS and Semantic UI. ReactJS provides a responsive user interface, which ensures an intuitive user experience. Lambda functions, API Gateway, and Cognito were employed for the back-end processes, including data retrieval and user authentication.

Link to solution on GitHub: https://github.com/UBC-CIC/Room-Occupancy

Acknowledgements

This application was developed by senior students in Electrical and Computer Engineering as part of the UBC Electrical and Computer Engineering Capstone Program. Guidance was provided by a faculty member who acted as the technical director and supported by the UBC Cloud Innovation Center technical team.

Photo by Alexander Ozerov.

About the University of British Columbia Cloud Innovation Centre (UBC CIC)

The UBC CIC is a public-private collaboration between UBC and Amazon Web Services (AWS). A CIC identifies digital transformation challenges, the problems or opportunities that matter to the community, and provides subject matter expertise and CIC leadership.

Using Amazon’s innovation methodology, dedicated UBC and AWS CIC staff work with students, staff and faculty, as well as community, government or not-for-profit organizations to define challenges, to engage with subject matter experts, to identify a solution, and to build a Proof of Concept (PoC). Through co-op and work-integrated learning, students also have an opportunity to learn new skills which they will later be able to apply in the workforce.