Skip to main content

A PyTorch library for detecting facial emotions

Project description

PyEmotion

PyEmotion-Version 1.0.0 - A Python package for Facial Emotion Recognition using PyTorch. PyEmotion is a python package which is helping to get the emotion of the person.

python version PyPI Downloads Downloads

Author: Karthick Nagarajan

Email: karthick965938@gmail.com

Installation

We can install PyEmotion package using this command

pip install PyEmotion

How to test?

When you run python3 in the terminal, it will produce output like this:

Python 3.6.10 |Anaconda, Inc.| (default, May  8 2020, 02:54:21) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Run the following code to you can get the Initialize process output for the PyEmotion package.

>>> from PyEmotion import *
>>> PyEmotion()

package_sample_output

Requirements

pytorch >= 1.5.1
torchvision >= 0.6.1

Available Operations

  1. Webcam  —  Result as a video
from PyEmotion import *
import cv2 as cv

PyEmotion()
er = DetectFace(device='cpu', gpu_id=0)

# Open you default camera
cap = cv.VideoCapture(0)

while(True):
  ret, frame = cap.read()
  frame, emotion = er.predict_emotion(frame)
  cv.imshow('frame', frame)
  if cv.waitKey(1) & 0xFF == ord('q'):
    break
cap.release()
cv.destroyAllWindows()
  1. Image  —  Result as a image
from PyEmotion import *
import cv2 as cv

PyEmotion()
er = DetectFace(device='cpu', gpu_id=0)

# Open you default camera
cap = cv.VideoCapture(0)
ret, frame = cap.read()
frame, emotion = er.predict_emotion(frame)
cv.imshow('frame', frame)
cv.waitKey(0)

Arguments

er = DetectFace(device='cpu', gpu_id=0)

device = 'gpu' or cpu'

gpu_id will be effective only when more than two GPUs are detected or it will through error.

Contributing

All issues and pull requests are welcome! To run the code locally, first, fork the repository and then run the following commands on your computer:

git clone https://github.com/<your-username>/PyEmotion.git
cd PyEmotion
# Recommended creating a virtual environment before the next step
pip3 install -r requirements.txt

When adding code, be sure to write unit tests where necessary.

Contact

PyEmotion was created by Karthick Nagarajan. Feel free to reach out on Twitter or through Email!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyEmotion-1.0.0.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

PyEmotion-1.0.0-py3-none-any.whl (27.1 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page