diff --git a/README.md b/README.md index 1ea99cb..4cf328b 100644 --- a/README.md +++ b/README.md @@ -12,27 +12,57 @@ Forked from **face-api.js** version **0.22.2** released on March 22nd, 2020 Currently based on **`TensorFlow/JS` 2.6.0** If you want to access `TFJS` classes and methods directly, they are exported as `faceapi.tf` -## Differences +### Why? -- Updated all type castings for TypeScript type checking to TypeScript 4.1 -- Typescript build process now targets ES2018 and instead of dual ES5/ES6 -- Compatible with TensorFlow/JS 2.0+ +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+` +- 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 unnecesary package dependencies (karma, jasmine, etc.) +- Removed old package dependencies (`karma`, `jasmine`, `babel`, etc.) - Updated all package dependencies -- Browser bundle process uses ESBuild instead of Rollup -- New TensorFlow/JS dependencies since backends were removed from @tensorflow/tfjs-core -- Updated mobileNetv1 model due to batchNorm() dependency -- Fully tree shakable when imported as an ESM module -- Added `version` class that returns JSON object with version of FaceAPI as well as linked TFJS -- Removed following models as they are either obsolete or non-functional with tfjs 2.0+ - - mtcnn: Obsolete - - tinyYolov2: Non-functional since weights are missing +- 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 exeuction +- `dist/face-api.esm.js`: ESM format for client-side Browser execution with TFJS pre-bundled +- `dist/face-api.nobundle.js`: ESM format for client-side Browser execution without TFJS and not minified +- `dist/face-api.cjs`: CommonJS format for server-side NodeJS execution with TFJS pre-bundled +- `dist/face-api.nobundle.cjs`: CommonJS format for server-side NodeJS execution without TFJS and not minified + +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 @@ -46,13 +76,13 @@ Simply download `dist/face-api.js`, include it in your `HTML` file & it's ready