Giter Club home page Giter Club logo

hsemotion's Introduction

HSEmotion Python Library for Facial Emotion Recognition

Downloads pypi package PWC

License

The code of HSEmotion Python Library is released under the Apache-2.0 License. There is no limitation for both academic and commercial usage.

Installing

    python setup.py install

It is also possible to install it via pip:

    pip install hsemotion

Usage

    from hsemotion.facial_emotions import HSEmotionRecognizer
    model_name='enet_b0_8_best_afew'
    fer=HSEmotionRecognizer(model_name=model_name,device='cpu') # device is cpu or gpu
    emotion,scores=fer.predict_emotions(face_img,logits=True)

The following values of model_name parameter are supported:

  • enet_b0_8_best_vgaf
  • enet_b0_8_best_afew
  • enet_b0_8_va_mtl
  • enet_b2_8
  • enet_b2_7

The method predict_emotions returns both the string value of predicted emotions (Anger, Contempt, Disgust, Fear, Happiness, Neutral, Sadness, or Surprise) and scores at the output of the last layer. If the logits parameter is set to True (by default), the logits are returned, otherwise, the posterior probabilities are estimated from the logits using softmax.

In addition, it is possible to extract visual embeddings for classifier learning

    features=fer.extract_features(face_img)

The versions of these methods for a batch of images are also available

    emotions,scores=fer.predict_multi_emotions(face_img_list,logits=False)
    features=fer.extract_multi_features(face_img_list)

Complete usage example is available in the test_hsemotion_package.ipynb. It is necessary to run the following line to run the demo script:

run pip install facenet-pytorch

The details about training of the models are available in the main repository

hsemotion's People

Contributors

av-savchenko avatar echuraev 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.