Giter Site home page Giter Site logo

sfi-visual-intelligence / mldemos_with_webcam Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bricaud/webcam_and_raspberrypi

0.0 0.0 1.0 538 KB

ML demos. Code for detection/recognition in videos using a webcam, Python and a Raspberry pi.

License: MIT License

Jupyter Notebook 62.87% Python 37.13%

mldemos_with_webcam's Introduction

Code for object and face detection with a webcam and a Raspberry Pi

The repository contains Python code for face detection, object recognition and other machine learning application using a webcam. A part of the demos are made to run on a Raspberry Pi (3 or 4).

It uses several open-source libraries where neural networks have already been pre-trained for the task at hand.

The code is under the MIT license.

What is inside the repository

There are Jupyter notebooks and Python scripts. The notebooks are meant to guide the user, explain the different steps, and explore the possibilities of image analysis. The Python scripts contain the code to be run directly in the command line, so that it works out of the box on the Raspberry Pi (or other platforms).

Tutorial on face detection with webcam

Here is a list of relevant webpages for Relevant websites: https://iotdesignpro.com/projects/face-recognition-door-lock-system-using-raspberry-pi https://github.com/mowshon/age-and-gender https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/auto_examples/object_detection_camera.html https://learnopencv.com/training-a-custom-object-detector-with-dlib-making-gesture-controlled-applications/ http://dlib.net/ml.html

Haar cascades, face and eyes https://towardsdatascience.com/computer-vision-detecting-objects-using-haar-cascade-classifier-4585472829a9

Raspberry pi and others: https://qengineering.eu/deep-learning-with-raspberry-pi-and-alternatives.html

Experiments on the Raspberry Pi

Enable Raspberry Pi camera

You need to run the following code so that opencv can get the image with VideoCapture:

sudo modprobe bcm2835-v4l2

See: https://stackoverflow.com/questions/29583533/videocapture-open0-wont-recognize-pi-cam/37530016#37530016

Make also sure the interface for (legacy) video is enabled in the raspberry Pi configuration sudo raspi-config -> 'Interfacing Options' -> 'Camera'

Raspberry Pi and Tensorflow

It is not straightforward to install tensorflow on Rasberry Pi. Installing with pip does not work. You can find an alternative way described on the Qengineering website: https://qengineering.eu/install-tensorflow-2.7-on-raspberry-64-os.html They have a github repo with wheels versions of Tensorflow for Raspberry Pi: https://github.com/Qengineering/TensorFlow-Raspberry-Pi_64-bit Download the version you need and run pip install downloaded_wheelfile.whl. To check your version of Linux on the Raspberri Pi, just runcat /etc/os-release, the cpu architecture is given by uname -a and Python version by python --version.

Python Scripts

Face detection

You will need the following python modules:

  • Open-cv:
pip install opencv-python
pip install opencv-contrib-python

The script test_video.py is the first and simplest script you can run to test if Python with opencv can access your camera and display it. You can record your face for training using record_user_face.py after recording one or several faces, run train_face_recognition.py to train the recognition process When it has been trained, run face_detector.py.

Face recognition with Deepface

You will need the deepFace module (pip install deepface) and Tensorflow installed.

You can test the webcam stream with the python script deepFace_stream.py. On the video, you will get emotion (side), estimated age and gender (M/W) (top) of each face.

mldemos_with_webcam's People

Contributors

bricaud avatar

Forkers

salomaestro

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.