Coder Social home page Coder Social logo

face_detection's Introduction

Face Detection with OpenCV

Dependencies

  • Python 3.7
  • opencv-python 4.8.1.78

Approach

To establish a basic face detection system employing a pre-trained Haar Cascade classifier, the initial step involves the installation and configuration of OpenCV. For this, we used the pre-trained haarcascade_frontalface_default cascade file.

To create structure in the test data, a json file was written which contained both the filnames of the test data as well as how many faces there are in a given image. The json file is loaded into the python script and the inside a loop, the program runs the code responsible for facial detection for every image in the json file. This was done to streamline the testing process instead of having to load inividual images to test and check for facial recognition accuracy.

The facial detection code section reads an image provided and converts it to grayscale to be compatible with the openCV facial detection toolset. To display the faces detected by open cv, a rectangle is drawn around the approximate coordinates of each face. Finally to check the accuracy of the Haar Cascade classifier, a comparison between each photos' given number of faces and detected number of faces is calculated as a percentage.

Initially this was tested with a single image. After the program was proven to be working, a dataset was created using multiple images with and without faces to evaluate the performance of the system.

Limitations

There are false positives which affect accuracy percentage. Typically this is when an algorithm gives a positive detection of a face where there is no face. When using the metric of "number of faces detected" false positives have an outsized effect on the perceived accuracy as a false positive can lead to the number of faces that is detected is the same as the number of faces given, leading us to believe that it has detected all the faces if we are only using this metric. As a solution to this, the system can be changed where instead of detecting the number of faces, the groundTruth can have correctly identified bounding boxes for each face and the facial detection system will only consider detected faces whose bounding boxes intersect with the groundTruth bounding boxes. The intersected boxes will count as a positive and the other boxes are correctly flagged as false positives.

face_detection's People

Contributors

sincerelynavin avatar dawger-fr avatar

Stargazers

 avatar

Watchers

Kostas Georgiou avatar  avatar  avatar

Forkers

dawger-fr

face_detection's Issues

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.