mirror of https://github.com/vladmandic/human
added face3d demo
parent
3006266060
commit
c2dd6fe567
|
@ -11,6 +11,7 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
||||||
|
|
||||||
### **HEAD -> main** 2021/03/29 mandic00@live.com
|
### **HEAD -> main** 2021/03/29 mandic00@live.com
|
||||||
|
|
||||||
|
- enable buffering
|
||||||
- new icons
|
- new icons
|
||||||
- new serve module and demo structure
|
- new serve module and demo structure
|
||||||
|
|
||||||
|
|
13
README.md
13
README.md
|
@ -16,8 +16,8 @@
|
||||||
JavaScript module using TensorFlow/JS Machine Learning library
|
JavaScript module using TensorFlow/JS Machine Learning library
|
||||||
|
|
||||||
- **Browser**:
|
- **Browser**:
|
||||||
Compatible with *CPU*, *WebGL*, *WASM* backends
|
|
||||||
Compatible with both desktop and mobile platforms
|
Compatible with both desktop and mobile platforms
|
||||||
|
Compatible with *CPU*, *WebGL*, *WASM* backends
|
||||||
Compatible with *WebWorker* execution
|
Compatible with *WebWorker* execution
|
||||||
- **NodeJS**:
|
- **NodeJS**:
|
||||||
Compatible with both software *tfjs-node* and
|
Compatible with both software *tfjs-node* and
|
||||||
|
@ -27,9 +27,14 @@ Check out [**Live Demo**](https://vladmandic.github.io/human/demo/index.html) fo
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
## Demos
|
||||||
|
|
||||||
|
- [**Demo Application**](https://vladmandic.github.io/human/demo/index.html)
|
||||||
|
- [**Face Extraction, Description, Identification and Matching**](https://vladmandic.github.io/human/demo/facematch.html)
|
||||||
|
- [**Face Extraction and 3D Rendering**](https://vladmandic.github.io/human/demo/face3d.html)
|
||||||
|
|
||||||
## Project pages
|
## Project pages
|
||||||
|
|
||||||
- [**Live Demo**](https://vladmandic.github.io/human/demo/index.html)
|
|
||||||
- [**Code Repository**](https://github.com/vladmandic/human)
|
- [**Code Repository**](https://github.com/vladmandic/human)
|
||||||
- [**NPM Package**](https://www.npmjs.com/package/@vladmandic/human)
|
- [**NPM Package**](https://www.npmjs.com/package/@vladmandic/human)
|
||||||
- [**Issues Tracker**](https://github.com/vladmandic/human/issues)
|
- [**Issues Tracker**](https://github.com/vladmandic/human/issues)
|
||||||
|
@ -98,6 +103,10 @@ As presented in the demo application...
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
**Face3D OpenGL Rendering:**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
**468-Point Face Mesh Defails:**
|
**468-Point Face Mesh Defails:**
|
||||||
|
|
||||||

|

|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
"@vladmandic/pilogger": "^0.2.15",
|
"@vladmandic/pilogger": "^0.2.15",
|
||||||
"chokidar": "^3.5.1",
|
"chokidar": "^3.5.1",
|
||||||
"dayjs": "^1.10.4",
|
"dayjs": "^1.10.4",
|
||||||
"esbuild": "^0.11.0",
|
"esbuild": "^0.11.2",
|
||||||
"eslint": "^7.23.0",
|
"eslint": "^7.23.0",
|
||||||
"eslint-config-airbnb-base": "^14.2.1",
|
"eslint-config-airbnb-base": "^14.2.1",
|
||||||
"eslint-plugin-import": "^2.22.1",
|
"eslint-plugin-import": "^2.22.1",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { log } from '../helpers';
|
|
||||||
import * as tf from '../../dist/tfjs.esm.js';
|
import * as tf from '../../dist/tfjs.esm.js';
|
||||||
import * as fxImage from './imagefx';
|
import * as fxImage from './imagefx';
|
||||||
|
|
||||||
|
@ -17,6 +16,9 @@ let fx = null;
|
||||||
export function process(input, config): { tensor: tf.Tensor, canvas: OffscreenCanvas | HTMLCanvasElement } {
|
export function process(input, config): { tensor: tf.Tensor, canvas: OffscreenCanvas | HTMLCanvasElement } {
|
||||||
let tensor;
|
let tensor;
|
||||||
if (!input) throw new Error('Human: Input is missing');
|
if (!input) throw new Error('Human: Input is missing');
|
||||||
|
if (!(input instanceof tf.Tensor) && !(input instanceof ImageData) && !(input instanceof ImageBitmap) && !(input instanceof HTMLVideoElement) && !(input instanceof HTMLCanvasElement) && !(input instanceof OffscreenCanvas)) {
|
||||||
|
throw new Error('Human: Input type is not recognized');
|
||||||
|
}
|
||||||
if (input instanceof tf.Tensor) {
|
if (input instanceof tf.Tensor) {
|
||||||
tensor = tf.clone(input);
|
tensor = tf.clone(input);
|
||||||
} else {
|
} else {
|
||||||
|
@ -36,10 +38,7 @@ export function process(input, config): { tensor: tf.Tensor, canvas: OffscreenCa
|
||||||
else if (config.filter.height > 0) targetWidth = originalWidth * (config.filter.height / originalHeight);
|
else if (config.filter.height > 0) targetWidth = originalWidth * (config.filter.height / originalHeight);
|
||||||
if (config.filter.height > 0) targetHeight = config.filter.height;
|
if (config.filter.height > 0) targetHeight = config.filter.height;
|
||||||
else if (config.filter.width > 0) targetHeight = originalHeight * (config.filter.width / originalWidth);
|
else if (config.filter.width > 0) targetHeight = originalHeight * (config.filter.width / originalWidth);
|
||||||
if (!targetWidth || !targetHeight) {
|
if (!targetWidth || !targetHeight) throw new Error('Human: Input cannot determine dimension');
|
||||||
log('Human: invalid input', input);
|
|
||||||
return { tensor: null, canvas: null };
|
|
||||||
}
|
|
||||||
if (!inCanvas || (inCanvas.width !== targetWidth) || (inCanvas.height !== targetHeight)) {
|
if (!inCanvas || (inCanvas.width !== targetWidth) || (inCanvas.height !== targetHeight)) {
|
||||||
inCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');
|
inCanvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(targetWidth, targetHeight) : document.createElement('canvas');
|
||||||
if (inCanvas.width !== targetWidth) inCanvas.width = targetWidth;
|
if (inCanvas.width !== targetWidth) inCanvas.width = targetWidth;
|
||||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
||||||
Subproject commit df23c6e6fdd3aedd5da6ee08d90d61983a761e91
|
Subproject commit 8bca078ef07d67c623bd2cb1a207a4bc8d743a60
|
Loading…
Reference in New Issue