Inspiration
As we came into Corwin Pavillion where all the hackathon event was held, we saw that the staff members kept track of the number of people inside the room due to the fire emergency safety issues. We could build something to help their hassles. When the crowd gets together, it's more problematic to the supervisors.
What it does
It takes a picture of the room every few seconds, and if the room is almost at a capacity, the service alerts the users (the staff members), and they can check the current status on our dashboard.
- Our service consists of three main components.
- Camera client: It keeps taking a picture of a room every few seconds, and save the image in Google Cloud Platform Storage, and send the image url to the server.
- Web client (dashboard): It shows the chart of the number of people inside the room over time, and the pictures of the room. It also allows the user to configure the room capacity.
- Server: It receives the url to the picture of the room. It detects the objects from the picture, and it saves the status of the room in database. Also, it serves the api consumed by the web client.
How we built it
- Our service infrastructure is mainly on Google Cloud Platform (GCP).
- Our service consists of three main components: camera client, server, and the web dashboard.
- Using openCV, we made the camera client with python script that takes a picture of the room every ten seconds using my laptop camera. Each time it takes a photo, it uploads the image file to GCP Storage, and sends the storage file public url to our server.
- The server was built with flask, python, openCV, Twilio API, and imageAI. As the server receives the image url, it detects the number of people inside the picture using Residual Neural Network model trained by imageai.org. Then, It stores the information in MySQL database hosted by GCP SQL. If the number of people in the room picture exceeds the 90% of the room capacity, it sends the warning text message to the users using Twilio API. The message contains the url link to the dashboard, so that they can check the room status right away.
- We used chart.js and jQuery to build Web Dashboard for users. It draws a graph of the number of people inside the room over time, and it shows the pictures of the room. It lets the user to configure the room capacity by calling REST API to the server.
Challenges we ran into
- This is our first time participating in a hackathon, so we were totally lost at the beginning. We had to spend spend hours just brainstorming what to make.
- Both of us are not experts of the computer vision, so we did a lot of research to improve the precision of the object detections.
Accomplishments that we're proud of
- Our main objective was to help the hackathon supervisors to easily handle the safety issues inside the building, but as we develop this service, we realized that it has a lot of applications. This could be used to keep track of the number of people in line to the restaurants, museums, theater, and etc.
- While our team has only two members, we've successfully deployed our service within two days even though it's still the demonstration purpose.
What we learned
- We learned about setting up the infrastructures and how to get used to the new technology.
- We did a few pair programming that we were able to learn each other's own programming skills.
- We learned about openCV and computer vision. At first, we thought image detection could be done magically if we just use the library, but it wasn't. Most of the blog posts are still targeted to a specific objectives, and many of them needed some modifications. Nothing comes for free.
What's next for Headcounter
- We still need to work on the object detection part. It was a lot better than the first try, but it still cannot recognize a lot of people when the resolution isn't great.
- Currently, the service only works for a single user, but we have to generalize it, so that a single server can host multiple users.
- The camera client runs on a laptop, but to be more efficient we rather make a program that runs on Android, so that we can easily deploy around the room.
Built With
- chart.js
- css
- flask
- google-cloud
- html
- imageai
- javascript
- mysql
- opencv
- python
- rest
- tensorflow
- twilio

Log in or sign up for Devpost to join the conversation.