Giter Site home page Giter Site logo

martyrath / raspberry-pi-emotion-recognition Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 188.09 MB

Using a Raspberry Pi with camera for emotion recognition

Python 91.12% PowerShell 0.02% Shell 0.01% Cython 0.24% C 1.70% C++ 0.53% Meson 0.01% Fortran 0.06% Forth 0.01% JavaScript 0.10% HTML 6.13% CSS 0.08%

raspberry-pi-emotion-recognition's Introduction

raspberry-pi-emotion-recognition

Project Name: The "How's it going?" Hat - Using a Raspberry Pi with camera for emotion recognition

Grade: 86%

Introduction

My partner is autistic and often has trouble interpreting emotion. The purpose of this project is to develop a device that can interpret emotion in real-time via a camera and communicate those emotions with the user. The device is aimed at users who have trouble recognising facial expressions. howitworkswithtext

Result

See the full video walkthrough here: Watch the video

The device recognises seven emotions which are communicated with the user when an emotion changes via connected Bluetooth device and visually via Blynk app. An image is also stored and processed when an emotion changes to be stored via Firebase to create a dataset to train future models.

Technologies Used

Hardware

• Processing: Raspberry Pi 4 Model B • Sensor: Logitech Web Cam

Programming

• Device: Windows 10 computer • IDE: Visual Studio Code to remotely access Pi via SSH • Language: Python, including os and subprocess to work with Linux commands • WSL to work on project without Pi • Shell scripting and Linux commands

Emotion Recognition

• Face detection: OpenCV • Emotion recognition: TensorFlow Lite

Communication with Pi

• Blynk app to switch on/on emotion recognition, display detected emotions as emoticons. • Bluetooth from Pi to speaker to communicate detected emotions. • SSH Secure Shell for headless connection to Pi

Database

• Firebase to store processed emotion images and emotion labels with timestamp

References

DigitalSreeni, 2021 - Main reference video series:

• Tips Tricks 18 - Extracting faces from images for deep learning training Video: https://www.youtube.com/watch?v=9T9L9HoUFZ0&list=PL-DybH_1zzKv4yVdGeM04t5OfvJPvqLwv&index=1&pp=gAQBiAQB GitHub: https://github.com/bnsreenu/python_for_microscopists/blob/master/Tips_tricks_18_Extracting%20faces%20from%20images%20for%20deep%20learning%20model%20training.py

• 237 - What is Tensorflow Lite and how to convert keras model to tflite? Video: https://www.youtube.com/watch?v=HXzz87WVm6c&list=PL-DybH_1zzKv4yVdGeM04t5OfvJPvqLwv&index=2 GitHub: https://github.com/bnsreenu/python_for_microscopists/tree/master/237_tflite_using_malaria_binary_classification

• 238 - Real time face detection using opencv (and video feed from a webcam) Video: https://www.youtube.com/watch?v=Fuve1nAdm8k&list=PL-DybH_1zzKv4yVdGeM04t5OfvJPvqLwv&index=3 GitHub: https://github.com/bnsreenu/python_for_microscopists/tree/master/238_face_eye_detection_using_opencv

• Note: Used to train emotion detection model using Kera library, output h5 file: 239 - Deep Learning training for facial emotion detection Video: https://www.youtube.com/watch?v=P4OevrwTq78&list=PL-DybH_1zzKv4yVdGeM04t5OfvJPvqLwv&index=4&pp=gAQBiAQB GitHub: https://github.com/bnsreenu/python_for_microscopists/tree/master/239_train_emotion_detection

• Note: Used for main emotion detection file: 241 - Real time detection of facial emotion, age, and gender (using video feed from a webcam) Video: https://www.youtube.com/watch?v=JmvmUWIP2v8&list=PL-DybH_1zzKv4yVdGeM04t5OfvJPvqLwv&index=5 GitHub: https://github.com/bnsreenu/python_for_microscopists/tree/master/241_live_age_gender_emotion_detection

• Note: Used to convert h5 to TensorFlow Lite model: 242 - Real time detection of facial emotion, age, and gender using TensorFlow Lite (on Windows10) Video: https://www.youtube.com/watch?v=NJpS-sFGLng&list=PL-DybH_1zzKv4yVdGeM04t5OfvJPvqLwv&index=6 GitHub: https://github.com/bnsreenu/python_for_microscopists/tree/master/242%20-%20Real%20time%20detection%20of%20facial%20emotion%2C%20age%2C%20and%20gender%20using%20TensorFlow%20Lite

• Note: Used as a guide to instal OpenCV and TensorFlow lite on Raspberry Pi: 243 - Real time detection of facial emotion, age, and gender using TensorFlow Lite on RaspberryPi Video: https://www.youtube.com/watch?v=j6i4YTFlYRA&list=PL-DybH_1zzKv4yVdGeM04t5OfvJPvqLwv&index=7 GitHub: https://github.com/bnsreenu/python_for_microscopists/tree/master/243%20-%20Real%20time%20detection%20of%20facial%20emotion%2C%20age%2C%20and%20gender%20using%20TensorFlow%20Lite%20on%20RaspberryPi

Open CV Haar Cascade model for face detection: https://github.com/opencv/opencv/blob/master/data/haarcascades/haarcascade_frontalface_default.xml

Kaggle Dataset used to train emotion detection model: https://www.kaggle.com/msambare/fer2013

OpenCV installation on Raspberry Pi (jasper-dev dependency not installed): https://raspberrypi-guide.github.io/programming/install-opencv

Tflite Runtime Wheel sourced from PyPi.org: https://pypi.org/project/tflite-runtime/2.14.0/#files

TensorFlow learning aid: TensorFlow in 100 Seconds https://www.youtube.com/watch?v=i8NETqtGHms

Emoticons used in Blynk: https://www.flaticon.com/

Relative paths Python, os.path.join https://stackoverflow.com/questions/918154/relative-paths-in-python

Firebase .exists(): https://stackoverflow.com/questions/37751202/how-to-check-if-file-exists-in-firebase-storage

Firebase blob: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Blob

Crontab for running script on start up: https://www.instructables.com/Raspberry-Pi-Launch-Python-script-on-startup/

PulseAudio issue fix: https://unix.stackexchange.com/questions/445386/pulseaudio-server-connection-failure-connection-refused-debian-stretch

raspberry-pi-emotion-recognition's People

Contributors

martyrath 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.