update tfjs and expand readme
parent
2841969df8
commit
8c7e21b1c9
|
@ -9,12 +9,15 @@
|
|||
|
||||
## Changelog
|
||||
|
||||
### **1.6.4** 2022/01/14 mandic00@live.com
|
||||
|
||||
|
||||
### **origin/master** 2022/01/06 mandic00@live.com
|
||||
|
||||
|
||||
### **1.6.3** 2022/01/06 mandic00@live.com
|
||||
|
||||
|
||||
### **origin/master** 2022/01/01 mandic00@live.com
|
||||
|
||||
|
||||
### **1.6.2** 2022/01/01 mandic00@live.com
|
||||
|
||||
|
||||
|
|
143
README.md
143
README.md
|
@ -53,15 +53,18 @@ Example can be accessed directly using Git pages using URL:
|
|||
|
||||
### NodeJS
|
||||
|
||||
Three NodeJS examples are:
|
||||
NodeJS examples are:
|
||||
|
||||
- `/demp/node-simple.js`:
|
||||
Simplest possible NodeJS demo for FaceAPI in under 30 lines of JavaScript code
|
||||
- `/demo/node.js`:
|
||||
Regular usage of `FaceAPI` from `NodeJS`
|
||||
Using `TFJS` native methods to load images without external dependencies
|
||||
- `/demo/node-canvas.js`:
|
||||
Regular usage of `FaceAPI` from `NodeJS`
|
||||
- `/demo/node-canvas.js` and `/demo/node-image.js`:
|
||||
Using external `canvas` module to load images
|
||||
Which also allows for image drawing and saving inside `NodeJS` environment
|
||||
- `/demo/node-match.js`:
|
||||
Simple demo that compares face similarity from a given image
|
||||
to a second image or list of images in a folder
|
||||
- `/demo/node-multiprocess.js`:
|
||||
Multiprocessing showcase that uses pool of worker processes
|
||||
(`node-multiprocess-worker.js`)
|
||||
|
@ -102,7 +105,7 @@ Three NodeJS examples are:
|
|||
```
|
||||
|
||||
Note that `@tensorflow/tfjs-node` or `@tensorflow/tfjs-node-gpu`
|
||||
must be installed before using NodeJS example
|
||||
must be installed before using any **NodeJS** examples
|
||||
|
||||
<br><hr><br>
|
||||
|
||||
|
@ -323,44 +326,46 @@ By default it starts HTTP server on port 8000 and HTTPS server on port 8001 and
|
|||
- <https://localhost:8001/demo/webcam.html>
|
||||
|
||||
```js
|
||||
2021-09-08 13:41:06 INFO: @vladmandic/face-api version 1.4.2
|
||||
2021-09-08 13:41:06 INFO: User: vlado Platform: linux Arch: x64 Node: v16.8.0
|
||||
2021-09-08 13:41:06 INFO: Application: { name: '@vladmandic/face-api', version: '1.4.2' }
|
||||
2021-09-08 13:41:06 INFO: Environment: { profile: 'development', config: 'build.json', tsconfig: true, eslintrc: true, git: true }
|
||||
2021-09-08 13:41:06 INFO: Toolchain: { esbuild: '0.12.25', typescript: '4.4.2', typedoc: '0.21.9', eslint: '7.32.0' }
|
||||
2021-09-08 13:41:06 STATE: WebServer: { ssl: false, port: 8000, root: '.' }
|
||||
2021-09-08 13:41:06 STATE: WebServer: { ssl: true, port: 8001, root: '.', sslKey: '/home/vlado/dev/build/cert/https.key', sslCrt: '/home/vlado/dev/build/cert/https.crt' }
|
||||
2021-09-08 13:41:06 STATE: Watch: { locations: [ 'test/src/**', 'src/**' ] }
|
||||
2021-09-08 13:41:06 STATE: Build: { type: 'development', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 143, outputBytes: 1322 }
|
||||
2021-09-08 13:41:06 STATE: Build: { type: 'development', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node.js', files: 162, inputBytes: 234423, outputBytes: 175260 }
|
||||
2021-09-08 13:41:06 STATE: Build: { type: 'development', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node-gpu.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 147, outputBytes: 1330 }
|
||||
2021-09-08 13:41:06 STATE: Build: { type: 'development', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node-gpu.js', files: 162, inputBytes: 234431, outputBytes: 175268 }
|
||||
2021-09-08 13:41:06 STATE: Build: { type: 'development', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node-cpu.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 138, outputBytes: 1321 }
|
||||
2021-09-08 13:41:06 STATE: Build: { type: 'development', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node-cpu.js', files: 162, inputBytes: 234422, outputBytes: 175259 }
|
||||
2021-09-08 13:41:06 STATE: Build: { type: 'development', format: 'esm', platform: 'browser', input: 'src/tfjs/tf-browser.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 276, outputBytes: 272 }
|
||||
2021-09-08 13:41:06 STATE: Build: { type: 'development', format: 'esm', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.esm-nobundle.js', files: 162, inputBytes: 233373, outputBytes: 169020 }
|
||||
2021-09-08 13:41:07 STATE: Build: { type: 'development', format: 'esm', platform: 'browser', input: 'src/tfjs/tf-browser.ts', output: 'dist/tfjs.esm.js', files: 7, inputBytes: 276, outputBytes: 2371544 }
|
||||
2021-09-08 13:41:07 STATE: Build: { type: 'development', format: 'iife', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.js', files: 162, inputBytes: 2604645, outputBytes: 2486481 }
|
||||
2021-09-08 13:41:07 STATE: Build: { type: 'development', format: 'esm', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.esm.js', files: 162, inputBytes: 2604645, outputBytes: 2369658 }
|
||||
.
|
||||
.
|
||||
2021-09-08 13:41:14 DATA: GET/2.0 200 text/html; charset=utf-8 1047 /demo/index.html ::1
|
||||
2021-09-08 13:41:14 DATA: GET/2.0 200 text/javascript; charset=utf-8 6898 /demo/index.js ::1
|
||||
2021-09-08 13:41:14 DATA: GET/2.0 200 text/javascript; charset=utf-8 2369658 /dist/face-api.esm.js ::1
|
||||
2021-09-08 13:41:14 DATA: GET/2.0 200 application/octet-stream 6341199 /dist/face-api.esm.js.map ::1
|
||||
2021-09-08 13:41:14 DATA: GET/2.0 200 application/json; charset=utf-8 3219 /model/tiny_face_detector_model-weights_manifest.json ::1
|
||||
2021-09-08 13:41:15 DATA: GET/2.0 200 application/octet-stream 193321 /model/tiny_face_detector_model.bin ::1
|
||||
2021-09-08 13:41:15 DATA: GET/2.0 200 application/json; charset=utf-8 28233 /model/ssd_mobilenetv1_model-weights_manifest.json ::1
|
||||
2021-09-08 13:41:15 DATA: GET/2.0 200 application/octet-stream 5616957 /model/ssd_mobilenetv1_model.bin ::1
|
||||
2021-09-08 13:41:15 DATA: GET/2.0 200 application/json; charset=utf-8 8392 /model/age_gender_model-weights_manifest.json ::1
|
||||
2021-09-08 13:41:15 DATA: GET/2.0 200 application/octet-stream 429708 /model/age_gender_model.bin ::1
|
||||
2021-09-08 13:41:15 DATA: GET/2.0 200 application/json; charset=utf-8 8485 /model/face_landmark_68_model-weights_manifest.json ::1
|
||||
2021-09-08 13:41:15 DATA: GET/2.0 200 application/octet-stream 356840 /model/face_landmark_68_model.bin ::1
|
||||
2021-09-08 13:41:15 DATA: GET/2.0 200 application/json; charset=utf-8 19615 /model/face_recognition_model-weights_manifest.json ::1
|
||||
2021-09-08 13:41:15 DATA: GET/2.0 200 application/octet-stream 6444032 /model/face_recognition_model.bin ::1
|
||||
2021-09-08 13:41:16 DATA: GET/2.0 200 application/json; charset=utf-8 6980 /model/face_expression_model-weights_manifest.json ::1
|
||||
2021-09-08 13:41:16 DATA: GET/2.0 200 application/octet-stream 329468 /model/face_expression_model.bin ::1
|
||||
2021-09-08 13:41:16 DATA: GET/2.0 200 image/jpg 144516 /demo/sample1.jpg ::1
|
||||
2022-01-14 09:56:19 INFO: @vladmandic/face-api version 1.6.4
|
||||
2022-01-14 09:56:19 INFO: User: vlado Platform: linux Arch: x64 Node: v17.2.0
|
||||
2022-01-14 09:56:19 INFO: Application: { name: '@vladmandic/face-api', version: '1.6.4' }
|
||||
2022-01-14 09:56:19 INFO: Environment: { profile: 'development', config: '.build.json', package: 'package.json', tsconfig: true, eslintrc: true, git: true }
|
||||
2022-01-14 09:56:19 INFO: Toolchain: { build: '0.6.7', esbuild: '0.14.11', typescript: '4.5.4', typedoc: '0.22.10', eslint: '8.6.0' }
|
||||
2022-01-14 09:56:19 INFO: Build: { profile: 'development', steps: [ 'serve', 'watch', 'compile' ] }
|
||||
2022-01-14 09:56:19 STATE: WebServer: { ssl: false, port: 8000, root: '.' }
|
||||
2022-01-14 09:56:19 STATE: WebServer: { ssl: true, port: 8001, root: '.', sslKey: 'build/cert/https.key', sslCrt: 'build/cert/https.crt' }
|
||||
2022-01-14 09:56:19 STATE: Watch: { locations: [ 'src/**', 'README.md', 'src/**', 'src/**' ] }
|
||||
2022-01-14 09:56:19 STATE: Compile: { name: 'tfjs/node/cpu', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 143, outputBytes: 1276 }
|
||||
2022-01-14 09:56:19 STATE: Compile: { name: 'faceapi/node/cpu', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node.js', files: 162, inputBytes: 234787, outputBytes: 175203 }
|
||||
2022-01-14 09:56:19 STATE: Compile: { name: 'tfjs/node/gpu', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node-gpu.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 147, outputBytes: 1296 }
|
||||
2022-01-14 09:56:19 STATE: Compile: { name: 'faceapi/node/gpu', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node-gpu.js', files: 162, inputBytes: 234807, outputBytes: 175219 }
|
||||
2022-01-14 09:56:19 STATE: Compile: { name: 'tfjs/node/wasm', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node-wasm.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 185, outputBytes: 1367 }
|
||||
2022-01-14 09:56:19 STATE: Compile: { name: 'faceapi/node/wasm', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node-wasm.js', files: 162, inputBytes: 234878, outputBytes: 175294 }
|
||||
2022-01-14 09:56:19 STATE: Compile: { name: 'tfjs/browser/tf-version', format: 'esm', platform: 'browser', input: 'src/tfjs/tf-version.ts', output: 'dist/tfjs.version.js', files: 1, inputBytes: 1063, outputBytes: 1662 }
|
||||
2022-01-14 09:56:19 STATE: Compile: { name: 'tfjs/browser/esm/nobundle', format: 'esm', platform: 'browser', input: 'src/tfjs/tf-browser.ts', output: 'dist/tfjs.esm.js', files: 2, inputBytes: 2172, outputBytes: 811 }
|
||||
2022-01-14 09:56:19 STATE: Compile: { name: 'faceapi/browser/esm/nobundle', format: 'esm', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.esm-nobundle.js', files: 162, inputBytes: 234322, outputBytes: 169437 }
|
||||
2022-01-14 09:56:19 STATE: Compile: { name: 'tfjs/browser/esm/bundle', format: 'esm', platform: 'browser', input: 'src/tfjs/tf-browser.ts', output: 'dist/tfjs.esm.js', files: 11, inputBytes: 2172, outputBytes: 2444105 }
|
||||
2022-01-14 09:56:20 STATE: Compile: { name: 'faceapi/browser/iife/bundle', format: 'iife', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.js', files: 162, inputBytes: 2677616, outputBytes: 1252572 }
|
||||
2022-01-14 09:56:20 STATE: Compile: { name: 'faceapi/browser/esm/bundle', format: 'esm', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.esm.js', files: 162, inputBytes: 2677616, outputBytes: 2435063 }
|
||||
2022-01-14 09:56:20 INFO: Listening...
|
||||
...
|
||||
2022-01-14 09:56:46 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'text/html', size: 1047, url: '/', remote: '::1' }
|
||||
2022-01-14 09:56:46 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'text/javascript', size: 6919, url: '/index.js', remote: '::1' }
|
||||
2022-01-14 09:56:46 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'text/javascript', size: 2435063, url: '/dist/face-api.esm.js', remote: '::1' }
|
||||
2022-01-14 09:56:47 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/octet-stream', size: 4125244, url: '/dist/face-api.esm.js.map', remote: '::1' }
|
||||
2022-01-14 09:56:47 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/json', size: 3219, url: '/model/tiny_face_detector_model-weights_manifest.json', remote: '::1' }
|
||||
2022-01-14 09:56:47 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/octet-stream', size: 193321, url: '/model/tiny_face_detector_model.bin', remote: '::1' }
|
||||
2022-01-14 09:56:47 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/json', size: 28233, url: '/model/ssd_mobilenetv1_model-weights_manifest.json', remote: '::1' }
|
||||
2022-01-14 09:56:47 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/octet-stream', size: 5616957, url: '/model/ssd_mobilenetv1_model.bin', remote: '::1' }
|
||||
2022-01-14 09:56:48 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/json', size: 8392, url: '/model/age_gender_model-weights_manifest.json', remote: '::1' }
|
||||
2022-01-14 09:56:48 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/octet-stream', size: 429708, url: '/model/age_gender_model.bin', remote: '::1' }
|
||||
2022-01-14 09:56:48 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/json', size: 8485, url: '/model/face_landmark_68_model-weights_manifest.json', remote: '::1' }
|
||||
2022-01-14 09:56:48 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/octet-stream', size: 356840, url: '/model/face_landmark_68_model.bin', remote: '::1' }
|
||||
2022-01-14 09:56:48 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/json', size: 19615, url: '/model/face_recognition_model-weights_manifest.json', remote: '::1' }
|
||||
2022-01-14 09:56:48 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/octet-stream', size: 6444032, url: '/model/face_recognition_model.bin', remote: '::1' }
|
||||
2022-01-14 09:56:48 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/json', size: 6980, url: '/model/face_expression_model-weights_manifest.json', remote: '::1' }
|
||||
2022-01-14 09:56:48 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'application/octet-stream', size: 329468, url: '/model/face_expression_model.bin', remote: '::1' }
|
||||
2022-01-14 09:56:48 DATA: HTTPS: { method: 'GET', ver: '2.0', status: 200, mime: 'image/jpeg', size: 144516, url: '/sample1.jpg', remote: '::1' }
|
||||
```
|
||||
|
||||
<br><hr><br>
|
||||
|
@ -396,28 +401,31 @@ Build process uses `@vladmandic/build` module that creates optimized build for e
|
|||
```
|
||||
|
||||
```js
|
||||
2021-09-08 13:40:19 INFO: @vladmandic/face-api version 1.4.2
|
||||
2021-09-08 13:40:19 INFO: User: vlado Platform: linux Arch: x64 Node: v16.8.0
|
||||
2021-09-08 13:40:19 INFO: Application: { name: '@vladmandic/face-api', version: '1.4.2' }
|
||||
2021-09-08 13:40:19 INFO: Environment: { profile: 'production', config: 'build.json', tsconfig: true, eslintrc: true, git: true }
|
||||
2021-09-08 13:40:19 INFO: Toolchain: { esbuild: '0.12.25', typescript: '4.4.2', typedoc: '0.21.9', eslint: '7.32.0' }
|
||||
2021-09-08 13:40:19 STATE: Clean: { locations: [ 'dist/*', 'types/*', 'typedoc/*', [length]: 3 ] }
|
||||
2021-09-08 13:40:19 STATE: Build: { type: 'production', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 143, outputBytes: 1322 }
|
||||
2021-09-08 13:40:19 STATE: Build: { type: 'production', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node.js', files: 162, inputBytes: 234423, outputBytes: 175260 }
|
||||
2021-09-08 13:40:19 STATE: Build: { type: 'production', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node-gpu.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 147, outputBytes: 1330 }
|
||||
2021-09-08 13:40:19 STATE: Build: { type: 'production', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node-gpu.js', files: 162, inputBytes: 234431, outputBytes: 175268 }
|
||||
2021-09-08 13:40:19 STATE: Build: { type: 'production', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node-cpu.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 138, outputBytes: 1321 }
|
||||
2021-09-08 13:40:19 STATE: Build: { type: 'production', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node-cpu.js', files: 162, inputBytes: 234422, outputBytes: 175259 }
|
||||
2021-09-08 13:40:19 STATE: Build: { type: 'production', format: 'esm', platform: 'browser', input: 'src/tfjs/tf-browser.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 276, outputBytes: 272 }
|
||||
2021-09-08 13:40:19 STATE: Build: { type: 'production', format: 'esm', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.esm-nobundle.js', files: 162, inputBytes: 233373, outputBytes: 169020 }
|
||||
2021-09-08 13:40:19 STATE: Build: { type: 'production', format: 'esm', platform: 'browser', input: 'src/tfjs/tf-browser.ts', output: 'dist/tfjs.esm.js', files: 7, inputBytes: 276, outputBytes: 2371544 }
|
||||
2021-09-08 13:40:20 STATE: Build: { type: 'production', format: 'iife', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.js', files: 162, inputBytes: 2604645, outputBytes: 2486481 }
|
||||
2021-09-08 13:40:20 STATE: Build: { type: 'production', format: 'esm', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.esm.js', files: 162, inputBytes: 2604645, outputBytes: 2369658 }
|
||||
2021-09-08 13:40:22 STATE: Typings: { input: 'src/index.ts', output: 'types', files: 93 }
|
||||
2021-09-08 13:40:27 STATE: TypeDoc: { input: 'src/index.ts', output: 'typedoc', objects: 154 }
|
||||
2021-09-08 13:40:37 STATE: Lint: { locations: [ 'src/**', [length]: 1 ], files: 171, errors: 0, warnings: 0 }
|
||||
2021-09-08 13:40:37 STATE: ChangeLog: { repository: 'https://github.com/vladmandic/face-api', branch: 'master', output: 'CHANGELOG.md' }
|
||||
2021-09-08 13:40:37 INFO: Profile production done
|
||||
2022-01-14 09:54:23 INFO: Application: { name: '@vladmandic/face-api', version: '1.6.4' }
|
||||
2022-01-14 09:54:23 INFO: Environment: { profile: 'production', config: '.build.json', package: 'package.json', tsconfig: true, eslintrc: true, git: true }
|
||||
2022-01-14 09:54:23 INFO: Toolchain: { build: '0.6.7', esbuild: '0.14.11', typescript: '4.5.4', typedoc: '0.22.10', eslint: '8.6.0' }
|
||||
2022-01-14 09:54:23 INFO: Build: { profile: 'production', steps: [ 'clean', 'compile', 'typings', 'typedoc', 'lint', 'changelog' ] }
|
||||
2022-01-14 09:54:23 STATE: Clean: { locations: [ 'dist/*', 'typedoc/*', 'types/lib/src' ] }
|
||||
2022-01-14 09:54:23 STATE: Compile: { name: 'tfjs/node/cpu', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 143, outputBytes: 1276 }
|
||||
2022-01-14 09:54:23 STATE: Compile: { name: 'faceapi/node/cpu', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node.js', files: 162, inputBytes: 234787, outputBytes: 175203 }
|
||||
2022-01-14 09:54:23 STATE: Compile: { name: 'tfjs/node/gpu', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node-gpu.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 147, outputBytes: 1296 }
|
||||
2022-01-14 09:54:23 STATE: Compile: { name: 'faceapi/node/gpu', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node-gpu.js', files: 162, inputBytes: 234807, outputBytes: 175219 }
|
||||
2022-01-14 09:54:23 STATE: Compile: { name: 'tfjs/node/wasm', format: 'cjs', platform: 'node', input: 'src/tfjs/tf-node-wasm.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 185, outputBytes: 1367 }
|
||||
2022-01-14 09:54:23 STATE: Compile: { name: 'faceapi/node/wasm', format: 'cjs', platform: 'node', input: 'src/index.ts', output: 'dist/face-api.node-wasm.js', files: 162, inputBytes: 234878, outputBytes: 175294 }
|
||||
2022-01-14 09:54:23 STATE: Compile: { name: 'tfjs/browser/tf-version', format: 'esm', platform: 'browser', input: 'src/tfjs/tf-version.ts', output: 'dist/tfjs.version.js', files: 1, inputBytes: 1063, outputBytes: 1662 }
|
||||
2022-01-14 09:54:23 STATE: Compile: { name: 'tfjs/browser/esm/nobundle', format: 'esm', platform: 'browser', input: 'src/tfjs/tf-browser.ts', output: 'dist/tfjs.esm.js', files: 2, inputBytes: 2172, outputBytes: 811 }
|
||||
2022-01-14 09:54:23 STATE: Compile: { name: 'faceapi/browser/esm/nobundle', format: 'esm', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.esm-nobundle.js', files: 162, inputBytes: 234322, outputBytes: 169437 }
|
||||
2022-01-14 09:54:24 STATE: Compile: { name: 'tfjs/browser/esm/bundle', format: 'esm', platform: 'browser', input: 'src/tfjs/tf-browser.ts', output: 'dist/tfjs.esm.js', files: 11, inputBytes: 2172, outputBytes: 2444105 }
|
||||
2022-01-14 09:54:24 STATE: Compile: { name: 'faceapi/browser/iife/bundle', format: 'iife', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.js', files: 162, inputBytes: 2677616, outputBytes: 1252572 }
|
||||
2022-01-14 09:54:24 STATE: Compile: { name: 'faceapi/browser/esm/bundle', format: 'esm', platform: 'browser', input: 'src/index.ts', output: 'dist/face-api.esm.js', files: 162, inputBytes: 2677616, outputBytes: 2435063 }
|
||||
2022-01-14 09:54:27 STATE: Typings: { input: 'src/index.ts', output: 'types/lib', files: 93 }
|
||||
2022-01-14 09:54:31 STATE: TypeDoc: { input: 'src/index.ts', output: 'typedoc', objects: 154, generated: true }
|
||||
2022-01-14 09:54:45 STATE: Lint: { locations: [ 'src/' ], files: 174, errors: 0, warnings: 0 }
|
||||
2022-01-14 09:54:45 STATE: ChangeLog: { repository: 'https://github.com/vladmandic/face-api', branch: 'master', output: 'CHANGELOG.md' }
|
||||
2022-01-14 09:54:45 INFO: Done...
|
||||
2022-01-14 09:54:45 STATE: Copy: { input: 'types/lib/dist/tfjs.esm.d.ts' }
|
||||
2022-01-14 09:54:46 STATE: API-Extractor: { succeeeded: true, errors: 0, warnings: 414 }
|
||||
2022-01-14 09:54:46 INFO: FaceAPI Build complete...
|
||||
```
|
||||
|
||||
<br><hr><br>
|
||||
|
@ -435,7 +443,7 @@ Build process uses `@vladmandic/build` module that creates optimized build for e
|
|||
This is updated **face-api.js** with latest available TensorFlow/JS as the original 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.12.0**
|
||||
Currently using **`TensorFlow/JS` 3.13.0**
|
||||
|
||||
*Why?* I needed FaceAPI that does not cause version conflict with newer versions of TensorFlow
|
||||
And since original FaceAPI was open-source, I've released this version as well
|
||||
|
@ -462,7 +470,7 @@ Compared to [face-api.js](https://github.com/justadudewhohacks/face-api.js) vers
|
|||
Original `face-api.js` is based on `TFJS` **1.7.4**
|
||||
- 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.4`
|
||||
- Updated all type castings for TypeScript type checking to `TypeScript 4.5`
|
||||
- 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
|
||||
|
@ -484,6 +492,7 @@ Compared to [face-api.js](https://github.com/justadudewhohacks/face-api.js) vers
|
|||
- Added `face angle` calculations that returns `roll`, `yaw` and `pitch`
|
||||
- Added `typdoc` automatic API specification generation during build
|
||||
- Added `changelog` automatic generation during build
|
||||
- Created new process to generate **TypeDocs** bundle using API-Extractor
|
||||
|
||||
<br>
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ async function main() {
|
|||
const params = new URLSearchParams(location.search);
|
||||
if (params.has('backend')) {
|
||||
const backend = params.get('backend');
|
||||
await faceapi.tf.setWasmPaths('https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.12.0/dist/');
|
||||
await faceapi.tf.setWasmPaths('https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.13.0/dist/');
|
||||
log(`Chosen backend: ${backend}`);
|
||||
await faceapi.tf.setBackend(backend);
|
||||
} else {
|
||||
|
|
|
@ -8,7 +8,6 @@ var __defProp = Object.defineProperty;
|
|||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
||||
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
||||
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
||||
}) : x)(function(x) {
|
||||
|
@ -17,14 +16,13 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|||
throw new Error('Dynamic require of "' + x + '" is not supported');
|
||||
});
|
||||
var __export = (target, all) => {
|
||||
__markAsModule(target);
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __reExport = (target, module, desc) => {
|
||||
var __reExport = (target, module, copyDefault, desc) => {
|
||||
if (module && typeof module === "object" || typeof module === "function") {
|
||||
for (let key of __getOwnPropNames(module))
|
||||
if (!__hasOwnProp.call(target, key) && key !== "default")
|
||||
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
||||
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
|
||||
}
|
||||
return target;
|
||||
|
@ -41,14 +39,14 @@ __reExport(tfjs_esm_exports, dist_star3);
|
|||
import * as dist_star from "@tensorflow/tfjs/dist/index.js";
|
||||
import * as dist_star2 from "@tensorflow/tfjs-backend-webgl/dist/index.js";
|
||||
import * as dist_star3 from "@tensorflow/tfjs-backend-wasm/dist/index.js";
|
||||
var version = "3.12.0";
|
||||
var version2 = "3.12.0";
|
||||
var version3 = "3.12.0";
|
||||
var version4 = "3.12.0";
|
||||
var version5 = "3.12.0";
|
||||
var version6 = "3.12.0";
|
||||
var version7 = "3.12.0";
|
||||
var version8 = "3.12.0";
|
||||
var version = "3.13.0";
|
||||
var version2 = "3.13.0";
|
||||
var version3 = "3.13.0";
|
||||
var version4 = "3.13.0";
|
||||
var version5 = "3.13.0";
|
||||
var version6 = "3.13.0";
|
||||
var version7 = "3.13.0";
|
||||
var version8 = "3.13.0";
|
||||
var version9 = {
|
||||
tfjs: version,
|
||||
"tfjs-core": version2,
|
||||
|
@ -948,13 +946,13 @@ function getContext2dOrThrow(canvasArg) {
|
|||
}
|
||||
|
||||
// src/draw/DrawTextField.ts
|
||||
var AnchorPosition;
|
||||
(function(AnchorPosition2) {
|
||||
var AnchorPosition = /* @__PURE__ */ ((AnchorPosition2) => {
|
||||
AnchorPosition2["TOP_LEFT"] = "TOP_LEFT";
|
||||
AnchorPosition2["TOP_RIGHT"] = "TOP_RIGHT";
|
||||
AnchorPosition2["BOTTOM_LEFT"] = "BOTTOM_LEFT";
|
||||
AnchorPosition2["BOTTOM_RIGHT"] = "BOTTOM_RIGHT";
|
||||
})(AnchorPosition || (AnchorPosition = {}));
|
||||
return AnchorPosition2;
|
||||
})(AnchorPosition || {});
|
||||
var DrawTextFieldOptions = class {
|
||||
constructor(options = {}) {
|
||||
const {
|
||||
|
@ -965,7 +963,7 @@ var DrawTextFieldOptions = class {
|
|||
fontStyle,
|
||||
padding
|
||||
} = options;
|
||||
this.anchorPosition = anchorPosition || AnchorPosition.TOP_LEFT;
|
||||
this.anchorPosition = anchorPosition || "TOP_LEFT" /* TOP_LEFT */;
|
||||
this.backgroundColor = backgroundColor || "rgba(0, 0, 0, 0.5)";
|
||||
this.fontColor = fontColor || "rgba(255, 255, 255, 1)";
|
||||
this.fontSize = fontSize || 14;
|
||||
|
@ -989,8 +987,8 @@ var DrawTextField = class {
|
|||
}
|
||||
getUpperLeft(ctx, canvasDims) {
|
||||
const { anchorPosition } = this.options;
|
||||
const isShiftLeft = anchorPosition === AnchorPosition.BOTTOM_RIGHT || anchorPosition === AnchorPosition.TOP_RIGHT;
|
||||
const isShiftTop = anchorPosition === AnchorPosition.BOTTOM_LEFT || anchorPosition === AnchorPosition.BOTTOM_RIGHT;
|
||||
const isShiftLeft = anchorPosition === "BOTTOM_RIGHT" /* BOTTOM_RIGHT */ || anchorPosition === "TOP_RIGHT" /* TOP_RIGHT */;
|
||||
const isShiftTop = anchorPosition === "BOTTOM_LEFT" /* BOTTOM_LEFT */ || anchorPosition === "BOTTOM_RIGHT" /* BOTTOM_RIGHT */;
|
||||
const textFieldWidth = this.measureWidth(ctx);
|
||||
const textFieldHeight = this.measureHeight();
|
||||
const x = isShiftLeft ? this.anchor.x - textFieldWidth : this.anchor.x;
|
||||
|
@ -1041,7 +1039,7 @@ var DrawBoxOptions = class {
|
|||
this.lineWidth = lineWidth || 2;
|
||||
this.label = label;
|
||||
const defaultDrawLabelOptions = {
|
||||
anchorPosition: AnchorPosition.BOTTOM_LEFT,
|
||||
anchorPosition: "BOTTOM_LEFT" /* BOTTOM_LEFT */,
|
||||
backgroundColor: this.boxColor
|
||||
};
|
||||
this.drawLabelOptions = new DrawTextFieldOptions({ ...defaultDrawLabelOptions, ...drawLabelOptions });
|
||||
|
@ -2135,7 +2133,7 @@ function drawFaceLandmarks(canvasArg, faceLandmarks) {
|
|||
}
|
||||
|
||||
// package.json
|
||||
var version10 = "1.6.3";
|
||||
var version10 = "1.6.4";
|
||||
|
||||
// src/xception/extractParams.ts
|
||||
function extractorsFactory2(extractWeights, paramMappings) {
|
||||
|
@ -2350,11 +2348,11 @@ function extractParamsFromWeightMap4(weightMap) {
|
|||
}
|
||||
|
||||
// src/ageGenderNet/types.ts
|
||||
var Gender;
|
||||
(function(Gender2) {
|
||||
var Gender = /* @__PURE__ */ ((Gender2) => {
|
||||
Gender2["FEMALE"] = "female";
|
||||
Gender2["MALE"] = "male";
|
||||
})(Gender || (Gender = {}));
|
||||
return Gender2;
|
||||
})(Gender || {});
|
||||
|
||||
// src/ageGenderNet/AgeGenderNet.ts
|
||||
var AgeGenderNet = class extends NeuralNetwork {
|
||||
|
@ -2400,7 +2398,7 @@ var AgeGenderNet = class extends NeuralNetwork {
|
|||
const age = ageTensor.dataSync()[0];
|
||||
const probMale = genderTensor.dataSync()[0];
|
||||
const isMale = probMale > 0.5;
|
||||
const gender = isMale ? Gender.MALE : Gender.FEMALE;
|
||||
const gender = isMale ? "male" /* MALE */ : "female" /* FEMALE */;
|
||||
const genderProbability = isMale ? probMale : 1 - probMale;
|
||||
ageTensor.dispose();
|
||||
genderTensor.dispose();
|
||||
|
@ -2894,7 +2892,7 @@ function extendWithAge(sourceObj, age) {
|
|||
|
||||
// src/factories/WithGender.ts
|
||||
function isWithGender(obj) {
|
||||
return (obj.gender === Gender.MALE || obj.gender === Gender.FEMALE) && isValidProbablitiy(obj.genderProbability);
|
||||
return (obj.gender === "male" /* MALE */ || obj.gender === "female" /* FEMALE */) && isValidProbablitiy(obj.genderProbability);
|
||||
}
|
||||
function extendWithGender(sourceObj, gender, genderProbability) {
|
||||
const extension = { gender, genderProbability };
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -12,53 +12,59 @@ var __getProtoOf = Object.getPrototypeOf;
|
|||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
||||
var __commonJS = (cb, mod) => function __require() {
|
||||
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
};
|
||||
var __export = (target, all) => {
|
||||
__markAsModule(target);
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __reExport = (target, module2, desc) => {
|
||||
var __reExport = (target, module2, copyDefault, desc) => {
|
||||
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
||||
for (let key of __getOwnPropNames(module2))
|
||||
if (!__hasOwnProp.call(target, key) && key !== "default")
|
||||
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
||||
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
||||
}
|
||||
return target;
|
||||
};
|
||||
var __toModule = (module2) => {
|
||||
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
||||
var __toESM = (module2, isNodeMode) => {
|
||||
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
||||
};
|
||||
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
||||
return (module2, temp) => {
|
||||
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
||||
};
|
||||
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
||||
|
||||
// dist/tfjs.esm.js
|
||||
var require_tfjs_esm = __commonJS({
|
||||
"dist/tfjs.esm.js"(exports) {
|
||||
var __create2 = Object.create;
|
||||
"dist/tfjs.esm.js"(exports, module2) {
|
||||
var __defProp2 = Object.defineProperty;
|
||||
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
||||
var __getProtoOf2 = Object.getPrototypeOf;
|
||||
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
||||
var __markAsModule2 = (target) => __defProp2(target, "__esModule", { value: true });
|
||||
var __reExport2 = (target, module22, desc) => {
|
||||
var __reExport2 = (target, module22, copyDefault, desc) => {
|
||||
if (module22 && typeof module22 === "object" || typeof module22 === "function") {
|
||||
for (let key of __getOwnPropNames2(module22))
|
||||
if (!__hasOwnProp2.call(target, key) && key !== "default")
|
||||
if (!__hasOwnProp2.call(target, key) && (copyDefault || key !== "default"))
|
||||
__defProp2(target, key, { get: () => module22[key], enumerable: !(desc = __getOwnPropDesc2(module22, key)) || desc.enumerable });
|
||||
}
|
||||
return target;
|
||||
};
|
||||
var __toModule2 = (module22) => {
|
||||
return __reExport2(__markAsModule2(__defProp2(module22 != null ? __create2(__getProtoOf2(module22)) : {}, "default", module22 && module22.__esModule && "default" in module22 ? { get: () => module22.default, enumerable: true } : { value: module22, enumerable: true })), module22);
|
||||
};
|
||||
__markAsModule2(exports);
|
||||
__reExport2(exports, __toModule2(require("@tensorflow/tfjs-node-gpu")));
|
||||
var __toCommonJS2 = ((cache) => {
|
||||
return (module22, temp) => {
|
||||
return cache && cache.get(module22) || (temp = __reExport2(__markAsModule2({}), module22, 1), cache && cache.set(module22, temp), temp);
|
||||
};
|
||||
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
||||
var tf_node_gpu_exports = {};
|
||||
__reExport2(tf_node_gpu_exports, require("@tensorflow/tfjs-node-gpu"));
|
||||
module2.exports = __toCommonJS2(tf_node_gpu_exports);
|
||||
}
|
||||
});
|
||||
|
||||
// src/index.ts
|
||||
__export(exports, {
|
||||
var src_exports = {};
|
||||
__export(src_exports, {
|
||||
AgeGenderNet: () => AgeGenderNet,
|
||||
BoundingBox: () => BoundingBox,
|
||||
Box: () => Box,
|
||||
|
@ -181,7 +187,7 @@ __export(exports, {
|
|||
validateConfig: () => validateConfig,
|
||||
version: () => version2
|
||||
});
|
||||
var tf42 = __toModule(require_tfjs_esm());
|
||||
var tf42 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/draw/index.ts
|
||||
var draw_exports = {};
|
||||
|
@ -237,7 +243,7 @@ __export(utils_exports, {
|
|||
range: () => range,
|
||||
round: () => round
|
||||
});
|
||||
var tf = __toModule(require_tfjs_esm());
|
||||
var tf = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/classes/Dimensions.ts
|
||||
var Dimensions = class {
|
||||
|
@ -643,7 +649,7 @@ function nonMaxSuppression(boxes, scores, iouThreshold, isIOU = true) {
|
|||
}
|
||||
|
||||
// src/ops/normalize.ts
|
||||
var tf2 = __toModule(require_tfjs_esm());
|
||||
var tf2 = __toESM(require_tfjs_esm());
|
||||
function normalize(x, meanRgb) {
|
||||
return tf2.tidy(() => {
|
||||
const [r, g, b] = meanRgb;
|
||||
|
@ -656,7 +662,7 @@ function normalize(x, meanRgb) {
|
|||
}
|
||||
|
||||
// src/ops/padToSquare.ts
|
||||
var tf3 = __toModule(require_tfjs_esm());
|
||||
var tf3 = __toESM(require_tfjs_esm());
|
||||
function padToSquare(imgTensor, isCenterImage = false) {
|
||||
return tf3.tidy(() => {
|
||||
const [height, width] = imgTensor.shape.slice(1);
|
||||
|
@ -1074,13 +1080,13 @@ function getContext2dOrThrow(canvasArg) {
|
|||
}
|
||||
|
||||
// src/draw/DrawTextField.ts
|
||||
var AnchorPosition;
|
||||
(function(AnchorPosition2) {
|
||||
var AnchorPosition = /* @__PURE__ */ ((AnchorPosition2) => {
|
||||
AnchorPosition2["TOP_LEFT"] = "TOP_LEFT";
|
||||
AnchorPosition2["TOP_RIGHT"] = "TOP_RIGHT";
|
||||
AnchorPosition2["BOTTOM_LEFT"] = "BOTTOM_LEFT";
|
||||
AnchorPosition2["BOTTOM_RIGHT"] = "BOTTOM_RIGHT";
|
||||
})(AnchorPosition || (AnchorPosition = {}));
|
||||
return AnchorPosition2;
|
||||
})(AnchorPosition || {});
|
||||
var DrawTextFieldOptions = class {
|
||||
constructor(options = {}) {
|
||||
const {
|
||||
|
@ -1091,7 +1097,7 @@ var DrawTextFieldOptions = class {
|
|||
fontStyle,
|
||||
padding
|
||||
} = options;
|
||||
this.anchorPosition = anchorPosition || AnchorPosition.TOP_LEFT;
|
||||
this.anchorPosition = anchorPosition || "TOP_LEFT" /* TOP_LEFT */;
|
||||
this.backgroundColor = backgroundColor || "rgba(0, 0, 0, 0.5)";
|
||||
this.fontColor = fontColor || "rgba(255, 255, 255, 1)";
|
||||
this.fontSize = fontSize || 14;
|
||||
|
@ -1115,8 +1121,8 @@ var DrawTextField = class {
|
|||
}
|
||||
getUpperLeft(ctx, canvasDims) {
|
||||
const { anchorPosition } = this.options;
|
||||
const isShiftLeft = anchorPosition === AnchorPosition.BOTTOM_RIGHT || anchorPosition === AnchorPosition.TOP_RIGHT;
|
||||
const isShiftTop = anchorPosition === AnchorPosition.BOTTOM_LEFT || anchorPosition === AnchorPosition.BOTTOM_RIGHT;
|
||||
const isShiftLeft = anchorPosition === "BOTTOM_RIGHT" /* BOTTOM_RIGHT */ || anchorPosition === "TOP_RIGHT" /* TOP_RIGHT */;
|
||||
const isShiftTop = anchorPosition === "BOTTOM_LEFT" /* BOTTOM_LEFT */ || anchorPosition === "BOTTOM_RIGHT" /* BOTTOM_RIGHT */;
|
||||
const textFieldWidth = this.measureWidth(ctx);
|
||||
const textFieldHeight = this.measureHeight();
|
||||
const x = isShiftLeft ? this.anchor.x - textFieldWidth : this.anchor.x;
|
||||
|
@ -1167,7 +1173,7 @@ var DrawBoxOptions = class {
|
|||
this.lineWidth = lineWidth || 2;
|
||||
this.label = label;
|
||||
const defaultDrawLabelOptions = {
|
||||
anchorPosition: AnchorPosition.BOTTOM_LEFT,
|
||||
anchorPosition: "BOTTOM_LEFT" /* BOTTOM_LEFT */,
|
||||
backgroundColor: this.boxColor
|
||||
};
|
||||
this.drawLabelOptions = new DrawTextFieldOptions({ ...defaultDrawLabelOptions, ...drawLabelOptions });
|
||||
|
@ -1209,7 +1215,7 @@ function drawDetections(canvasArg, detections) {
|
|||
}
|
||||
|
||||
// src/faceExpressionNet/FaceExpressionNet.ts
|
||||
var tf18 = __toModule(require_tfjs_esm());
|
||||
var tf18 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/dom/isMediaLoaded.ts
|
||||
function isMediaLoaded(media) {
|
||||
|
@ -1296,7 +1302,7 @@ function createCanvasFromMedia(media, dims) {
|
|||
}
|
||||
|
||||
// src/dom/imageTensorToCanvas.ts
|
||||
var tf4 = __toModule(require_tfjs_esm());
|
||||
var tf4 = __toESM(require_tfjs_esm());
|
||||
async function imageTensorToCanvas(imgTensor, canvas) {
|
||||
const targetCanvas = canvas || env.getEnv().createCanvasElement();
|
||||
const [height, width, numChannels] = imgTensor.shape.slice(isTensor4D(imgTensor) ? 1 : 0);
|
||||
|
@ -1313,7 +1319,7 @@ function isMediaElement(input) {
|
|||
}
|
||||
|
||||
// src/dom/NetInput.ts
|
||||
var tf5 = __toModule(require_tfjs_esm());
|
||||
var tf5 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/dom/imageToSquare.ts
|
||||
function imageToSquare(input, inputSize, centerImage = false) {
|
||||
|
@ -1482,7 +1488,7 @@ async function extractFaces(input, detections) {
|
|||
}
|
||||
|
||||
// src/dom/extractFaceTensors.ts
|
||||
var tf6 = __toModule(require_tfjs_esm());
|
||||
var tf6 = __toESM(require_tfjs_esm());
|
||||
async function extractFaceTensors(imageTensor, detections) {
|
||||
if (!isTensor3D(imageTensor) && !isTensor4D(imageTensor)) {
|
||||
throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");
|
||||
|
@ -1559,7 +1565,7 @@ async function fetchVideo(uri) {
|
|||
}
|
||||
|
||||
// src/dom/loadWeightMap.ts
|
||||
var tf7 = __toModule(require_tfjs_esm());
|
||||
var tf7 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/getModelUris.ts
|
||||
function getModelUris(uri, defaultModelName) {
|
||||
|
@ -1604,10 +1610,10 @@ function matchDimensions(input, reference, useMediaDimensions = false) {
|
|||
}
|
||||
|
||||
// src/faceFeatureExtractor/FaceFeatureExtractor.ts
|
||||
var tf15 = __toModule(require_tfjs_esm());
|
||||
var tf15 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/NeuralNetwork.ts
|
||||
var tf8 = __toModule(require_tfjs_esm());
|
||||
var tf8 = __toESM(require_tfjs_esm());
|
||||
var NeuralNetwork = class {
|
||||
constructor(name) {
|
||||
this._params = void 0;
|
||||
|
@ -1723,10 +1729,10 @@ var NeuralNetwork = class {
|
|||
};
|
||||
|
||||
// src/faceFeatureExtractor/denseBlock.ts
|
||||
var tf10 = __toModule(require_tfjs_esm());
|
||||
var tf10 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/depthwiseSeparableConv.ts
|
||||
var tf9 = __toModule(require_tfjs_esm());
|
||||
var tf9 = __toESM(require_tfjs_esm());
|
||||
function depthwiseSeparableConv(x, params, stride) {
|
||||
return tf9.tidy(() => {
|
||||
let out = tf9.separableConv2d(x, params.depthwise_filter, params.pointwise_filter, stride, "same");
|
||||
|
@ -1758,7 +1764,7 @@ function denseBlock4(x, denseBlockParams, isFirstLayer = false, isScaleDown = tr
|
|||
}
|
||||
|
||||
// src/common/convLayer.ts
|
||||
var tf11 = __toModule(require_tfjs_esm());
|
||||
var tf11 = __toESM(require_tfjs_esm());
|
||||
function convLayer(x, params, padding = "same", withRelu = false) {
|
||||
return tf11.tidy(() => {
|
||||
const out = tf11.add(tf11.conv2d(x, params.filters, [1, 1], padding), params.bias);
|
||||
|
@ -1776,7 +1782,7 @@ function disposeUnusedWeightTensors(weightMap, paramMappings) {
|
|||
}
|
||||
|
||||
// src/common/extractConvParamsFactory.ts
|
||||
var tf12 = __toModule(require_tfjs_esm());
|
||||
var tf12 = __toESM(require_tfjs_esm());
|
||||
function extractConvParamsFactory(extractWeights, paramMappings) {
|
||||
return (channelsIn, channelsOut, filterSize, mappedPrefix) => {
|
||||
const filters = tf12.tensor4d(extractWeights(channelsIn * channelsOut * filterSize * filterSize), [filterSize, filterSize, channelsIn, channelsOut]);
|
||||
|
@ -1787,7 +1793,7 @@ function extractConvParamsFactory(extractWeights, paramMappings) {
|
|||
}
|
||||
|
||||
// src/common/extractFCParamsFactory.ts
|
||||
var tf13 = __toModule(require_tfjs_esm());
|
||||
var tf13 = __toESM(require_tfjs_esm());
|
||||
function extractFCParamsFactory(extractWeights, paramMappings) {
|
||||
return (channelsIn, channelsOut, mappedPrefix) => {
|
||||
const fc_weights = tf13.tensor2d(extractWeights(channelsIn * channelsOut), [channelsIn, channelsOut]);
|
||||
|
@ -1801,7 +1807,7 @@ function extractFCParamsFactory(extractWeights, paramMappings) {
|
|||
}
|
||||
|
||||
// src/common/extractSeparableConvParamsFactory.ts
|
||||
var tf14 = __toModule(require_tfjs_esm());
|
||||
var tf14 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/types.ts
|
||||
var SeparableConvParams = class {
|
||||
|
@ -2005,10 +2011,10 @@ var FaceFeatureExtractor = class extends NeuralNetwork {
|
|||
};
|
||||
|
||||
// src/faceProcessor/FaceProcessor.ts
|
||||
var tf17 = __toModule(require_tfjs_esm());
|
||||
var tf17 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/fullyConnectedLayer.ts
|
||||
var tf16 = __toModule(require_tfjs_esm());
|
||||
var tf16 = __toESM(require_tfjs_esm());
|
||||
function fullyConnectedLayer(x, params) {
|
||||
return tf16.tidy(() => tf16.add(tf16.matMul(x, params.weights), params.bias));
|
||||
}
|
||||
|
@ -2290,13 +2296,13 @@ function drawFaceLandmarks(canvasArg, faceLandmarks) {
|
|||
}
|
||||
|
||||
// package.json
|
||||
var version = "1.6.3";
|
||||
var version = "1.6.4";
|
||||
|
||||
// src/ageGenderNet/AgeGenderNet.ts
|
||||
var tf20 = __toModule(require_tfjs_esm());
|
||||
var tf20 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/xception/TinyXception.ts
|
||||
var tf19 = __toModule(require_tfjs_esm());
|
||||
var tf19 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/xception/extractParams.ts
|
||||
function extractorsFactory2(extractWeights, paramMappings) {
|
||||
|
@ -2511,11 +2517,11 @@ function extractParamsFromWeightMap4(weightMap) {
|
|||
}
|
||||
|
||||
// src/ageGenderNet/types.ts
|
||||
var Gender;
|
||||
(function(Gender2) {
|
||||
var Gender = /* @__PURE__ */ ((Gender2) => {
|
||||
Gender2["FEMALE"] = "female";
|
||||
Gender2["MALE"] = "male";
|
||||
})(Gender || (Gender = {}));
|
||||
return Gender2;
|
||||
})(Gender || {});
|
||||
|
||||
// src/ageGenderNet/AgeGenderNet.ts
|
||||
var AgeGenderNet = class extends NeuralNetwork {
|
||||
|
@ -2561,7 +2567,7 @@ var AgeGenderNet = class extends NeuralNetwork {
|
|||
const age = ageTensor.dataSync()[0];
|
||||
const probMale = genderTensor.dataSync()[0];
|
||||
const isMale = probMale > 0.5;
|
||||
const gender = isMale ? Gender.MALE : Gender.FEMALE;
|
||||
const gender = isMale ? "male" /* MALE */ : "female" /* FEMALE */;
|
||||
const genderProbability = isMale ? probMale : 1 - probMale;
|
||||
ageTensor.dispose();
|
||||
genderTensor.dispose();
|
||||
|
@ -2601,7 +2607,7 @@ var AgeGenderNet = class extends NeuralNetwork {
|
|||
};
|
||||
|
||||
// src/faceLandmarkNet/FaceLandmark68NetBase.ts
|
||||
var tf21 = __toModule(require_tfjs_esm());
|
||||
var tf21 = __toESM(require_tfjs_esm());
|
||||
var FaceLandmark68NetBase = class extends FaceProcessor {
|
||||
postProcess(output, inputSize, originalDimensions) {
|
||||
const inputDimensions = originalDimensions.map(({ width, height }) => {
|
||||
|
@ -2667,7 +2673,7 @@ var FaceLandmark68Net = class extends FaceLandmark68NetBase {
|
|||
};
|
||||
|
||||
// src/faceFeatureExtractor/TinyFaceFeatureExtractor.ts
|
||||
var tf22 = __toModule(require_tfjs_esm());
|
||||
var tf22 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/faceFeatureExtractor/extractParamsFromWeightMapTiny.ts
|
||||
function extractParamsFromWeightMapTiny(weightMap) {
|
||||
|
@ -2759,13 +2765,13 @@ var FaceLandmarkNet = class extends FaceLandmark68Net {
|
|||
};
|
||||
|
||||
// src/faceRecognitionNet/FaceRecognitionNet.ts
|
||||
var tf27 = __toModule(require_tfjs_esm());
|
||||
var tf27 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/faceRecognitionNet/convLayer.ts
|
||||
var tf24 = __toModule(require_tfjs_esm());
|
||||
var tf24 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/faceRecognitionNet/scaleLayer.ts
|
||||
var tf23 = __toModule(require_tfjs_esm());
|
||||
var tf23 = __toESM(require_tfjs_esm());
|
||||
function scale(x, params) {
|
||||
return tf23.add(tf23.mul(x, params.weights), params.biases);
|
||||
}
|
||||
|
@ -2789,7 +2795,7 @@ function convDown(x, params) {
|
|||
}
|
||||
|
||||
// src/faceRecognitionNet/extractParams.ts
|
||||
var tf25 = __toModule(require_tfjs_esm());
|
||||
var tf25 = __toESM(require_tfjs_esm());
|
||||
function extractorsFactory3(extractWeights, paramMappings) {
|
||||
function extractFilterValues(numFilterValues, numFilters, filterSize) {
|
||||
const weights = extractWeights(numFilterValues);
|
||||
|
@ -2954,7 +2960,7 @@ function extractParamsFromWeightMap5(weightMap) {
|
|||
}
|
||||
|
||||
// src/faceRecognitionNet/residualLayer.ts
|
||||
var tf26 = __toModule(require_tfjs_esm());
|
||||
var tf26 = __toESM(require_tfjs_esm());
|
||||
function residual(x, params) {
|
||||
let out = conv2(x, params.conv1);
|
||||
out = convNoRelu(out, params.conv2);
|
||||
|
@ -3068,7 +3074,7 @@ function extendWithAge(sourceObj, age) {
|
|||
|
||||
// src/factories/WithGender.ts
|
||||
function isWithGender(obj) {
|
||||
return (obj.gender === Gender.MALE || obj.gender === Gender.FEMALE) && isValidProbablitiy(obj.genderProbability);
|
||||
return (obj.gender === "male" /* MALE */ || obj.gender === "female" /* FEMALE */) && isValidProbablitiy(obj.genderProbability);
|
||||
}
|
||||
function extendWithGender(sourceObj, gender, genderProbability) {
|
||||
const extension = { gender, genderProbability };
|
||||
|
@ -3076,10 +3082,10 @@ function extendWithGender(sourceObj, gender, genderProbability) {
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/SsdMobilenetv1.ts
|
||||
var tf34 = __toModule(require_tfjs_esm());
|
||||
var tf34 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/ssdMobilenetv1/extractParams.ts
|
||||
var tf28 = __toModule(require_tfjs_esm());
|
||||
var tf28 = __toESM(require_tfjs_esm());
|
||||
function extractorsFactory5(extractWeights, paramMappings) {
|
||||
function extractDepthwiseConvParams(numChannels, mappedPrefix) {
|
||||
const filters = tf28.tensor4d(extractWeights(3 * 3 * numChannels), [3, 3, numChannels, 1]);
|
||||
|
@ -3349,10 +3355,10 @@ function extractParamsFromWeightMap6(weightMap) {
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/mobileNetV1.ts
|
||||
var tf30 = __toModule(require_tfjs_esm());
|
||||
var tf30 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/ssdMobilenetv1/pointwiseConvLayer.ts
|
||||
var tf29 = __toModule(require_tfjs_esm());
|
||||
var tf29 = __toESM(require_tfjs_esm());
|
||||
function pointwiseConvLayer(x, params, strides) {
|
||||
return tf29.tidy(() => {
|
||||
let out = tf29.conv2d(x, params.filters, strides, "same");
|
||||
|
@ -3458,7 +3464,7 @@ function nonMaxSuppression2(boxes, scores, maxOutputSize, iouThreshold, scoreThr
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/outputLayer.ts
|
||||
var tf31 = __toModule(require_tfjs_esm());
|
||||
var tf31 = __toESM(require_tfjs_esm());
|
||||
function getCenterCoordinatesAndSizesLayer(x) {
|
||||
const vec = tf31.unstack(tf31.transpose(x, [1, 0]));
|
||||
const sizes = [
|
||||
|
@ -3500,10 +3506,10 @@ function outputLayer(boxPredictions, classPredictions, params) {
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/predictionLayer.ts
|
||||
var tf33 = __toModule(require_tfjs_esm());
|
||||
var tf33 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/ssdMobilenetv1/boxPredictionLayer.ts
|
||||
var tf32 = __toModule(require_tfjs_esm());
|
||||
var tf32 = __toESM(require_tfjs_esm());
|
||||
function boxPredictionLayer(x, params) {
|
||||
return tf32.tidy(() => {
|
||||
const batchSize = x.shape[0];
|
||||
|
@ -3671,7 +3677,7 @@ var DEFAULT_MODEL_NAME = "tiny_yolov2_model";
|
|||
var DEFAULT_MODEL_NAME_SEPARABLE_CONV = "tiny_yolov2_separable_conv_model";
|
||||
|
||||
// src/tinyYolov2/TinyYolov2Base.ts
|
||||
var tf39 = __toModule(require_tfjs_esm());
|
||||
var tf39 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/tinyYolov2/config.ts
|
||||
var isNumber = (arg) => typeof arg === "number";
|
||||
|
@ -3697,10 +3703,10 @@ function validateConfig(config) {
|
|||
}
|
||||
|
||||
// src/tinyYolov2/convWithBatchNorm.ts
|
||||
var tf36 = __toModule(require_tfjs_esm());
|
||||
var tf36 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/tinyYolov2/leaky.ts
|
||||
var tf35 = __toModule(require_tfjs_esm());
|
||||
var tf35 = __toESM(require_tfjs_esm());
|
||||
function leaky(x) {
|
||||
return tf35.tidy(() => {
|
||||
const min = tf35.mul(x, tf35.scalar(0.10000000149011612));
|
||||
|
@ -3721,7 +3727,7 @@ function convWithBatchNorm(x, params) {
|
|||
}
|
||||
|
||||
// src/tinyYolov2/depthwiseSeparableConv.ts
|
||||
var tf37 = __toModule(require_tfjs_esm());
|
||||
var tf37 = __toESM(require_tfjs_esm());
|
||||
function depthwiseSeparableConv2(x, params) {
|
||||
return tf37.tidy(() => {
|
||||
let out = tf37.pad(x, [[0, 0], [1, 1], [1, 1], [0, 0]]);
|
||||
|
@ -3732,7 +3738,7 @@ function depthwiseSeparableConv2(x, params) {
|
|||
}
|
||||
|
||||
// src/tinyYolov2/extractParams.ts
|
||||
var tf38 = __toModule(require_tfjs_esm());
|
||||
var tf38 = __toESM(require_tfjs_esm());
|
||||
function extractorsFactory7(extractWeights, paramMappings) {
|
||||
const extractConvParams = extractConvParamsFactory(extractWeights, paramMappings);
|
||||
function extractBatchNormParams(size, mappedPrefix) {
|
||||
|
@ -4118,10 +4124,10 @@ var ComposableTask = class {
|
|||
};
|
||||
|
||||
// src/globalApi/DetectFaceLandmarksTasks.ts
|
||||
var tf41 = __toModule(require_tfjs_esm());
|
||||
var tf41 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/globalApi/extractFacesAndComputeResults.ts
|
||||
var tf40 = __toModule(require_tfjs_esm());
|
||||
var tf40 = __toESM(require_tfjs_esm());
|
||||
async function extractAllFacesAndComputeResults(parentResults, input, computeResults, extractedFaces, getRectForAlignment = ({ alignedRect }) => alignedRect) {
|
||||
const faceBoxes = parentResults.map((parentResult) => isWithFaceLandmarks(parentResult) ? getRectForAlignment(parentResult) : parentResult.detection);
|
||||
const faces = extractedFaces || (input instanceof tf40.Tensor ? await extractFaceTensors(input, faceBoxes) : await extractFaces(input, faceBoxes));
|
||||
|
@ -4564,6 +4570,7 @@ function resizeResults(results, dimensions) {
|
|||
|
||||
// src/index.ts
|
||||
var version2 = version;
|
||||
module.exports = __toCommonJS(src_exports);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
AgeGenderNet,
|
||||
|
|
|
@ -12,54 +12,60 @@ var __getProtoOf = Object.getPrototypeOf;
|
|||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
||||
var __commonJS = (cb, mod) => function __require() {
|
||||
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
};
|
||||
var __export = (target, all) => {
|
||||
__markAsModule(target);
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __reExport = (target, module2, desc) => {
|
||||
var __reExport = (target, module2, copyDefault, desc) => {
|
||||
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
||||
for (let key of __getOwnPropNames(module2))
|
||||
if (!__hasOwnProp.call(target, key) && key !== "default")
|
||||
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
||||
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
||||
}
|
||||
return target;
|
||||
};
|
||||
var __toModule = (module2) => {
|
||||
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
||||
var __toESM = (module2, isNodeMode) => {
|
||||
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
||||
};
|
||||
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
||||
return (module2, temp) => {
|
||||
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
||||
};
|
||||
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
||||
|
||||
// dist/tfjs.esm.js
|
||||
var require_tfjs_esm = __commonJS({
|
||||
"dist/tfjs.esm.js"(exports) {
|
||||
var __create2 = Object.create;
|
||||
"dist/tfjs.esm.js"(exports, module2) {
|
||||
var __defProp2 = Object.defineProperty;
|
||||
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
||||
var __getProtoOf2 = Object.getPrototypeOf;
|
||||
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
||||
var __markAsModule2 = (target) => __defProp2(target, "__esModule", { value: true });
|
||||
var __reExport2 = (target, module22, desc) => {
|
||||
var __reExport2 = (target, module22, copyDefault, desc) => {
|
||||
if (module22 && typeof module22 === "object" || typeof module22 === "function") {
|
||||
for (let key of __getOwnPropNames2(module22))
|
||||
if (!__hasOwnProp2.call(target, key) && key !== "default")
|
||||
if (!__hasOwnProp2.call(target, key) && (copyDefault || key !== "default"))
|
||||
__defProp2(target, key, { get: () => module22[key], enumerable: !(desc = __getOwnPropDesc2(module22, key)) || desc.enumerable });
|
||||
}
|
||||
return target;
|
||||
};
|
||||
var __toModule2 = (module22) => {
|
||||
return __reExport2(__markAsModule2(__defProp2(module22 != null ? __create2(__getProtoOf2(module22)) : {}, "default", module22 && module22.__esModule && "default" in module22 ? { get: () => module22.default, enumerable: true } : { value: module22, enumerable: true })), module22);
|
||||
};
|
||||
__markAsModule2(exports);
|
||||
__reExport2(exports, __toModule2(require("@tensorflow/tfjs")));
|
||||
__reExport2(exports, __toModule2(require("@tensorflow/tfjs-backend-wasm")));
|
||||
var __toCommonJS2 = ((cache) => {
|
||||
return (module22, temp) => {
|
||||
return cache && cache.get(module22) || (temp = __reExport2(__markAsModule2({}), module22, 1), cache && cache.set(module22, temp), temp);
|
||||
};
|
||||
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
||||
var tf_node_wasm_exports = {};
|
||||
__reExport2(tf_node_wasm_exports, require("@tensorflow/tfjs"));
|
||||
__reExport2(tf_node_wasm_exports, require("@tensorflow/tfjs-backend-wasm"));
|
||||
module2.exports = __toCommonJS2(tf_node_wasm_exports);
|
||||
}
|
||||
});
|
||||
|
||||
// src/index.ts
|
||||
__export(exports, {
|
||||
var src_exports = {};
|
||||
__export(src_exports, {
|
||||
AgeGenderNet: () => AgeGenderNet,
|
||||
BoundingBox: () => BoundingBox,
|
||||
Box: () => Box,
|
||||
|
@ -182,7 +188,7 @@ __export(exports, {
|
|||
validateConfig: () => validateConfig,
|
||||
version: () => version2
|
||||
});
|
||||
var tf42 = __toModule(require_tfjs_esm());
|
||||
var tf42 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/draw/index.ts
|
||||
var draw_exports = {};
|
||||
|
@ -238,7 +244,7 @@ __export(utils_exports, {
|
|||
range: () => range,
|
||||
round: () => round
|
||||
});
|
||||
var tf = __toModule(require_tfjs_esm());
|
||||
var tf = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/classes/Dimensions.ts
|
||||
var Dimensions = class {
|
||||
|
@ -644,7 +650,7 @@ function nonMaxSuppression(boxes, scores, iouThreshold, isIOU = true) {
|
|||
}
|
||||
|
||||
// src/ops/normalize.ts
|
||||
var tf2 = __toModule(require_tfjs_esm());
|
||||
var tf2 = __toESM(require_tfjs_esm());
|
||||
function normalize(x, meanRgb) {
|
||||
return tf2.tidy(() => {
|
||||
const [r, g, b] = meanRgb;
|
||||
|
@ -657,7 +663,7 @@ function normalize(x, meanRgb) {
|
|||
}
|
||||
|
||||
// src/ops/padToSquare.ts
|
||||
var tf3 = __toModule(require_tfjs_esm());
|
||||
var tf3 = __toESM(require_tfjs_esm());
|
||||
function padToSquare(imgTensor, isCenterImage = false) {
|
||||
return tf3.tidy(() => {
|
||||
const [height, width] = imgTensor.shape.slice(1);
|
||||
|
@ -1075,13 +1081,13 @@ function getContext2dOrThrow(canvasArg) {
|
|||
}
|
||||
|
||||
// src/draw/DrawTextField.ts
|
||||
var AnchorPosition;
|
||||
(function(AnchorPosition2) {
|
||||
var AnchorPosition = /* @__PURE__ */ ((AnchorPosition2) => {
|
||||
AnchorPosition2["TOP_LEFT"] = "TOP_LEFT";
|
||||
AnchorPosition2["TOP_RIGHT"] = "TOP_RIGHT";
|
||||
AnchorPosition2["BOTTOM_LEFT"] = "BOTTOM_LEFT";
|
||||
AnchorPosition2["BOTTOM_RIGHT"] = "BOTTOM_RIGHT";
|
||||
})(AnchorPosition || (AnchorPosition = {}));
|
||||
return AnchorPosition2;
|
||||
})(AnchorPosition || {});
|
||||
var DrawTextFieldOptions = class {
|
||||
constructor(options = {}) {
|
||||
const {
|
||||
|
@ -1092,7 +1098,7 @@ var DrawTextFieldOptions = class {
|
|||
fontStyle,
|
||||
padding
|
||||
} = options;
|
||||
this.anchorPosition = anchorPosition || AnchorPosition.TOP_LEFT;
|
||||
this.anchorPosition = anchorPosition || "TOP_LEFT" /* TOP_LEFT */;
|
||||
this.backgroundColor = backgroundColor || "rgba(0, 0, 0, 0.5)";
|
||||
this.fontColor = fontColor || "rgba(255, 255, 255, 1)";
|
||||
this.fontSize = fontSize || 14;
|
||||
|
@ -1116,8 +1122,8 @@ var DrawTextField = class {
|
|||
}
|
||||
getUpperLeft(ctx, canvasDims) {
|
||||
const { anchorPosition } = this.options;
|
||||
const isShiftLeft = anchorPosition === AnchorPosition.BOTTOM_RIGHT || anchorPosition === AnchorPosition.TOP_RIGHT;
|
||||
const isShiftTop = anchorPosition === AnchorPosition.BOTTOM_LEFT || anchorPosition === AnchorPosition.BOTTOM_RIGHT;
|
||||
const isShiftLeft = anchorPosition === "BOTTOM_RIGHT" /* BOTTOM_RIGHT */ || anchorPosition === "TOP_RIGHT" /* TOP_RIGHT */;
|
||||
const isShiftTop = anchorPosition === "BOTTOM_LEFT" /* BOTTOM_LEFT */ || anchorPosition === "BOTTOM_RIGHT" /* BOTTOM_RIGHT */;
|
||||
const textFieldWidth = this.measureWidth(ctx);
|
||||
const textFieldHeight = this.measureHeight();
|
||||
const x = isShiftLeft ? this.anchor.x - textFieldWidth : this.anchor.x;
|
||||
|
@ -1168,7 +1174,7 @@ var DrawBoxOptions = class {
|
|||
this.lineWidth = lineWidth || 2;
|
||||
this.label = label;
|
||||
const defaultDrawLabelOptions = {
|
||||
anchorPosition: AnchorPosition.BOTTOM_LEFT,
|
||||
anchorPosition: "BOTTOM_LEFT" /* BOTTOM_LEFT */,
|
||||
backgroundColor: this.boxColor
|
||||
};
|
||||
this.drawLabelOptions = new DrawTextFieldOptions({ ...defaultDrawLabelOptions, ...drawLabelOptions });
|
||||
|
@ -1210,7 +1216,7 @@ function drawDetections(canvasArg, detections) {
|
|||
}
|
||||
|
||||
// src/faceExpressionNet/FaceExpressionNet.ts
|
||||
var tf18 = __toModule(require_tfjs_esm());
|
||||
var tf18 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/dom/isMediaLoaded.ts
|
||||
function isMediaLoaded(media) {
|
||||
|
@ -1297,7 +1303,7 @@ function createCanvasFromMedia(media, dims) {
|
|||
}
|
||||
|
||||
// src/dom/imageTensorToCanvas.ts
|
||||
var tf4 = __toModule(require_tfjs_esm());
|
||||
var tf4 = __toESM(require_tfjs_esm());
|
||||
async function imageTensorToCanvas(imgTensor, canvas) {
|
||||
const targetCanvas = canvas || env.getEnv().createCanvasElement();
|
||||
const [height, width, numChannels] = imgTensor.shape.slice(isTensor4D(imgTensor) ? 1 : 0);
|
||||
|
@ -1314,7 +1320,7 @@ function isMediaElement(input) {
|
|||
}
|
||||
|
||||
// src/dom/NetInput.ts
|
||||
var tf5 = __toModule(require_tfjs_esm());
|
||||
var tf5 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/dom/imageToSquare.ts
|
||||
function imageToSquare(input, inputSize, centerImage = false) {
|
||||
|
@ -1483,7 +1489,7 @@ async function extractFaces(input, detections) {
|
|||
}
|
||||
|
||||
// src/dom/extractFaceTensors.ts
|
||||
var tf6 = __toModule(require_tfjs_esm());
|
||||
var tf6 = __toESM(require_tfjs_esm());
|
||||
async function extractFaceTensors(imageTensor, detections) {
|
||||
if (!isTensor3D(imageTensor) && !isTensor4D(imageTensor)) {
|
||||
throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");
|
||||
|
@ -1560,7 +1566,7 @@ async function fetchVideo(uri) {
|
|||
}
|
||||
|
||||
// src/dom/loadWeightMap.ts
|
||||
var tf7 = __toModule(require_tfjs_esm());
|
||||
var tf7 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/getModelUris.ts
|
||||
function getModelUris(uri, defaultModelName) {
|
||||
|
@ -1605,10 +1611,10 @@ function matchDimensions(input, reference, useMediaDimensions = false) {
|
|||
}
|
||||
|
||||
// src/faceFeatureExtractor/FaceFeatureExtractor.ts
|
||||
var tf15 = __toModule(require_tfjs_esm());
|
||||
var tf15 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/NeuralNetwork.ts
|
||||
var tf8 = __toModule(require_tfjs_esm());
|
||||
var tf8 = __toESM(require_tfjs_esm());
|
||||
var NeuralNetwork = class {
|
||||
constructor(name) {
|
||||
this._params = void 0;
|
||||
|
@ -1724,10 +1730,10 @@ var NeuralNetwork = class {
|
|||
};
|
||||
|
||||
// src/faceFeatureExtractor/denseBlock.ts
|
||||
var tf10 = __toModule(require_tfjs_esm());
|
||||
var tf10 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/depthwiseSeparableConv.ts
|
||||
var tf9 = __toModule(require_tfjs_esm());
|
||||
var tf9 = __toESM(require_tfjs_esm());
|
||||
function depthwiseSeparableConv(x, params, stride) {
|
||||
return tf9.tidy(() => {
|
||||
let out = tf9.separableConv2d(x, params.depthwise_filter, params.pointwise_filter, stride, "same");
|
||||
|
@ -1759,7 +1765,7 @@ function denseBlock4(x, denseBlockParams, isFirstLayer = false, isScaleDown = tr
|
|||
}
|
||||
|
||||
// src/common/convLayer.ts
|
||||
var tf11 = __toModule(require_tfjs_esm());
|
||||
var tf11 = __toESM(require_tfjs_esm());
|
||||
function convLayer(x, params, padding = "same", withRelu = false) {
|
||||
return tf11.tidy(() => {
|
||||
const out = tf11.add(tf11.conv2d(x, params.filters, [1, 1], padding), params.bias);
|
||||
|
@ -1777,7 +1783,7 @@ function disposeUnusedWeightTensors(weightMap, paramMappings) {
|
|||
}
|
||||
|
||||
// src/common/extractConvParamsFactory.ts
|
||||
var tf12 = __toModule(require_tfjs_esm());
|
||||
var tf12 = __toESM(require_tfjs_esm());
|
||||
function extractConvParamsFactory(extractWeights, paramMappings) {
|
||||
return (channelsIn, channelsOut, filterSize, mappedPrefix) => {
|
||||
const filters = tf12.tensor4d(extractWeights(channelsIn * channelsOut * filterSize * filterSize), [filterSize, filterSize, channelsIn, channelsOut]);
|
||||
|
@ -1788,7 +1794,7 @@ function extractConvParamsFactory(extractWeights, paramMappings) {
|
|||
}
|
||||
|
||||
// src/common/extractFCParamsFactory.ts
|
||||
var tf13 = __toModule(require_tfjs_esm());
|
||||
var tf13 = __toESM(require_tfjs_esm());
|
||||
function extractFCParamsFactory(extractWeights, paramMappings) {
|
||||
return (channelsIn, channelsOut, mappedPrefix) => {
|
||||
const fc_weights = tf13.tensor2d(extractWeights(channelsIn * channelsOut), [channelsIn, channelsOut]);
|
||||
|
@ -1802,7 +1808,7 @@ function extractFCParamsFactory(extractWeights, paramMappings) {
|
|||
}
|
||||
|
||||
// src/common/extractSeparableConvParamsFactory.ts
|
||||
var tf14 = __toModule(require_tfjs_esm());
|
||||
var tf14 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/types.ts
|
||||
var SeparableConvParams = class {
|
||||
|
@ -2006,10 +2012,10 @@ var FaceFeatureExtractor = class extends NeuralNetwork {
|
|||
};
|
||||
|
||||
// src/faceProcessor/FaceProcessor.ts
|
||||
var tf17 = __toModule(require_tfjs_esm());
|
||||
var tf17 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/fullyConnectedLayer.ts
|
||||
var tf16 = __toModule(require_tfjs_esm());
|
||||
var tf16 = __toESM(require_tfjs_esm());
|
||||
function fullyConnectedLayer(x, params) {
|
||||
return tf16.tidy(() => tf16.add(tf16.matMul(x, params.weights), params.bias));
|
||||
}
|
||||
|
@ -2291,13 +2297,13 @@ function drawFaceLandmarks(canvasArg, faceLandmarks) {
|
|||
}
|
||||
|
||||
// package.json
|
||||
var version = "1.6.3";
|
||||
var version = "1.6.4";
|
||||
|
||||
// src/ageGenderNet/AgeGenderNet.ts
|
||||
var tf20 = __toModule(require_tfjs_esm());
|
||||
var tf20 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/xception/TinyXception.ts
|
||||
var tf19 = __toModule(require_tfjs_esm());
|
||||
var tf19 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/xception/extractParams.ts
|
||||
function extractorsFactory2(extractWeights, paramMappings) {
|
||||
|
@ -2512,11 +2518,11 @@ function extractParamsFromWeightMap4(weightMap) {
|
|||
}
|
||||
|
||||
// src/ageGenderNet/types.ts
|
||||
var Gender;
|
||||
(function(Gender2) {
|
||||
var Gender = /* @__PURE__ */ ((Gender2) => {
|
||||
Gender2["FEMALE"] = "female";
|
||||
Gender2["MALE"] = "male";
|
||||
})(Gender || (Gender = {}));
|
||||
return Gender2;
|
||||
})(Gender || {});
|
||||
|
||||
// src/ageGenderNet/AgeGenderNet.ts
|
||||
var AgeGenderNet = class extends NeuralNetwork {
|
||||
|
@ -2562,7 +2568,7 @@ var AgeGenderNet = class extends NeuralNetwork {
|
|||
const age = ageTensor.dataSync()[0];
|
||||
const probMale = genderTensor.dataSync()[0];
|
||||
const isMale = probMale > 0.5;
|
||||
const gender = isMale ? Gender.MALE : Gender.FEMALE;
|
||||
const gender = isMale ? "male" /* MALE */ : "female" /* FEMALE */;
|
||||
const genderProbability = isMale ? probMale : 1 - probMale;
|
||||
ageTensor.dispose();
|
||||
genderTensor.dispose();
|
||||
|
@ -2602,7 +2608,7 @@ var AgeGenderNet = class extends NeuralNetwork {
|
|||
};
|
||||
|
||||
// src/faceLandmarkNet/FaceLandmark68NetBase.ts
|
||||
var tf21 = __toModule(require_tfjs_esm());
|
||||
var tf21 = __toESM(require_tfjs_esm());
|
||||
var FaceLandmark68NetBase = class extends FaceProcessor {
|
||||
postProcess(output, inputSize, originalDimensions) {
|
||||
const inputDimensions = originalDimensions.map(({ width, height }) => {
|
||||
|
@ -2668,7 +2674,7 @@ var FaceLandmark68Net = class extends FaceLandmark68NetBase {
|
|||
};
|
||||
|
||||
// src/faceFeatureExtractor/TinyFaceFeatureExtractor.ts
|
||||
var tf22 = __toModule(require_tfjs_esm());
|
||||
var tf22 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/faceFeatureExtractor/extractParamsFromWeightMapTiny.ts
|
||||
function extractParamsFromWeightMapTiny(weightMap) {
|
||||
|
@ -2760,13 +2766,13 @@ var FaceLandmarkNet = class extends FaceLandmark68Net {
|
|||
};
|
||||
|
||||
// src/faceRecognitionNet/FaceRecognitionNet.ts
|
||||
var tf27 = __toModule(require_tfjs_esm());
|
||||
var tf27 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/faceRecognitionNet/convLayer.ts
|
||||
var tf24 = __toModule(require_tfjs_esm());
|
||||
var tf24 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/faceRecognitionNet/scaleLayer.ts
|
||||
var tf23 = __toModule(require_tfjs_esm());
|
||||
var tf23 = __toESM(require_tfjs_esm());
|
||||
function scale(x, params) {
|
||||
return tf23.add(tf23.mul(x, params.weights), params.biases);
|
||||
}
|
||||
|
@ -2790,7 +2796,7 @@ function convDown(x, params) {
|
|||
}
|
||||
|
||||
// src/faceRecognitionNet/extractParams.ts
|
||||
var tf25 = __toModule(require_tfjs_esm());
|
||||
var tf25 = __toESM(require_tfjs_esm());
|
||||
function extractorsFactory3(extractWeights, paramMappings) {
|
||||
function extractFilterValues(numFilterValues, numFilters, filterSize) {
|
||||
const weights = extractWeights(numFilterValues);
|
||||
|
@ -2955,7 +2961,7 @@ function extractParamsFromWeightMap5(weightMap) {
|
|||
}
|
||||
|
||||
// src/faceRecognitionNet/residualLayer.ts
|
||||
var tf26 = __toModule(require_tfjs_esm());
|
||||
var tf26 = __toESM(require_tfjs_esm());
|
||||
function residual(x, params) {
|
||||
let out = conv2(x, params.conv1);
|
||||
out = convNoRelu(out, params.conv2);
|
||||
|
@ -3069,7 +3075,7 @@ function extendWithAge(sourceObj, age) {
|
|||
|
||||
// src/factories/WithGender.ts
|
||||
function isWithGender(obj) {
|
||||
return (obj.gender === Gender.MALE || obj.gender === Gender.FEMALE) && isValidProbablitiy(obj.genderProbability);
|
||||
return (obj.gender === "male" /* MALE */ || obj.gender === "female" /* FEMALE */) && isValidProbablitiy(obj.genderProbability);
|
||||
}
|
||||
function extendWithGender(sourceObj, gender, genderProbability) {
|
||||
const extension = { gender, genderProbability };
|
||||
|
@ -3077,10 +3083,10 @@ function extendWithGender(sourceObj, gender, genderProbability) {
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/SsdMobilenetv1.ts
|
||||
var tf34 = __toModule(require_tfjs_esm());
|
||||
var tf34 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/ssdMobilenetv1/extractParams.ts
|
||||
var tf28 = __toModule(require_tfjs_esm());
|
||||
var tf28 = __toESM(require_tfjs_esm());
|
||||
function extractorsFactory5(extractWeights, paramMappings) {
|
||||
function extractDepthwiseConvParams(numChannels, mappedPrefix) {
|
||||
const filters = tf28.tensor4d(extractWeights(3 * 3 * numChannels), [3, 3, numChannels, 1]);
|
||||
|
@ -3350,10 +3356,10 @@ function extractParamsFromWeightMap6(weightMap) {
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/mobileNetV1.ts
|
||||
var tf30 = __toModule(require_tfjs_esm());
|
||||
var tf30 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/ssdMobilenetv1/pointwiseConvLayer.ts
|
||||
var tf29 = __toModule(require_tfjs_esm());
|
||||
var tf29 = __toESM(require_tfjs_esm());
|
||||
function pointwiseConvLayer(x, params, strides) {
|
||||
return tf29.tidy(() => {
|
||||
let out = tf29.conv2d(x, params.filters, strides, "same");
|
||||
|
@ -3459,7 +3465,7 @@ function nonMaxSuppression2(boxes, scores, maxOutputSize, iouThreshold, scoreThr
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/outputLayer.ts
|
||||
var tf31 = __toModule(require_tfjs_esm());
|
||||
var tf31 = __toESM(require_tfjs_esm());
|
||||
function getCenterCoordinatesAndSizesLayer(x) {
|
||||
const vec = tf31.unstack(tf31.transpose(x, [1, 0]));
|
||||
const sizes = [
|
||||
|
@ -3501,10 +3507,10 @@ function outputLayer(boxPredictions, classPredictions, params) {
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/predictionLayer.ts
|
||||
var tf33 = __toModule(require_tfjs_esm());
|
||||
var tf33 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/ssdMobilenetv1/boxPredictionLayer.ts
|
||||
var tf32 = __toModule(require_tfjs_esm());
|
||||
var tf32 = __toESM(require_tfjs_esm());
|
||||
function boxPredictionLayer(x, params) {
|
||||
return tf32.tidy(() => {
|
||||
const batchSize = x.shape[0];
|
||||
|
@ -3672,7 +3678,7 @@ var DEFAULT_MODEL_NAME = "tiny_yolov2_model";
|
|||
var DEFAULT_MODEL_NAME_SEPARABLE_CONV = "tiny_yolov2_separable_conv_model";
|
||||
|
||||
// src/tinyYolov2/TinyYolov2Base.ts
|
||||
var tf39 = __toModule(require_tfjs_esm());
|
||||
var tf39 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/tinyYolov2/config.ts
|
||||
var isNumber = (arg) => typeof arg === "number";
|
||||
|
@ -3698,10 +3704,10 @@ function validateConfig(config) {
|
|||
}
|
||||
|
||||
// src/tinyYolov2/convWithBatchNorm.ts
|
||||
var tf36 = __toModule(require_tfjs_esm());
|
||||
var tf36 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/tinyYolov2/leaky.ts
|
||||
var tf35 = __toModule(require_tfjs_esm());
|
||||
var tf35 = __toESM(require_tfjs_esm());
|
||||
function leaky(x) {
|
||||
return tf35.tidy(() => {
|
||||
const min = tf35.mul(x, tf35.scalar(0.10000000149011612));
|
||||
|
@ -3722,7 +3728,7 @@ function convWithBatchNorm(x, params) {
|
|||
}
|
||||
|
||||
// src/tinyYolov2/depthwiseSeparableConv.ts
|
||||
var tf37 = __toModule(require_tfjs_esm());
|
||||
var tf37 = __toESM(require_tfjs_esm());
|
||||
function depthwiseSeparableConv2(x, params) {
|
||||
return tf37.tidy(() => {
|
||||
let out = tf37.pad(x, [[0, 0], [1, 1], [1, 1], [0, 0]]);
|
||||
|
@ -3733,7 +3739,7 @@ function depthwiseSeparableConv2(x, params) {
|
|||
}
|
||||
|
||||
// src/tinyYolov2/extractParams.ts
|
||||
var tf38 = __toModule(require_tfjs_esm());
|
||||
var tf38 = __toESM(require_tfjs_esm());
|
||||
function extractorsFactory7(extractWeights, paramMappings) {
|
||||
const extractConvParams = extractConvParamsFactory(extractWeights, paramMappings);
|
||||
function extractBatchNormParams(size, mappedPrefix) {
|
||||
|
@ -4119,10 +4125,10 @@ var ComposableTask = class {
|
|||
};
|
||||
|
||||
// src/globalApi/DetectFaceLandmarksTasks.ts
|
||||
var tf41 = __toModule(require_tfjs_esm());
|
||||
var tf41 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/globalApi/extractFacesAndComputeResults.ts
|
||||
var tf40 = __toModule(require_tfjs_esm());
|
||||
var tf40 = __toESM(require_tfjs_esm());
|
||||
async function extractAllFacesAndComputeResults(parentResults, input, computeResults, extractedFaces, getRectForAlignment = ({ alignedRect }) => alignedRect) {
|
||||
const faceBoxes = parentResults.map((parentResult) => isWithFaceLandmarks(parentResult) ? getRectForAlignment(parentResult) : parentResult.detection);
|
||||
const faces = extractedFaces || (input instanceof tf40.Tensor ? await extractFaceTensors(input, faceBoxes) : await extractFaces(input, faceBoxes));
|
||||
|
@ -4565,6 +4571,7 @@ function resizeResults(results, dimensions) {
|
|||
|
||||
// src/index.ts
|
||||
var version2 = version;
|
||||
module.exports = __toCommonJS(src_exports);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
AgeGenderNet,
|
||||
|
|
|
@ -12,53 +12,59 @@ var __getProtoOf = Object.getPrototypeOf;
|
|||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
||||
var __commonJS = (cb, mod) => function __require() {
|
||||
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
};
|
||||
var __export = (target, all) => {
|
||||
__markAsModule(target);
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __reExport = (target, module2, desc) => {
|
||||
var __reExport = (target, module2, copyDefault, desc) => {
|
||||
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
||||
for (let key of __getOwnPropNames(module2))
|
||||
if (!__hasOwnProp.call(target, key) && key !== "default")
|
||||
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
||||
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
||||
}
|
||||
return target;
|
||||
};
|
||||
var __toModule = (module2) => {
|
||||
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
||||
var __toESM = (module2, isNodeMode) => {
|
||||
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
||||
};
|
||||
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
||||
return (module2, temp) => {
|
||||
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
||||
};
|
||||
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
||||
|
||||
// dist/tfjs.esm.js
|
||||
var require_tfjs_esm = __commonJS({
|
||||
"dist/tfjs.esm.js"(exports) {
|
||||
var __create2 = Object.create;
|
||||
"dist/tfjs.esm.js"(exports, module2) {
|
||||
var __defProp2 = Object.defineProperty;
|
||||
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
||||
var __getProtoOf2 = Object.getPrototypeOf;
|
||||
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
||||
var __markAsModule2 = (target) => __defProp2(target, "__esModule", { value: true });
|
||||
var __reExport2 = (target, module22, desc) => {
|
||||
var __reExport2 = (target, module22, copyDefault, desc) => {
|
||||
if (module22 && typeof module22 === "object" || typeof module22 === "function") {
|
||||
for (let key of __getOwnPropNames2(module22))
|
||||
if (!__hasOwnProp2.call(target, key) && key !== "default")
|
||||
if (!__hasOwnProp2.call(target, key) && (copyDefault || key !== "default"))
|
||||
__defProp2(target, key, { get: () => module22[key], enumerable: !(desc = __getOwnPropDesc2(module22, key)) || desc.enumerable });
|
||||
}
|
||||
return target;
|
||||
};
|
||||
var __toModule2 = (module22) => {
|
||||
return __reExport2(__markAsModule2(__defProp2(module22 != null ? __create2(__getProtoOf2(module22)) : {}, "default", module22 && module22.__esModule && "default" in module22 ? { get: () => module22.default, enumerable: true } : { value: module22, enumerable: true })), module22);
|
||||
};
|
||||
__markAsModule2(exports);
|
||||
__reExport2(exports, __toModule2(require("@tensorflow/tfjs-node")));
|
||||
var __toCommonJS2 = ((cache) => {
|
||||
return (module22, temp) => {
|
||||
return cache && cache.get(module22) || (temp = __reExport2(__markAsModule2({}), module22, 1), cache && cache.set(module22, temp), temp);
|
||||
};
|
||||
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
||||
var tf_node_exports = {};
|
||||
__reExport2(tf_node_exports, require("@tensorflow/tfjs-node"));
|
||||
module2.exports = __toCommonJS2(tf_node_exports);
|
||||
}
|
||||
});
|
||||
|
||||
// src/index.ts
|
||||
__export(exports, {
|
||||
var src_exports = {};
|
||||
__export(src_exports, {
|
||||
AgeGenderNet: () => AgeGenderNet,
|
||||
BoundingBox: () => BoundingBox,
|
||||
Box: () => Box,
|
||||
|
@ -181,7 +187,7 @@ __export(exports, {
|
|||
validateConfig: () => validateConfig,
|
||||
version: () => version2
|
||||
});
|
||||
var tf42 = __toModule(require_tfjs_esm());
|
||||
var tf42 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/draw/index.ts
|
||||
var draw_exports = {};
|
||||
|
@ -237,7 +243,7 @@ __export(utils_exports, {
|
|||
range: () => range,
|
||||
round: () => round
|
||||
});
|
||||
var tf = __toModule(require_tfjs_esm());
|
||||
var tf = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/classes/Dimensions.ts
|
||||
var Dimensions = class {
|
||||
|
@ -643,7 +649,7 @@ function nonMaxSuppression(boxes, scores, iouThreshold, isIOU = true) {
|
|||
}
|
||||
|
||||
// src/ops/normalize.ts
|
||||
var tf2 = __toModule(require_tfjs_esm());
|
||||
var tf2 = __toESM(require_tfjs_esm());
|
||||
function normalize(x, meanRgb) {
|
||||
return tf2.tidy(() => {
|
||||
const [r, g, b] = meanRgb;
|
||||
|
@ -656,7 +662,7 @@ function normalize(x, meanRgb) {
|
|||
}
|
||||
|
||||
// src/ops/padToSquare.ts
|
||||
var tf3 = __toModule(require_tfjs_esm());
|
||||
var tf3 = __toESM(require_tfjs_esm());
|
||||
function padToSquare(imgTensor, isCenterImage = false) {
|
||||
return tf3.tidy(() => {
|
||||
const [height, width] = imgTensor.shape.slice(1);
|
||||
|
@ -1074,13 +1080,13 @@ function getContext2dOrThrow(canvasArg) {
|
|||
}
|
||||
|
||||
// src/draw/DrawTextField.ts
|
||||
var AnchorPosition;
|
||||
(function(AnchorPosition2) {
|
||||
var AnchorPosition = /* @__PURE__ */ ((AnchorPosition2) => {
|
||||
AnchorPosition2["TOP_LEFT"] = "TOP_LEFT";
|
||||
AnchorPosition2["TOP_RIGHT"] = "TOP_RIGHT";
|
||||
AnchorPosition2["BOTTOM_LEFT"] = "BOTTOM_LEFT";
|
||||
AnchorPosition2["BOTTOM_RIGHT"] = "BOTTOM_RIGHT";
|
||||
})(AnchorPosition || (AnchorPosition = {}));
|
||||
return AnchorPosition2;
|
||||
})(AnchorPosition || {});
|
||||
var DrawTextFieldOptions = class {
|
||||
constructor(options = {}) {
|
||||
const {
|
||||
|
@ -1091,7 +1097,7 @@ var DrawTextFieldOptions = class {
|
|||
fontStyle,
|
||||
padding
|
||||
} = options;
|
||||
this.anchorPosition = anchorPosition || AnchorPosition.TOP_LEFT;
|
||||
this.anchorPosition = anchorPosition || "TOP_LEFT" /* TOP_LEFT */;
|
||||
this.backgroundColor = backgroundColor || "rgba(0, 0, 0, 0.5)";
|
||||
this.fontColor = fontColor || "rgba(255, 255, 255, 1)";
|
||||
this.fontSize = fontSize || 14;
|
||||
|
@ -1115,8 +1121,8 @@ var DrawTextField = class {
|
|||
}
|
||||
getUpperLeft(ctx, canvasDims) {
|
||||
const { anchorPosition } = this.options;
|
||||
const isShiftLeft = anchorPosition === AnchorPosition.BOTTOM_RIGHT || anchorPosition === AnchorPosition.TOP_RIGHT;
|
||||
const isShiftTop = anchorPosition === AnchorPosition.BOTTOM_LEFT || anchorPosition === AnchorPosition.BOTTOM_RIGHT;
|
||||
const isShiftLeft = anchorPosition === "BOTTOM_RIGHT" /* BOTTOM_RIGHT */ || anchorPosition === "TOP_RIGHT" /* TOP_RIGHT */;
|
||||
const isShiftTop = anchorPosition === "BOTTOM_LEFT" /* BOTTOM_LEFT */ || anchorPosition === "BOTTOM_RIGHT" /* BOTTOM_RIGHT */;
|
||||
const textFieldWidth = this.measureWidth(ctx);
|
||||
const textFieldHeight = this.measureHeight();
|
||||
const x = isShiftLeft ? this.anchor.x - textFieldWidth : this.anchor.x;
|
||||
|
@ -1167,7 +1173,7 @@ var DrawBoxOptions = class {
|
|||
this.lineWidth = lineWidth || 2;
|
||||
this.label = label;
|
||||
const defaultDrawLabelOptions = {
|
||||
anchorPosition: AnchorPosition.BOTTOM_LEFT,
|
||||
anchorPosition: "BOTTOM_LEFT" /* BOTTOM_LEFT */,
|
||||
backgroundColor: this.boxColor
|
||||
};
|
||||
this.drawLabelOptions = new DrawTextFieldOptions({ ...defaultDrawLabelOptions, ...drawLabelOptions });
|
||||
|
@ -1209,7 +1215,7 @@ function drawDetections(canvasArg, detections) {
|
|||
}
|
||||
|
||||
// src/faceExpressionNet/FaceExpressionNet.ts
|
||||
var tf18 = __toModule(require_tfjs_esm());
|
||||
var tf18 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/dom/isMediaLoaded.ts
|
||||
function isMediaLoaded(media) {
|
||||
|
@ -1296,7 +1302,7 @@ function createCanvasFromMedia(media, dims) {
|
|||
}
|
||||
|
||||
// src/dom/imageTensorToCanvas.ts
|
||||
var tf4 = __toModule(require_tfjs_esm());
|
||||
var tf4 = __toESM(require_tfjs_esm());
|
||||
async function imageTensorToCanvas(imgTensor, canvas) {
|
||||
const targetCanvas = canvas || env.getEnv().createCanvasElement();
|
||||
const [height, width, numChannels] = imgTensor.shape.slice(isTensor4D(imgTensor) ? 1 : 0);
|
||||
|
@ -1313,7 +1319,7 @@ function isMediaElement(input) {
|
|||
}
|
||||
|
||||
// src/dom/NetInput.ts
|
||||
var tf5 = __toModule(require_tfjs_esm());
|
||||
var tf5 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/dom/imageToSquare.ts
|
||||
function imageToSquare(input, inputSize, centerImage = false) {
|
||||
|
@ -1482,7 +1488,7 @@ async function extractFaces(input, detections) {
|
|||
}
|
||||
|
||||
// src/dom/extractFaceTensors.ts
|
||||
var tf6 = __toModule(require_tfjs_esm());
|
||||
var tf6 = __toESM(require_tfjs_esm());
|
||||
async function extractFaceTensors(imageTensor, detections) {
|
||||
if (!isTensor3D(imageTensor) && !isTensor4D(imageTensor)) {
|
||||
throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");
|
||||
|
@ -1559,7 +1565,7 @@ async function fetchVideo(uri) {
|
|||
}
|
||||
|
||||
// src/dom/loadWeightMap.ts
|
||||
var tf7 = __toModule(require_tfjs_esm());
|
||||
var tf7 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/getModelUris.ts
|
||||
function getModelUris(uri, defaultModelName) {
|
||||
|
@ -1604,10 +1610,10 @@ function matchDimensions(input, reference, useMediaDimensions = false) {
|
|||
}
|
||||
|
||||
// src/faceFeatureExtractor/FaceFeatureExtractor.ts
|
||||
var tf15 = __toModule(require_tfjs_esm());
|
||||
var tf15 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/NeuralNetwork.ts
|
||||
var tf8 = __toModule(require_tfjs_esm());
|
||||
var tf8 = __toESM(require_tfjs_esm());
|
||||
var NeuralNetwork = class {
|
||||
constructor(name) {
|
||||
this._params = void 0;
|
||||
|
@ -1723,10 +1729,10 @@ var NeuralNetwork = class {
|
|||
};
|
||||
|
||||
// src/faceFeatureExtractor/denseBlock.ts
|
||||
var tf10 = __toModule(require_tfjs_esm());
|
||||
var tf10 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/depthwiseSeparableConv.ts
|
||||
var tf9 = __toModule(require_tfjs_esm());
|
||||
var tf9 = __toESM(require_tfjs_esm());
|
||||
function depthwiseSeparableConv(x, params, stride) {
|
||||
return tf9.tidy(() => {
|
||||
let out = tf9.separableConv2d(x, params.depthwise_filter, params.pointwise_filter, stride, "same");
|
||||
|
@ -1758,7 +1764,7 @@ function denseBlock4(x, denseBlockParams, isFirstLayer = false, isScaleDown = tr
|
|||
}
|
||||
|
||||
// src/common/convLayer.ts
|
||||
var tf11 = __toModule(require_tfjs_esm());
|
||||
var tf11 = __toESM(require_tfjs_esm());
|
||||
function convLayer(x, params, padding = "same", withRelu = false) {
|
||||
return tf11.tidy(() => {
|
||||
const out = tf11.add(tf11.conv2d(x, params.filters, [1, 1], padding), params.bias);
|
||||
|
@ -1776,7 +1782,7 @@ function disposeUnusedWeightTensors(weightMap, paramMappings) {
|
|||
}
|
||||
|
||||
// src/common/extractConvParamsFactory.ts
|
||||
var tf12 = __toModule(require_tfjs_esm());
|
||||
var tf12 = __toESM(require_tfjs_esm());
|
||||
function extractConvParamsFactory(extractWeights, paramMappings) {
|
||||
return (channelsIn, channelsOut, filterSize, mappedPrefix) => {
|
||||
const filters = tf12.tensor4d(extractWeights(channelsIn * channelsOut * filterSize * filterSize), [filterSize, filterSize, channelsIn, channelsOut]);
|
||||
|
@ -1787,7 +1793,7 @@ function extractConvParamsFactory(extractWeights, paramMappings) {
|
|||
}
|
||||
|
||||
// src/common/extractFCParamsFactory.ts
|
||||
var tf13 = __toModule(require_tfjs_esm());
|
||||
var tf13 = __toESM(require_tfjs_esm());
|
||||
function extractFCParamsFactory(extractWeights, paramMappings) {
|
||||
return (channelsIn, channelsOut, mappedPrefix) => {
|
||||
const fc_weights = tf13.tensor2d(extractWeights(channelsIn * channelsOut), [channelsIn, channelsOut]);
|
||||
|
@ -1801,7 +1807,7 @@ function extractFCParamsFactory(extractWeights, paramMappings) {
|
|||
}
|
||||
|
||||
// src/common/extractSeparableConvParamsFactory.ts
|
||||
var tf14 = __toModule(require_tfjs_esm());
|
||||
var tf14 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/types.ts
|
||||
var SeparableConvParams = class {
|
||||
|
@ -2005,10 +2011,10 @@ var FaceFeatureExtractor = class extends NeuralNetwork {
|
|||
};
|
||||
|
||||
// src/faceProcessor/FaceProcessor.ts
|
||||
var tf17 = __toModule(require_tfjs_esm());
|
||||
var tf17 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/common/fullyConnectedLayer.ts
|
||||
var tf16 = __toModule(require_tfjs_esm());
|
||||
var tf16 = __toESM(require_tfjs_esm());
|
||||
function fullyConnectedLayer(x, params) {
|
||||
return tf16.tidy(() => tf16.add(tf16.matMul(x, params.weights), params.bias));
|
||||
}
|
||||
|
@ -2290,13 +2296,13 @@ function drawFaceLandmarks(canvasArg, faceLandmarks) {
|
|||
}
|
||||
|
||||
// package.json
|
||||
var version = "1.6.3";
|
||||
var version = "1.6.4";
|
||||
|
||||
// src/ageGenderNet/AgeGenderNet.ts
|
||||
var tf20 = __toModule(require_tfjs_esm());
|
||||
var tf20 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/xception/TinyXception.ts
|
||||
var tf19 = __toModule(require_tfjs_esm());
|
||||
var tf19 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/xception/extractParams.ts
|
||||
function extractorsFactory2(extractWeights, paramMappings) {
|
||||
|
@ -2511,11 +2517,11 @@ function extractParamsFromWeightMap4(weightMap) {
|
|||
}
|
||||
|
||||
// src/ageGenderNet/types.ts
|
||||
var Gender;
|
||||
(function(Gender2) {
|
||||
var Gender = /* @__PURE__ */ ((Gender2) => {
|
||||
Gender2["FEMALE"] = "female";
|
||||
Gender2["MALE"] = "male";
|
||||
})(Gender || (Gender = {}));
|
||||
return Gender2;
|
||||
})(Gender || {});
|
||||
|
||||
// src/ageGenderNet/AgeGenderNet.ts
|
||||
var AgeGenderNet = class extends NeuralNetwork {
|
||||
|
@ -2561,7 +2567,7 @@ var AgeGenderNet = class extends NeuralNetwork {
|
|||
const age = ageTensor.dataSync()[0];
|
||||
const probMale = genderTensor.dataSync()[0];
|
||||
const isMale = probMale > 0.5;
|
||||
const gender = isMale ? Gender.MALE : Gender.FEMALE;
|
||||
const gender = isMale ? "male" /* MALE */ : "female" /* FEMALE */;
|
||||
const genderProbability = isMale ? probMale : 1 - probMale;
|
||||
ageTensor.dispose();
|
||||
genderTensor.dispose();
|
||||
|
@ -2601,7 +2607,7 @@ var AgeGenderNet = class extends NeuralNetwork {
|
|||
};
|
||||
|
||||
// src/faceLandmarkNet/FaceLandmark68NetBase.ts
|
||||
var tf21 = __toModule(require_tfjs_esm());
|
||||
var tf21 = __toESM(require_tfjs_esm());
|
||||
var FaceLandmark68NetBase = class extends FaceProcessor {
|
||||
postProcess(output, inputSize, originalDimensions) {
|
||||
const inputDimensions = originalDimensions.map(({ width, height }) => {
|
||||
|
@ -2667,7 +2673,7 @@ var FaceLandmark68Net = class extends FaceLandmark68NetBase {
|
|||
};
|
||||
|
||||
// src/faceFeatureExtractor/TinyFaceFeatureExtractor.ts
|
||||
var tf22 = __toModule(require_tfjs_esm());
|
||||
var tf22 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/faceFeatureExtractor/extractParamsFromWeightMapTiny.ts
|
||||
function extractParamsFromWeightMapTiny(weightMap) {
|
||||
|
@ -2759,13 +2765,13 @@ var FaceLandmarkNet = class extends FaceLandmark68Net {
|
|||
};
|
||||
|
||||
// src/faceRecognitionNet/FaceRecognitionNet.ts
|
||||
var tf27 = __toModule(require_tfjs_esm());
|
||||
var tf27 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/faceRecognitionNet/convLayer.ts
|
||||
var tf24 = __toModule(require_tfjs_esm());
|
||||
var tf24 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/faceRecognitionNet/scaleLayer.ts
|
||||
var tf23 = __toModule(require_tfjs_esm());
|
||||
var tf23 = __toESM(require_tfjs_esm());
|
||||
function scale(x, params) {
|
||||
return tf23.add(tf23.mul(x, params.weights), params.biases);
|
||||
}
|
||||
|
@ -2789,7 +2795,7 @@ function convDown(x, params) {
|
|||
}
|
||||
|
||||
// src/faceRecognitionNet/extractParams.ts
|
||||
var tf25 = __toModule(require_tfjs_esm());
|
||||
var tf25 = __toESM(require_tfjs_esm());
|
||||
function extractorsFactory3(extractWeights, paramMappings) {
|
||||
function extractFilterValues(numFilterValues, numFilters, filterSize) {
|
||||
const weights = extractWeights(numFilterValues);
|
||||
|
@ -2954,7 +2960,7 @@ function extractParamsFromWeightMap5(weightMap) {
|
|||
}
|
||||
|
||||
// src/faceRecognitionNet/residualLayer.ts
|
||||
var tf26 = __toModule(require_tfjs_esm());
|
||||
var tf26 = __toESM(require_tfjs_esm());
|
||||
function residual(x, params) {
|
||||
let out = conv2(x, params.conv1);
|
||||
out = convNoRelu(out, params.conv2);
|
||||
|
@ -3068,7 +3074,7 @@ function extendWithAge(sourceObj, age) {
|
|||
|
||||
// src/factories/WithGender.ts
|
||||
function isWithGender(obj) {
|
||||
return (obj.gender === Gender.MALE || obj.gender === Gender.FEMALE) && isValidProbablitiy(obj.genderProbability);
|
||||
return (obj.gender === "male" /* MALE */ || obj.gender === "female" /* FEMALE */) && isValidProbablitiy(obj.genderProbability);
|
||||
}
|
||||
function extendWithGender(sourceObj, gender, genderProbability) {
|
||||
const extension = { gender, genderProbability };
|
||||
|
@ -3076,10 +3082,10 @@ function extendWithGender(sourceObj, gender, genderProbability) {
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/SsdMobilenetv1.ts
|
||||
var tf34 = __toModule(require_tfjs_esm());
|
||||
var tf34 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/ssdMobilenetv1/extractParams.ts
|
||||
var tf28 = __toModule(require_tfjs_esm());
|
||||
var tf28 = __toESM(require_tfjs_esm());
|
||||
function extractorsFactory5(extractWeights, paramMappings) {
|
||||
function extractDepthwiseConvParams(numChannels, mappedPrefix) {
|
||||
const filters = tf28.tensor4d(extractWeights(3 * 3 * numChannels), [3, 3, numChannels, 1]);
|
||||
|
@ -3349,10 +3355,10 @@ function extractParamsFromWeightMap6(weightMap) {
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/mobileNetV1.ts
|
||||
var tf30 = __toModule(require_tfjs_esm());
|
||||
var tf30 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/ssdMobilenetv1/pointwiseConvLayer.ts
|
||||
var tf29 = __toModule(require_tfjs_esm());
|
||||
var tf29 = __toESM(require_tfjs_esm());
|
||||
function pointwiseConvLayer(x, params, strides) {
|
||||
return tf29.tidy(() => {
|
||||
let out = tf29.conv2d(x, params.filters, strides, "same");
|
||||
|
@ -3458,7 +3464,7 @@ function nonMaxSuppression2(boxes, scores, maxOutputSize, iouThreshold, scoreThr
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/outputLayer.ts
|
||||
var tf31 = __toModule(require_tfjs_esm());
|
||||
var tf31 = __toESM(require_tfjs_esm());
|
||||
function getCenterCoordinatesAndSizesLayer(x) {
|
||||
const vec = tf31.unstack(tf31.transpose(x, [1, 0]));
|
||||
const sizes = [
|
||||
|
@ -3500,10 +3506,10 @@ function outputLayer(boxPredictions, classPredictions, params) {
|
|||
}
|
||||
|
||||
// src/ssdMobilenetv1/predictionLayer.ts
|
||||
var tf33 = __toModule(require_tfjs_esm());
|
||||
var tf33 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/ssdMobilenetv1/boxPredictionLayer.ts
|
||||
var tf32 = __toModule(require_tfjs_esm());
|
||||
var tf32 = __toESM(require_tfjs_esm());
|
||||
function boxPredictionLayer(x, params) {
|
||||
return tf32.tidy(() => {
|
||||
const batchSize = x.shape[0];
|
||||
|
@ -3671,7 +3677,7 @@ var DEFAULT_MODEL_NAME = "tiny_yolov2_model";
|
|||
var DEFAULT_MODEL_NAME_SEPARABLE_CONV = "tiny_yolov2_separable_conv_model";
|
||||
|
||||
// src/tinyYolov2/TinyYolov2Base.ts
|
||||
var tf39 = __toModule(require_tfjs_esm());
|
||||
var tf39 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/tinyYolov2/config.ts
|
||||
var isNumber = (arg) => typeof arg === "number";
|
||||
|
@ -3697,10 +3703,10 @@ function validateConfig(config) {
|
|||
}
|
||||
|
||||
// src/tinyYolov2/convWithBatchNorm.ts
|
||||
var tf36 = __toModule(require_tfjs_esm());
|
||||
var tf36 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/tinyYolov2/leaky.ts
|
||||
var tf35 = __toModule(require_tfjs_esm());
|
||||
var tf35 = __toESM(require_tfjs_esm());
|
||||
function leaky(x) {
|
||||
return tf35.tidy(() => {
|
||||
const min = tf35.mul(x, tf35.scalar(0.10000000149011612));
|
||||
|
@ -3721,7 +3727,7 @@ function convWithBatchNorm(x, params) {
|
|||
}
|
||||
|
||||
// src/tinyYolov2/depthwiseSeparableConv.ts
|
||||
var tf37 = __toModule(require_tfjs_esm());
|
||||
var tf37 = __toESM(require_tfjs_esm());
|
||||
function depthwiseSeparableConv2(x, params) {
|
||||
return tf37.tidy(() => {
|
||||
let out = tf37.pad(x, [[0, 0], [1, 1], [1, 1], [0, 0]]);
|
||||
|
@ -3732,7 +3738,7 @@ function depthwiseSeparableConv2(x, params) {
|
|||
}
|
||||
|
||||
// src/tinyYolov2/extractParams.ts
|
||||
var tf38 = __toModule(require_tfjs_esm());
|
||||
var tf38 = __toESM(require_tfjs_esm());
|
||||
function extractorsFactory7(extractWeights, paramMappings) {
|
||||
const extractConvParams = extractConvParamsFactory(extractWeights, paramMappings);
|
||||
function extractBatchNormParams(size, mappedPrefix) {
|
||||
|
@ -4118,10 +4124,10 @@ var ComposableTask = class {
|
|||
};
|
||||
|
||||
// src/globalApi/DetectFaceLandmarksTasks.ts
|
||||
var tf41 = __toModule(require_tfjs_esm());
|
||||
var tf41 = __toESM(require_tfjs_esm());
|
||||
|
||||
// src/globalApi/extractFacesAndComputeResults.ts
|
||||
var tf40 = __toModule(require_tfjs_esm());
|
||||
var tf40 = __toESM(require_tfjs_esm());
|
||||
async function extractAllFacesAndComputeResults(parentResults, input, computeResults, extractedFaces, getRectForAlignment = ({ alignedRect }) => alignedRect) {
|
||||
const faceBoxes = parentResults.map((parentResult) => isWithFaceLandmarks(parentResult) ? getRectForAlignment(parentResult) : parentResult.detection);
|
||||
const faces = extractedFaces || (input instanceof tf40.Tensor ? await extractFaceTensors(input, faceBoxes) : await extractFaces(input, faceBoxes));
|
||||
|
@ -4564,6 +4570,7 @@ function resizeResults(results, dimensions) {
|
|||
|
||||
// src/index.ts
|
||||
var version2 = version;
|
||||
module.exports = __toCommonJS(src_exports);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
AgeGenderNet,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,29 +4,29 @@
|
|||
author: <https://github.com/vladmandic>'
|
||||
*/
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs@3.12.0_seedrandom@3.0.5/node_modules/@tensorflow/tfjs/package.json
|
||||
var version = "3.12.0";
|
||||
// node_modules/.pnpm/@tensorflow+tfjs@3.13.0_seedrandom@3.0.5/node_modules/@tensorflow/tfjs/package.json
|
||||
var version = "3.13.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-core@3.12.0/node_modules/@tensorflow/tfjs-core/package.json
|
||||
var version2 = "3.12.0";
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-core@3.13.0/node_modules/@tensorflow/tfjs-core/package.json
|
||||
var version2 = "3.13.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-data@3.12.0_23101d5e73420f02a83504fb6376a2a9/node_modules/@tensorflow/tfjs-data/package.json
|
||||
var version3 = "3.12.0";
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-data@3.13.0_dadde02861a8b00ace7633d17571891e/node_modules/@tensorflow/tfjs-data/package.json
|
||||
var version3 = "3.13.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-layers@3.12.0_@tensorflow+tfjs-core@3.12.0/node_modules/@tensorflow/tfjs-layers/package.json
|
||||
var version4 = "3.12.0";
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-layers@3.13.0_@tensorflow+tfjs-core@3.13.0/node_modules/@tensorflow/tfjs-layers/package.json
|
||||
var version4 = "3.13.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-converter@3.12.0_@tensorflow+tfjs-core@3.12.0/node_modules/@tensorflow/tfjs-converter/package.json
|
||||
var version5 = "3.12.0";
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-converter@3.13.0_@tensorflow+tfjs-core@3.13.0/node_modules/@tensorflow/tfjs-converter/package.json
|
||||
var version5 = "3.13.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.12.0_@tensorflow+tfjs-core@3.12.0/node_modules/@tensorflow/tfjs-backend-cpu/package.json
|
||||
var version6 = "3.12.0";
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@3.13.0_@tensorflow+tfjs-core@3.13.0/node_modules/@tensorflow/tfjs-backend-cpu/package.json
|
||||
var version6 = "3.13.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.12.0_@tensorflow+tfjs-core@3.12.0/node_modules/@tensorflow/tfjs-backend-webgl/package.json
|
||||
var version7 = "3.12.0";
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@3.13.0_@tensorflow+tfjs-core@3.13.0/node_modules/@tensorflow/tfjs-backend-webgl/package.json
|
||||
var version7 = "3.13.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.12.0_@tensorflow+tfjs-core@3.12.0/node_modules/@tensorflow/tfjs-backend-wasm/package.json
|
||||
var version8 = "3.12.0";
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@3.13.0_@tensorflow+tfjs-core@3.13.0/node_modules/@tensorflow/tfjs-backend-wasm/package.json
|
||||
var version8 = "3.13.0";
|
||||
|
||||
// src/tfjs/tf-version.ts
|
||||
var version9 = {
|
||||
|
|
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
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
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
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
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
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
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
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
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
File diff suppressed because one or more lines are too long
|
@ -546,6 +546,12 @@ export declare function createTinyYolov2(weights: Float32Array, withSeparableCon
|
|||
*/
|
||||
declare type DataId = object;
|
||||
|
||||
declare type DataToGPUOptions = DataToGPUWebGLOption;
|
||||
|
||||
declare interface DataToGPUWebGLOption {
|
||||
customTexShape?: [number, number];
|
||||
}
|
||||
|
||||
/** @docalias 'float32'|'int32'|'bool'|'complex64'|'string' */
|
||||
declare type DataType = keyof DataTypeMap;
|
||||
|
||||
|
@ -1222,6 +1228,12 @@ declare function getQueryParams(queryString: string): {
|
|||
[key: string]: string;
|
||||
};
|
||||
|
||||
declare interface GPUData {
|
||||
tensorRef: Tensor;
|
||||
texture?: WebGLTexture;
|
||||
texShape?: [number, number];
|
||||
}
|
||||
|
||||
export declare interface IBoundingBox {
|
||||
left: number;
|
||||
top: number;
|
||||
|
@ -2371,6 +2383,31 @@ declare class Tensor<R extends Rank = Rank> {
|
|||
* @doc {heading: 'Tensors', subheading: 'Classes'}
|
||||
*/
|
||||
data<D extends DataType = NumericDataType>(): Promise<DataTypeMap[D]>;
|
||||
/**
|
||||
* Copy the tensor's data to a new GPU resource. Comparing to the `dataSync()`
|
||||
* and `data()`, this method prevents data from being downloaded to CPU.
|
||||
*
|
||||
* For WebGL backend, the data will be stored on a densely packed texture.
|
||||
* This means that the texture will use the RGBA channels to store value.
|
||||
*
|
||||
* @param options:
|
||||
* For WebGL,
|
||||
* - customTexShape: Optional. If set, will use the user defined
|
||||
* texture shape to create the texture.
|
||||
*
|
||||
* @returns For WebGL backend, a GPUData contains the new texture and
|
||||
* its information.
|
||||
* {
|
||||
* tensorRef: The tensor that is associated with this texture,
|
||||
* texture: WebGLTexture,
|
||||
* texShape: [number, number] // [height, width]
|
||||
* }
|
||||
* Remember to dispose the GPUData after it is used by
|
||||
* `res.tensorRef.dispose()`.
|
||||
*
|
||||
* @doc {heading: 'Tensors', subheading: 'Classes'}
|
||||
*/
|
||||
dataToGPU(options?: DataToGPUOptions): GPUData;
|
||||
/**
|
||||
* Synchronously downloads the values from the `tf.Tensor`. This blocks the
|
||||
* UI thread until the values are ready, which can cause performance issues.
|
||||
|
|
Loading…
Reference in New Issue