let analysis = try Mentalist.analyze(image: Image("my_face")).first!
print("The emotion on your face is... '\(analysis.dominantEmotion)!'")
// "The emotion on your face is... 'happy'!
Mentalist is a Swift-based library designed for analyzing and identifying emotions within a picture.
Mentalist classifies the emotions on faces in a photo into one of seven categories. Internally, it utilizes a CoreML model based on FER2013 to analyze emotions displayed in a picture into seven categories: 'happy', 'angry', 'disgust', 'fear', 'sad', 'surprise', and 'neutral'.
Mentalist has an optimal size for mobile environments. It also takes approximately 0.06 seconds per analysis with an accuracy rate of about 57%.
Mentalist can detect multiple faces. If multiple faces are detected, it returns a list of multiple analysis results.
Follow these steps to install Mentalist using SPM:
- From within Xcode 13 or later, choose File > Swift Packages > Add Package Dependency.
- At the next screen, enter the URL for the Mentalist repository(https://github.com/enebin/Mentalist) in the search bar then click Next.
- For the version rule, select 'Up to Next Minor' and specify the current Mentalist version then click 'Next'.
- On the final screen, select the Mentalist library and then click 'Finish'.
Mentalist should now be integrated into your project 🚀.
import Mentalist
let analysis = try Mentalist.analyze(image: Image("my_face"))
Done!
We welcome contributions to Mentalist! If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
Mentalist is released under the MIT License. See LICENSE for details.
For any questions or suggestions, please feel free to contact me. My email's on my Github profile.