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-0.0.5.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyEmotion-0.0.5-py3-none-any.whl (27.1 MB view details)

Uploaded Python 3

File details

Details for the file PyEmotion-0.0.5.tar.gz.

File metadata

  • Download URL: PyEmotion-0.0.5.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9

File hashes

Hashes for PyEmotion-0.0.5.tar.gz
Algorithm Hash digest
SHA256 87fa2c4a8d86bbc31146bb81014e2c9e84f7e4210128728d8d46d5f6a9389d39
MD5 26b66cd20fa6e07cf238a0f2510f8282
BLAKE2b-256 359da5e256143fa3c719caa4ef1e999b5f694ce9e85edc58ff525209ac84b6a8

See more details on using hashes here.

File details

Details for the file PyEmotion-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: PyEmotion-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 27.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9

File hashes

Hashes for PyEmotion-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2e08dd794fac8919fc55d4fbeb1d56179da1d505b581a00f62aaa77799196850
MD5 29140e6b2430ec3b57c145277f5dd1c7
BLAKE2b-256 30583a2fd4ddb7ee53f77028e63efeb049dd941188249cf1961a1326d6e1e9ab

See more details on using hashes here.

Supported by

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