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 install
ornpm install
- Run
yarn start
orng serve
command for running this project - After that access in your browser
http://localhost:4200/
- Run
yarn build
orng build --base-href ./ --configuration production
command for build project
- Go to
THE_PROJECT/dist/face-detection/browser
- Run
npm install -g http-server
for installhttp-server
- After that run
npx http-server
command 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"
],