2022-04-06 09:10:31 +00:00
|
|
|
export const FACE_EXPRESSIONS_EMOJIS = {
|
2021-11-17 14:33:03 +00:00
|
|
|
happy: '😊',
|
|
|
|
neutral: '😐',
|
|
|
|
sad: '🙁',
|
|
|
|
surprised: '😮',
|
|
|
|
angry: '😠',
|
2021-12-28 14:35:21 +00:00
|
|
|
fearful: '😨'
|
|
|
|
|
|
|
|
// disgusted: '🤢'
|
2021-11-17 14:33:03 +00:00
|
|
|
};
|
2021-12-21 11:46:54 +00:00
|
|
|
|
2022-04-06 09:10:31 +00:00
|
|
|
export const FACE_EXPRESSIONS = [ 'happy', 'neutral', 'sad', 'surprised', 'angry', 'fearful' ];
|
2021-12-28 14:35:21 +00:00
|
|
|
|
2022-05-06 12:41:08 +00:00
|
|
|
export const FACE_EXPRESSIONS_NAMING_MAPPING = {
|
|
|
|
happy: 'happy',
|
|
|
|
neutral: 'neutral',
|
|
|
|
surprise: 'surprised',
|
|
|
|
angry: 'angry',
|
|
|
|
fear: 'fearful',
|
|
|
|
disgust: 'disgusted',
|
|
|
|
sad: 'sad'
|
|
|
|
};
|
|
|
|
|
2021-12-21 11:46:54 +00:00
|
|
|
/**
|
|
|
|
* Time is ms used for sending expression.
|
|
|
|
*/
|
|
|
|
export const WEBHOOK_SEND_TIME_INTERVAL = 15000;
|
2022-02-04 07:14:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Type of message sent from main thread to worker that contains init information:
|
|
|
|
* such as models directory and window screen size.
|
|
|
|
*/
|
|
|
|
export const INIT_WORKER = 'INIT_WORKER';
|
|
|
|
|
|
|
|
/**
|
2022-04-04 13:09:14 +00:00
|
|
|
* Type of event sent on the data channel.
|
2022-02-04 07:14:52 +00:00
|
|
|
*/
|
2022-04-04 13:09:14 +00:00
|
|
|
export const FACE_BOX_EVENT_TYPE = 'face-box';
|
2022-02-04 07:14:52 +00:00
|
|
|
|
2022-11-22 13:56:37 +00:00
|
|
|
/**
|
|
|
|
* Type of event sent on the data channel.
|
|
|
|
*/
|
|
|
|
export const FACE_LANDMARKS_EVENT_TYPE = 'face-landmarks';
|
|
|
|
|
2022-02-04 07:14:52 +00:00
|
|
|
/**
|
2022-08-30 14:21:58 +00:00
|
|
|
* Milliseconds interval value for sending new image data to the worker.
|
2022-02-04 07:14:52 +00:00
|
|
|
*/
|
2022-04-04 13:09:14 +00:00
|
|
|
export const SEND_IMAGE_INTERVAL_MS = 1000;
|
2022-02-04 07:14:52 +00:00
|
|
|
|
|
|
|
/**
|
2022-04-04 13:09:14 +00:00
|
|
|
* Type of message sent from main thread to worker that contain image data and
|
|
|
|
* will trigger a response message from the worker containing the detected face(s) info.
|
2022-02-04 07:14:52 +00:00
|
|
|
*/
|
2022-04-04 13:09:14 +00:00
|
|
|
export const DETECT_FACE = 'DETECT_FACE';
|
2022-02-04 07:14:52 +00:00
|
|
|
|
|
|
|
/**
|
2022-04-04 13:09:14 +00:00
|
|
|
* Available detection types.
|
2022-02-04 07:14:52 +00:00
|
|
|
*/
|
2022-04-04 13:09:14 +00:00
|
|
|
export const DETECTION_TYPES = {
|
|
|
|
FACE_BOX: 'face-box',
|
|
|
|
FACE_EXPRESSIONS: 'face-expressions'
|
|
|
|
};
|
2022-06-10 12:19:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Threshold for detection score of face.
|
|
|
|
*/
|
2022-09-14 12:42:46 +00:00
|
|
|
export const FACE_DETECTION_SCORE_THRESHOLD = 0.75;
|
2022-09-22 10:06:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Threshold for stopping detection after a certain number of consecutive errors have occurred.
|
|
|
|
*/
|
2022-11-22 13:56:37 +00:00
|
|
|
export const FACE_LANDMARKS_DETECTION_ERROR_THRESHOLD = 4;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Threshold for number of consecutive detections with no face,
|
|
|
|
* so that when achieved there will be dispatched an action.
|
|
|
|
*/
|
|
|
|
export const NO_FACE_DETECTION_THRESHOLD = 5;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constant type used for signaling that no valid face detection is found.
|
|
|
|
*/
|
|
|
|
export const NO_DETECTION = 'no-detection';
|