Git Product home page Git Product logo

people-tracking-cv's Introduction

Netlify Status

Person Detection CV Web App

image

This is a web application using React and Next.js that utilizes computer vision to detect and track people in real-time using the webcam as a video source. The application allows users to set a minimum confidence threshold to filter the detected objects and display them with bounding boxes.

Getting Started

Application

To start the application, first install the NPM packages

npm install

Start the development site using

npm run dev

To build use

npm run build

Specification

Training Model

This model detects person objects defined in the COCO dataset, which is a large-scale object detection, segmentation, and captioning dataset.

The detected objects will appear in bounding boxes. Tune the minimum score to only show person objects meeting a certain confidence value.

A value of 5 means that a bounding box will appear if the model is at least 5% confident the object is a person.

Tech Stack

Built with Typescript, NextJS, ReactJS, and TensorflowJS.

Detector Class

Created an abstract Base Detector class that can be detected for using other models. Currently it has the following models:

  1. Haar Cascade with OpenCV (Specifically Full face & Eyes)
  2. Coco SSD with TensorFlow

Creating this class makes it easier to extend to other detectors and re-use the components.

Other Models

This application was initially built using the Haar Cascade Models with OpenCV.js. The application can be found on the other-models branch of this repository.

Known Issues

Not Available on Mobile

The application is responsive, however, on mobile, due to the different aspect ratio of the webcam, the application breaks.

Specifically, the canvas element is not laid over correctly over the webcam and hence it does not draw the bounding boxes correctly.

Learnings & Improvements

This was my first time developing an OpenCV application, especially one in the browser with ReactJS and NextJS.

Haar Cascade Models

I initially implemented full-face and eyes detection with OpenCV.js and the Haar Cascade Models, however it was very slow, laggy and often blocked the UI. In addition, there wasn't an ability for setting the confidence level.

To improve the detection with this model, it would be good to create a web worker on a seperate thread and make the browser more accessible and interactible.

Coco SSD & TensorFlow.js

I learned how to implement the tensor flow pre-trained Coco SSD model on the browser with the help from this repository. A future improvement would be to allow users to update other parameters from this model, and also create other Detector classes based off the provided Tensor Flow JS models.

YoloV5 & TensorFlow.js

A future improvement would be to use the YoloV5 model. Take a look at this guide from this repository.

Bounding Boxes

It would be good to provide more information in the bounding boxes, such as the type of object detected (i.e. "person"), and the confidence level.

Mobile Friendly

Update the WebcamDetector component so it can work on mobile phones. In addition, update the UI to make it more user friendly to use on Mobile.

Remarks

As mentioned, there was a learning curve and figuring out how to work with OpenCVJs in the browser.

In addition, the Coco-SSD detector only allows updating the minimum confidence levels for returning a bounding box of a detected object. Unfortunately, I did not have time to work with other models and play with other settings to adjust the confidence of the models internally.

people-tracking-cv's People

Contributors

yilverdeja avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.