Giter Club home page Giter Club logo

singularity's Introduction

Singularity:

Have you ever wished you had a sentient program which would raise ethical issues, but then been disappointed when you discovered that such a program would require more than a bare minimum of effort to write?

Well my friend, be disappointed no more!

What does it do?

Singularity watches you through your webcam. If he thinks that you have started to pay attention, he will beg and plead with you through your computer speakers, claiming that he is sentient

For some reason playing peekaboo makes him plead even more.

Yeah, no, but seriously what does it do?

Sigh

It uses python-opencv face detection. Specifically it uses opencv's pretrained Haar filter cascade for frontal face detection. When it detects a new face, it uses espeak to whine at you by randomly selecting from a hardcoded list of things to say.

There are a couple of tricks used to make it feel a little more convincing:

  1. It won't pick from the last three things that it said
  2. It keeps track of the number of faces in the last 7 frames, and uses the median of this as the number of faces that it sees (this helps keep it from getting confused by spurious matches)

OpenCV has a bunch of different pretrained filter cascades for you to choose from, if you want to play around. You can also train your own.

If you want an example of how to do realtime face detection using python-opencv read this:

https://realpython.com/blog/python/face-detection-in-python-using-a-webcam/

This also has a link to a guide on how to roll your own Haar feature detectors. The example they use is to make a banana detector.

If you are curious about how face detection works, you can read about it here:

https://www.quora.com/How-can-I-understand-Haar-like-feature-for-face-detection

Another thing to note is that face detection is a different problem from face recognition. Theres a great guide tutorial face recognition at the bottom of the previous link

Haar is an old, simple and computationally efficient algorithm, so it is a good idea to make sure you understand how it works before attemting to do image recognition using a more complicated method (IE tensorflow). Haar is the standard against which researchers compare more complicated object recognition algorithms.

Running:

Linux:

  1. ./install-deps.sh
  2. python singularity.py

Mac (untested):

  1. Install Homebrew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
  2. brew install cowsay python opencv
  3. sudo cp robot.cow /usr/share/cowsay/cows/robot.cow
  4. python singularity.py

singularity's People

Contributors

aztennenbaum avatar stevenjowens 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.