From d82c04870d3d149cf7d56c0d5fdd849f5b4b8789 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Wed, 2 Dec 2020 15:56:29 -0500 Subject: [PATCH] push --- README copy.md | 227 ++++++++++++++++++++++++++++++++++++++++ build.js | 177 +++++++++++++++++++++++++++++++ package-lock.json | 52 ++++++--- package.json | 3 +- src/tfjs/tf-browser.js | 44 ++++++++ src/tfjs/tf-node-gpu.js | 1 + src/tfjs/tf-node.js | 1 + 7 files changed, 490 insertions(+), 15 deletions(-) create mode 100644 README copy.md create mode 100644 build.js create mode 100644 src/tfjs/tf-browser.js create mode 100644 src/tfjs/tf-node-gpu.js create mode 100644 src/tfjs/tf-node.js diff --git a/README copy.md b/README copy.md new file mode 100644 index 0000000..abbf716 --- /dev/null +++ b/README copy.md @@ -0,0 +1,227 @@ +# FaceAPI + +## 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** version **0.22.2** released on March 22nd, 2020 + +- +- + +Currently based on **`TensorFlow/JS` 2.7.0** +If you want to access `TFJS` classes and methods directly, they are exported as `faceapi.tf` + +### Why? + +Because I needed FaceAPI that does not cause version conflict with newer TFJS 2.0 that I use accross my projects +And since original FaceAPI was open-source, I've released this version as well +Unfortunately, changes ended up being too large for a simple pull request on original FaceaPI and it ended up being a full-fledged version on its own + +### Differences + +- Compatible with `TensorFlow/JS 2.0+` +- Compatible with `WebGL`, `CPU` and `WASM` TFJS backends +- Updated all type castings for TypeScript type checking to `TypeScript 4.1` +- Switched bundling from `UMD` to `ESM` + `CommonJS` + This does require separate process for usage in NodeJS vs Browser, but resulting code is much lighter + 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 +- 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.* + +Which means valid models are **tinyFaceDetector** and **mobileNetv1** + +## Installation + +Face-API ships with several pre-build versions of the library: +- `dist/face-api.js`: IIFE format for client-side Browser execution *with* TFJS pre-bundled +- `dist/face-api.esm.js`: ESM format for client-side Browser execution *with* TFJS pre-bundled +- `dist/face-api.esm.nobundle.js`: ESM format for client-side Browser execution *without* TFJS pre-bundled +- `dist/face-api.node.js`: CommonJS format for server-side NodeJS execution *without* TFJS pre-bundled + +Defaults are: +```json +{ + "main": "dist/face-api.cjs", + "module": "dist/face-api.esm.js", + "browser": "dist/face-api.esm.js", +} +``` + +Reason for additional `nobundle` version is if you want to include a specific version of TFJS and not rely on pre-packaged one +`FaceAPI` is compatible with TFJS 2.0+ + +Bundled versions are ~1.1MB minified and non-bundled versions are ~169KB non-minified +All versions include `sourcemap` + +There are several ways to use Face-API: + +### 1. IIFE script + +*Recommened for quick tests and backward compatibility with older Browsers that do not support ESM such as IE* + +This is simplest way for usage within Browser +Simply download `dist/face-api.js`, include it in your `HTML` file & it's ready to use + +```html +