Have you ever walked into a public building, an exhibition, or a library and noticed someone sitting near the entrance, clicking a manual tally counter every time a person walks through the door?

While manual counting has been the standard for decades, it is far from perfect. Humans get distracted, staff resources are wasted on a repetitive task, and at the end of the day, you are only left with a single, isolated number. You know how many people showed up, but you have no idea when they arrived.

To solve this, I set out to build a modern, automated solution: an AI Automated People Counter. By leveraging computer vision and cloud database synchronization, this project transforms any ordinary smartphone camera into an intelligent data harvester.

If you want to see the system in action right now, you can test the live demos here:

How it Works?

The system is built entirely on web technologies, meaning it runs directly inside a mobile browser without requiring a complicated app store installation.

When an iPhone or Android device is mounted at an entrance, the webpage gains secure access to the camera. From there, an on-device machine learning model (COCO-SSD via TensorFlow.js) continuously scans the video frames. The moment it detects a human shape, it applies a digital "lock" onto that person using centroid tracking.

As the person walks forward and crosses a customizable virtual line on the screen, the system increments the counter and instantly triggers a silent background network request to a secure MySQL database.

The Perfect Use Case: Modern Libraries

To understand the practical value of this system, look no further than a local or academic library.

Libraries are no longer just repositories for books; they are dynamic community hubs offering digital workspaces, study groups, and community events. To justify their budgets, secure government funding, and optimize their operations, libraries must strictly report visitor metrics.

Deploying this AI system in a library environment changes everything:

  • Freeing Up the Librarians: Instead of forcing staff or volunteers to monitor doors, they can focus entirely on helping visitors, managing collections, and conducting programs.

  • Justifying Funding with Concrete Data: When bidding for municipal grants or university funding, having a bulletproof database that logs exact, timestamped visitor traffic is incredibly persuasive.

  • Resource Allocation: If the data shows that student influx spikes drastically between 2:00 PM and 5:00 PM on Tuesdays, the library administration knows exactly when to schedule peak staffing hours or opening extensions.

Why "Time-Series Data" is a Game-Changer

Most venue managers treat attendance tracking as a vanity metric—they just want a large total number to put on a slide at the end of the month. But the true business intelligence lies in the timeline.

Because this system logs entries down to the exact second, the companion dashboard can automatically group foot traffic into hourly windows.

Looking at a live graph allows organizers to instantly see the "velocity" of a crowd. You can visualize exactly when your rush hours hit, measure the exact impact of a marketing campaign or event launch, and accurately plan for crowd safety and capacity management in real time.

A Minimalist, Real-Time Analytics Dashboard

To make this data highly actionable, I built a responsive, corporate-style dashboard that pulls records from the server database every three seconds.

Whether opened on a smartphone, a tablet, or projected onto a massive TV display at an event command center, the interface adjusts smoothly. It features an interactive traffic velocity curve, a visual load progress bar for hourly logs, and a dedicated "Big Screen" presentation mode that isolates a massive live counter against a clean background for high-visibility monitoring.

Final Thoughts

Technology is at its best when it takes a mundane, manual task and automates it to reveal deep, strategic insights. By combining the processing power of modern mobile processors (Edge Computing) with cloud databases, we can turn a spare smartphone into a sophisticated infrastructure monitoring node.

Don't forget to grab a phone and test the camera tracking app at fazlibaharuddin.com/counter and watch the numbers populate live on the dashboard at fazlibaharuddin.com/counter/dashboard.php!

What are your thoughts on using Computer Vision for crowd analytics?