update docs

pull/46/head
Vladimir Mandic 2021-03-13 12:21:32 -05:00
parent e22ba62899
commit de7ef14bf5
14 changed files with 137 additions and 83 deletions

View File

@ -1,6 +1,6 @@
# @vladmandic/face-api
Version: **1.0.1**
Version: **1.0.2**
Description: **FaceAPI: AI-powered Face Detection, Face Embedding & Recognition Using Tensorflow/JS**
Author: **Vladimir Mandic <mandic00@live.com>**
@ -12,6 +12,12 @@ Repository: **<git+https://github.com/vladmandic/face-api.git>**
### **HEAD -> master** 2021/03/09 mandic00@live.com
### **1.0.2** 2021/03/09 mandic00@live.com
### **release: 1.0.1** 2021/03/09 mandic00@live.com
### **1.0.1** 2021/03/09 mandic00@live.com
- add badges

View File

@ -17,7 +17,6 @@
## Note
This is updated **face-api.js** with latest available TensorFlow/JS as the original face-api.js is not compatible with **tfjs 2.0+**.
Forked from [face-api.js](https://github.com/justadudewhohacks/face-api.js) version **0.22.2** which was released on March 22nd, 2020
Currently based on **`TensorFlow/JS` 3.3.0**
@ -27,36 +26,9 @@ Currently based on **`TensorFlow/JS` 3.3.0**
Because I needed Face-API that does not cause version conflict with newer TFJS 2.0 that I use accross my projects
And since original Face-API was open-source, I've released this version as well
Unfortunately, changes ended up being too large for a simple pull request on original Face-API and it ended up being a full-fledged version on its own
Changes ended up being too large for a simple pull request on original Face-API and it ended up being a full-fledged version on its own
### Differences
- Compatible with `TensorFlow/JS 2.0+ & 3.0+`
- Compatible with `WebGL`, `CPU` and `WASM` TFJS Browser backends
- Compatible with both `tfjs-node` and `tfjs-node-gpu` TFJS NodeJS backends
- Updated all type castings for TypeScript type checking to `TypeScript 4.1`
- Switched bundling from `UMD` to `ESM` + `CommonJS` with fallback to `IIFE`
Resulting code is optimized per-platform instead of being universal
Fully tree shakable when imported as an `ESM` module
Browser bundle process uses `ESBuild` instead of `Rollup`
- Typescript build process now targets `ES2018` and instead of dual ES5/ES6
Resulting code is clean ES2018 JavaScript without polyfills
- Removed old tests, docs, examples
- Removed old package dependencies (`karma`, `jasmine`, `babel`, etc.)
- Updated all package dependencies
- Updated TensorFlow/JS dependencies since backends were removed from `@tensorflow/tfjs-core`
- Updated mobileNetv1 model due to `batchNorm()` dependency
- Added `version` class that returns JSON object with version of FaceAPI as well as linked TFJS
- Added test/dev built-in HTTP & HTTPS Web server
- Removed `mtcnn` and `tinyYolov2` models as they were non-functional in latest public version of `Face-API`
*If there is a demand, I can re-implement them back.*
- Added `face angle` calculations that returns `roll`, `yaw` and `pitch`
Which means valid models are **tinyFaceDetector** and **mobileNetv1**
<br>
<hr>
<br>
<br><hr><br>
## Examples
@ -64,11 +36,14 @@ Which means valid models are **tinyFaceDetector** and **mobileNetv1**
### Browser
Browser example that uses static images and showcases both models as well as all of the extensions is included in `/example/index.html`
Example can be accessed directly using Git pages using URL: <https://vladmandic.github.io/face-api/example/index.html>
Browser example that uses static images and showcases both models
as well as all of the extensions is included in `/example/index.html`
Example can be accessed directly using Git pages using URL:
<https://vladmandic.github.io/face-api/example/index.html>
Browser example that uses live webcam is included in `/example/webcam.html`
Example can be accessed directly using Git pages using URL: <https://vladmandic.github.io/face-api/example/webcam.html>
Example can be accessed directly using Git pages using URL:
<https://vladmandic.github.io/face-api/example/webcam.html>
<br>
@ -121,9 +96,7 @@ Two NodeJS examples are:
Note that `@tensorflow/tfjs-node` or `@tensorflow/tfjs-node-gpu` must be installed before using NodeJS example
<br>
<hr>
<br>
<br><hr><br>
## Installation
@ -286,7 +259,10 @@ And then use with:
const faceapi = require('@vladmandic/face-api/dist/face-api.node-cpu.js');
```
If you want to use graphical functions inside NodeJS, you must provide appropriate graphical library as NodeJS does not include implementation for DOM elements such as HTMLImageElement or HTMLCanvasElement:
If you want to use graphical functions inside NodeJS,
you must provide appropriate graphical library as
NodeJS does not include implementation for DOM elements
such as HTMLImageElement or HTMLCanvasElement:
Install `Canvas` for NodeJS:
@ -410,6 +386,31 @@ npm run build
- [**Tutorial**](TUTORIAL.md)
- [**API Documentation**](https://justadudewhohacks.github.io/face-api.js/docs/globals.html)
## Differences
- Compatible with `TensorFlow/JS 2.0+ & 3.0+`
- Compatible with `WebGL`, `CPU` and `WASM` TFJS Browser backends
- Compatible with both `tfjs-node` and `tfjs-node-gpu` TFJS NodeJS backends
- Updated all type castings for TypeScript type checking to `TypeScript 4.1`
- Switched bundling from `UMD` to `ESM` + `CommonJS` with fallback to `IIFE`
Resulting code is optimized per-platform instead of being universal
Fully tree shakable when imported as an `ESM` module
Browser bundle process uses `ESBuild` instead of `Rollup`
- Typescript build process now targets `ES2018` and instead of dual ES5/ES6
Resulting code is clean ES2018 JavaScript without polyfills
- Removed old tests, docs, examples
- Removed old package dependencies (`karma`, `jasmine`, `babel`, etc.)
- Updated all package dependencies
- Updated TensorFlow/JS dependencies since backends were removed from `@tensorflow/tfjs-core`
- Updated mobileNetv1 model due to `batchNorm()` dependency
- Added `version` class that returns JSON object with version of FaceAPI as well as linked TFJS
- Added test/dev built-in HTTP & HTTPS Web server
- Removed `mtcnn` and `tinyYolov2` models as they were non-functional in latest public version of `Face-API`
*If there is a demand, I can re-implement them back.*
- Added `face angle` calculations that returns `roll`, `yaw` and `pitch`
Which means valid models are **tinyFaceDetector** and **mobileNetv1**
## Credits
- Original project: [Face-API](https://github.com/justadudewhohacks/face-api.js)

3
TODO.md Normal file
View File

@ -0,0 +1,3 @@
# To-do List for FaceAPI
- Improve examples and reference them in readme

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/face-api.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

108
package-lock.json generated
View File

@ -13,21 +13,21 @@
"@tensorflow/tfjs-backend-wasm": "^3.3.0",
"@tensorflow/tfjs-node": "^3.3.0",
"@tensorflow/tfjs-node-gpu": "^3.3.0",
"@types/node": "^14.14.33",
"@types/node": "^14.14.34",
"@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.17.0",
"@vladmandic/pilogger": "^0.2.14",
"chokidar": "^3.5.1",
"dayjs": "^1.10.4",
"esbuild": "^0.9.0",
"eslint": "^7.21.0",
"esbuild": "^0.9.2",
"eslint": "^7.22.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-json": "^2.1.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"rimraf": "^3.0.2",
"simple-git": "^2.36.1",
"simple-git": "^2.36.2",
"tslib": "^2.1.0",
"typescript": "^4.2.3"
},
@ -413,9 +413,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "14.14.33",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.33.tgz",
"integrity": "sha512-oJqcTrgPUF29oUP8AsUqbXGJNuPutsetaa9kTQAQce5Lx5dTYWV02ScBiT/k1BX/Z7pKeqedmvp39Wu4zR7N7g==",
"version": "14.14.34",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.34.tgz",
"integrity": "sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA==",
"dev": true
},
"node_modules/@types/node-fetch": {
@ -1237,9 +1237,9 @@
}
},
"node_modules/esbuild": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.9.0.tgz",
"integrity": "sha512-IqYFO7ZKHf0y4uJpJfGqInmSRn8jMPMbyI1W0Y2PSjSjJcVP538tC8TleJAS4Y8QeqwajqBTwFKayWVzYlMIgg==",
"version": "0.9.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.9.2.tgz",
"integrity": "sha512-xE3oOILjnmN8PSjkG3lT9NBbd1DbxNqolJ5qNyrLhDWsFef3yTp/KTQz1C/x7BYFKbtrr9foYtKA6KA1zuNAUQ==",
"dev": true,
"hasInstallScript": true,
"bin": {
@ -1265,9 +1265,9 @@
}
},
"node_modules/eslint": {
"version": "7.21.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.21.0.tgz",
"integrity": "sha512-W2aJbXpMNofUp0ztQaF40fveSsJBjlSCSWpy//gzfTvwC+USs/nceBrKmlJOiM8r1bLwP2EuYkCqArn/6QTIgg==",
"version": "7.22.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.22.0.tgz",
"integrity": "sha512-3VawOtjSJUQiiqac8MQc+w457iGLfuNGLFn8JmF051tTKbh5/x/0vlcEj8OgDCaw7Ysa2Jn8paGshV7x2abKXg==",
"dev": true,
"dependencies": {
"@babel/code-frame": "7.12.11",
@ -1287,7 +1287,7 @@
"file-entry-cache": "^6.0.1",
"functional-red-black-tree": "^1.0.1",
"glob-parent": "^5.0.0",
"globals": "^12.1.0",
"globals": "^13.6.0",
"ignore": "^4.0.6",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
@ -1295,7 +1295,7 @@
"js-yaml": "^3.13.1",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1",
"lodash": "^4.17.20",
"lodash": "^4.17.21",
"minimatch": "^3.0.4",
"natural-compare": "^1.4.0",
"optionator": "^0.9.1",
@ -1569,6 +1569,33 @@
"node": ">=10"
}
},
"node_modules/eslint/node_modules/globals": {
"version": "13.6.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.6.0.tgz",
"integrity": "sha512-YFKCX0SiPg7l5oKYCJ2zZGxcXprVXHcSnVuvzrT3oSENQonVLqM5pf9fN5dLGZGyCjhw8TN8Btwe/jKnZ0pjvQ==",
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eslint/node_modules/type-fest": {
"version": "0.20.2",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
"integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
"dev": true,
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/espree": {
"version": "7.3.1",
"resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz",
@ -3292,9 +3319,9 @@
"dev": true
},
"node_modules/simple-git": {
"version": "2.36.1",
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-2.36.1.tgz",
"integrity": "sha512-bN18Ea/4IJgqgbZyE9VpVEUkAu9vyP0VWP7acP0CRC1p/N80GGJ0HhIVeFJsm8TdJLBowiJpdLesQuAZ5TFSKw==",
"version": "2.36.2",
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-2.36.2.tgz",
"integrity": "sha512-orBEf65GfSiQMsYedbJXSiRNnIRvhbeE5rrxZuEimCpWxDZOav0KLy2IEiPi1YJCF+zaC2quiJF8A4TsxI9/tw==",
"dev": true,
"dependencies": {
"@kwsites/file-exists": "^1.1.1",
@ -4230,9 +4257,9 @@
"dev": true
},
"@types/node": {
"version": "14.14.33",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.33.tgz",
"integrity": "sha512-oJqcTrgPUF29oUP8AsUqbXGJNuPutsetaa9kTQAQce5Lx5dTYWV02ScBiT/k1BX/Z7pKeqedmvp39Wu4zR7N7g==",
"version": "14.14.34",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.34.tgz",
"integrity": "sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA==",
"dev": true
},
"@types/node-fetch": {
@ -4835,9 +4862,9 @@
}
},
"esbuild": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.9.0.tgz",
"integrity": "sha512-IqYFO7ZKHf0y4uJpJfGqInmSRn8jMPMbyI1W0Y2PSjSjJcVP538tC8TleJAS4Y8QeqwajqBTwFKayWVzYlMIgg==",
"version": "0.9.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.9.2.tgz",
"integrity": "sha512-xE3oOILjnmN8PSjkG3lT9NBbd1DbxNqolJ5qNyrLhDWsFef3yTp/KTQz1C/x7BYFKbtrr9foYtKA6KA1zuNAUQ==",
"dev": true
},
"escalade": {
@ -4853,9 +4880,9 @@
"dev": true
},
"eslint": {
"version": "7.21.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.21.0.tgz",
"integrity": "sha512-W2aJbXpMNofUp0ztQaF40fveSsJBjlSCSWpy//gzfTvwC+USs/nceBrKmlJOiM8r1bLwP2EuYkCqArn/6QTIgg==",
"version": "7.22.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.22.0.tgz",
"integrity": "sha512-3VawOtjSJUQiiqac8MQc+w457iGLfuNGLFn8JmF051tTKbh5/x/0vlcEj8OgDCaw7Ysa2Jn8paGshV7x2abKXg==",
"dev": true,
"requires": {
"@babel/code-frame": "7.12.11",
@ -4875,7 +4902,7 @@
"file-entry-cache": "^6.0.1",
"functional-red-black-tree": "^1.0.1",
"glob-parent": "^5.0.0",
"globals": "^12.1.0",
"globals": "^13.6.0",
"ignore": "^4.0.6",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
@ -4883,7 +4910,7 @@
"js-yaml": "^3.13.1",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1",
"lodash": "^4.17.20",
"lodash": "^4.17.21",
"minimatch": "^3.0.4",
"natural-compare": "^1.4.0",
"optionator": "^0.9.1",
@ -4895,6 +4922,23 @@
"table": "^6.0.4",
"text-table": "^0.2.0",
"v8-compile-cache": "^2.0.3"
},
"dependencies": {
"globals": {
"version": "13.6.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.6.0.tgz",
"integrity": "sha512-YFKCX0SiPg7l5oKYCJ2zZGxcXprVXHcSnVuvzrT3oSENQonVLqM5pf9fN5dLGZGyCjhw8TN8Btwe/jKnZ0pjvQ==",
"dev": true,
"requires": {
"type-fest": "^0.20.2"
}
},
"type-fest": {
"version": "0.20.2",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
"integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
"dev": true
}
}
},
"eslint-config-airbnb-base": {
@ -6416,9 +6460,9 @@
"dev": true
},
"simple-git": {
"version": "2.36.1",
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-2.36.1.tgz",
"integrity": "sha512-bN18Ea/4IJgqgbZyE9VpVEUkAu9vyP0VWP7acP0CRC1p/N80GGJ0HhIVeFJsm8TdJLBowiJpdLesQuAZ5TFSKw==",
"version": "2.36.2",
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-2.36.2.tgz",
"integrity": "sha512-orBEf65GfSiQMsYedbJXSiRNnIRvhbeE5rrxZuEimCpWxDZOav0KLy2IEiPi1YJCF+zaC2quiJF8A4TsxI9/tw==",
"dev": true,
"requires": {
"@kwsites/file-exists": "^1.1.1",

View File

@ -44,21 +44,21 @@
"@tensorflow/tfjs-backend-wasm": "^3.3.0",
"@tensorflow/tfjs-node": "^3.3.0",
"@tensorflow/tfjs-node-gpu": "^3.3.0",
"@types/node": "^14.14.33",
"@types/node": "^14.14.34",
"@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.17.0",
"@vladmandic/pilogger": "^0.2.14",
"chokidar": "^3.5.1",
"dayjs": "^1.10.4",
"esbuild": "^0.9.0",
"eslint": "^7.21.0",
"esbuild": "^0.9.2",
"eslint": "^7.22.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-json": "^2.1.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"rimraf": "^3.0.2",
"simple-git": "^2.36.1",
"simple-git": "^2.36.2",
"tslib": "^2.1.0",
"typescript": "^4.2.3"
}