Skip to content

mathinking/FaceGenderAgeEmotionDetection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FaceGenderAgeEmotionDetection

View Face, Age and Emotion Detection on File Exchange

Demo for face, gender, age and emotion detection (all using Deep Learning), together with some Computer Vision features to enhance detection and tracking.

Note all these networks have their origins in research. Use preferably with a GPU.

Requirements:

In MATLAB

Deployed on a Jetson

Installation

This demo uses pre-trained models in Caffe (requires downloading ~1.16GB).

Add folder to search path and check for Add-on requirements by running:

>> install

For downloading the models, run:

>> downloadAndSetupNetworks

Usage

In MATLAB

You may run face, age and emotion detection by running (gender detection is disabled by default):

>> faceGenderAgeEmotionDetection

Test Image

or choose which of the available models to use. For instance:

>> faceGenderAgeEmotionDetection(true,true,true)

which runs gender, age and emotion detection. The demo uses binary gender classification, which may be inappropriate. Please note that this network has its origins in research and is not enabled by default. I am fully respectful and supportive of non-binary people.

Note: you may want to tweak the bounding box output, frame rate detection or other tunable parameters. You may do so by changing the inputs to DeepNeuralNetworkDetectorOptions in faceGenderAgeEmotionDetection (line 40).

You may also speed up perfomance by generating MEX files using GPU Coder for each of the predict functions:

  1. Make sure that your computer is setup correctly:
>> coder.checkGpuInstall
  1. Generate mex files:
>> generateCode

Deployed on a Jetson

  1. Make sure that your environment is setup correctly:
>> coder.checkGpuInstall('tx2');
  1. Open the codegen script
>> edit generateCodeForJetson
  1. Modify it to reflect your current configuration (e.g. IP address).
  2. Run the first section to generate CUDA code on the host, transfer it to the Jetson and compile it.
  3. Run the second section to launch the executable on the jetson. Please note that you can change the clock speed to maximise the performance.

References

[1] Abars, Face Search VGG16, (2018). GitHub repository, https://github.com/abars/FaceSearchVGG16

[2] Rasmus Rothe, Radu Timofte and Luc Van Gool, (2016). Deep expectation of real and apparent age from a single image without facial landmarks. International Journal of Computer Vision (IJCV)

[3] Jia, Yangqing, et al., (2014). "Caffe: Convolutional architecture for fast feature embedding." Proceedings of the 22nd ACM international conference on Multimedia. ACM.

[4] Gil Levi and Tal Hassner, (2015). Emotion Recognition in the Wild via Convolutional Neural Networks and Mapped Binary Patterns. Proc. ACM International Conference on Multimodal Interaction (ICMI). https://osnathassner.github.io/talhassner/projects/cnn_emotions/project.html