vladmandic / human

Human: AI-powered 3D Face Detection & Rotation Tracking, Face Description & Recognition, Body Pose Tracking, 3D Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction, Gaze Tracking, Gesture Recognition
https://vladmandic.github.io/human/demo/index.html
MIT License
2.35k stars 323 forks source link

adding custom emotion model & post detection logic #393

Closed arvindsaraf closed 1 year ago

arvindsaraf commented 1 year ago

Issue Description Hi - I want to use a custom Emotion model, Gestures & hit some observability APIs for some outliers. Trying to figure out the best ways to do so using this package. Some specific questions:

  1. For custom emotion model, I'm assuming we can change the path in the config? Or should we disable the emotion model & do it in post detection logic?
  2. If we want to compute higher order measures such as fixation & saccade for gaze, is the best way to do it in the postDetect logic below, maintaining the last few inferences in some array since these will need temporal aggregation?
  3. For custom Gestures & observability calls, I'm assuming the main loop roughly changes to something like below: ` async function postDetect() { const interpolated = human.next(); // get smoothened result using last-known results // add custom emotion model call // add custom Gesture logic, update the results // check for outlier, update / hit the observability APIs requestAnimationFrame(postDetect); // run customGestures on the next frame results }

human.video(inputVideo); // start detection loop which continously updates results postDetect(); // start postDetect loop `

Does the above look correct? Thanks

vladmandic commented 1 year ago

regarding gestures, yes, that seems correct.

but i would not do any of the rest in the post-detection logic, i'd do it in detection logic itself that you can modify as needed. reason is that you want to plug in where it makes most sense - for example, if you're going to run custom emotion model, you want it to run on a already prepared face tensor, not get result, crop face, convert cropped image to tensor and then execute the model.

now, can you just "plug in" a custom emotion model? most likely no as each model has different input and output values which need to be parsed in an execution module.

there are high-level docs available at: https://github.com/vladmandic/human/wiki/Module

and in the future, please create a question under discussions, not an issue.