This is a sample code of Face-api.js in Angular, here am using Angular v17.
Face-api.js is a JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js
- Smile Detection
- Blink (Eyes) Detection
- Mount Detection
- Head Pose
- Age and Gender
- Angular v17.3.0
- Face-api.js v0.22.2
- More see package.json
- Clone this repo
yarn installornpm install- Run
yarn startorng servecommand for running this project - After that access in your browser
http://localhost:4200/
- Run
yarn buildorng build --base-href ./ --configuration productioncommand for build project
- Go to
THE_PROJECT/dist/face-detection/browser - Run
npm install -g http-serverfor installhttp-server - After that run
npx http-servercommand for running build result file
You can call the startVideo() method to start scanning the face manually. and call the stopVideo() method to stop scanning manually.
You can see all models data Here
Put this after devDependencies to remove warning messages when run or build a project.
"browser": {
"fs": false,
"os": false,
"path": false
}Put this on architect > build > options to remove warning messages when run or build a project.
"allowedCommonJsDependencies": [
"fast-deep-equal",
"css.escape",
"path-intersection",
"selection-update",
"@tensorflow/tfjs-core"
],