Hysen Labs
Open-source project
galihru/MentalHealth avatar
galihru

MentalHealth

A comprehensive mental health monitoring application using modern web technologies.

22 stars3 forksHTMLMIT
DEEP OPEN-SOURCE ANALYSIS

A face recognition mental health monitor built on facial landmarks

MentalHealth is an MIT-licensed web application that detects emotion from facial expressions and suggests resources based on the detected state.

What the application does

The MentalHealth project describes itself as a mental health monitoring application that uses modern web technologies and face recognition to read a person's emotional state. The README lists three primary features. The first is emotion detection, where the application analyzes a user's facial expressions to identify which emotion is present. The second is personalized recommendations, where the application supplies suggestions that respond to the emotional state it has measured. The third is professional integration, where the system can send a notification prompting the user to contact a mental health professional when that step seems warranted. Beyond the face pipeline, the README names the broader technology set behind the tool: face recognition, emotion detection, voice analysis, Internet of Things health sensing using a GSR sensor, the MAX30102 sensor, the BH1750 sensor, and an ESP32 microcontroller, plus a machine learning layer. The stated usage flow is straightforward. A user opens the application and grants camera and microphone access, lets the application analyze facial expressions, and then receives tailored recommendations based on the measured condition. The project frames itself as a monitoring and triage aid rather than a clinical diagnosis product, and it points users toward human professionals through its notification path. The README lists the broader technology set as face recognition, emotion detection, voice analysis, Internet of Things health sensing, and machine learning, which shows the project sits at the meeting point of several input modes.

How emotion detection is calculated

The README is unusually specific about the math that drives its emotion signals, which makes the project readable for someone who wants to understand the approach rather than treat it as a black box. A djb2 style hash function generates a unique FaceID from facial landmarks, starting from the constant 5381 and updating the value as hash equals hash times 33 plus the character code of each input character, then returning the result shifted right by zero as an unsigned 32-bit integer. Happiness draws on two measurements. Lip stretch uses the Euclidean distance between the left and right lip corners, computed from the squared differences of their x and y coordinates. Cheek raise uses the vertical distance between the cheek and eye landmarks. Sadness is measured through lip depression, the vertical distance between a lip corner and the bottom lip. Anger is captured by brow lowering, the vertical distance between the inner and outer brow landmarks. Surprise combines eye openness, the vertical distance between the eye and eyelid, with jaw drop, the vertical distance between the chin and nose. A final deviation from neutral sums the Euclidean distances between the facial landmarks, giving a single number that grows as the face moves away from a resting pose.

Installation and module usage

The project is distributed as a published npm package, which means a developer can use its detection functions inside another JavaScript application. The README shows installation with the command npm install dash g followed by the package name at galihridhoutomo slash mentalhealth. Once installed, the module can be imported either through CommonJS using require or through an ES module using import, so it fits both older and newer JavaScript build setups. The core function is detectEmotion, which takes an image path and returns a promise that resolves with a result object. The documented sample output is a small JSON object containing an emotion field, such as happy, and a confidence field, such as 0.92. For live camera use the README provides detectEmotionLive, which runs the same analysis against a video stream. Both functions accept an options object that can select a model of basic or advanced and set a confidence threshold, with 0.8 given as the example minimum. The README closes with a citation block crediting Galih Ridho Utomo and Ana Maulida and listing the year 2025, which anchors the work to a specific author team and publication date. The configurable options show the tool is meant for experimentation, letting a developer pick a basic or advanced model and set a confidence floor before acting on a result.

Editorial conclusion

The project is published under the MIT license and is recorded on GitHub with HTML as its primary language, 22 stars, and a most recent update on 2026-08-24.

DEEP OPEN-SOURCE ANALYSIS

Official sources

Community notes

Community notes