mirror of https://github.com/vladmandic/human
completed tfjs wrapper
parent
0d33d7c5b5
commit
e08c9e9ab2
13
package.json
13
package.json
|
@ -19,22 +19,29 @@
|
|||
"type": "git",
|
||||
"url": "git+https://github.com/vladmandic/human.git"
|
||||
},
|
||||
"dependencies": {},
|
||||
"dependencies": {
|
||||
},
|
||||
"peerDependencies": {},
|
||||
"devDependencies": {
|
||||
"@tensorflow/tfjs": "^2.7.0",
|
||||
"@tensorflow/tfjs-backend-cpu": "^2.7.0",
|
||||
"@tensorflow/tfjs-backend-wasm": "^2.7.0",
|
||||
"@tensorflow/tfjs-backend-webgl": "^2.7.0",
|
||||
"@tensorflow/tfjs-converter": "^2.7.0",
|
||||
"@tensorflow/tfjs-core": "^2.7.0",
|
||||
"@tensorflow/tfjs-data": "^2.7.0",
|
||||
"@tensorflow/tfjs-layers": "^2.7.0",
|
||||
"@tensorflow/tfjs-node": "^2.7.0",
|
||||
"@tensorflow/tfjs": "^2.7.0",
|
||||
"@vladmandic/pilogger": "^0.2.7",
|
||||
"chokidar": "^3.4.3",
|
||||
"dayjs": "^1.9.6",
|
||||
"esbuild": "^0.8.9",
|
||||
"eslint": "^7.13.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-json": "^2.1.2",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint": "^7.13.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"seedrandom": "^3.0.5",
|
||||
"simple-git": "^2.22.0"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { tf } from '../../dist/tfjs.esm.js';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as profile from '../profile.js';
|
||||
|
||||
const models = {};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { tf } from '../../dist/tfjs.esm.js';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as profile from '../profile.js';
|
||||
|
||||
const annotations = ['angry', 'disgust', 'fear', 'happy', 'sad', 'surpise', 'neutral'];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { tf } from '../../dist/tfjs.esm.js';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as profile from '../profile.js';
|
||||
|
||||
const models = {};
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
* =============================================================================
|
||||
*/
|
||||
import { tf } from '../../dist/tfjs.esm.js';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
|
||||
function getBoxSize(box) {
|
||||
return [
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* =============================================================================
|
||||
*/
|
||||
|
||||
import { tf } from '../../dist/tfjs.esm.js';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as box from './box';
|
||||
|
||||
class HandDetector {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* =============================================================================
|
||||
*/
|
||||
|
||||
import { tf } from '../../dist/tfjs.esm.js';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as box from './box';
|
||||
import * as util from './util';
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
// https://storage.googleapis.com/tfjs-models/demos/handpose/index.html
|
||||
|
||||
import { tf } from '../../dist/tfjs.esm.js';
|
||||
import * as tf from '../../dist/tfjs.esm.js';
|
||||
import * as handdetector from './handdetector';
|
||||
import * as pipeline from './handpipeline';
|
||||
import * as anchors from './anchors';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { tf, wasm } from '../dist/tfjs.esm.js';
|
||||
import * as tf from '../dist/tfjs.esm.js';
|
||||
import * as facemesh from './face/facemesh.js';
|
||||
import * as age from './age/age.js';
|
||||
import * as gender from './gender/gender.js';
|
||||
|
@ -172,7 +172,7 @@ class Human {
|
|||
|
||||
if (this.config.backend === 'wasm') {
|
||||
this.log('settings wasm path:', this.config.wasmPath);
|
||||
wasm.setWasmPaths(this.config.wasmPath);
|
||||
tf.setWasmPaths(this.config.wasmPath);
|
||||
const simd = await tf.env().getAsync('WASM_HAS_SIMD_SUPPORT');
|
||||
if (!simd) this.log('warning: wasm simd support is not enabled');
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { tf } from '../dist/tfjs.esm.js';
|
||||
import * as tf from '../dist/tfjs.esm.js';
|
||||
import * as fxImage from './imagefx.js';
|
||||
|
||||
// internal temp canvases
|
||||
|
|
44
src/tf.js
44
src/tf.js
|
@ -1,4 +1,44 @@
|
|||
// wrapper to load tfjs in a single place so version can be changed quickly
|
||||
|
||||
export * as tf from '@tensorflow/tfjs/dist/index.js';
|
||||
export * as wasm from '@tensorflow/tfjs-backend-wasm/dist/index.js';
|
||||
// simplified
|
||||
// { modules: 1061, moduleBytes: 3772720, outputBytes: 1531035 }
|
||||
|
||||
export * from '@tensorflow/tfjs/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-backend-wasm/dist/index.js';
|
||||
|
||||
// modular
|
||||
// { modules: 1064, moduleBytes: 3793219, outputBytes: 1535600 }
|
||||
|
||||
/*
|
||||
// get versions of all packages.
|
||||
import { version as tfjs } from '@tensorflow/tfjs/package.json';
|
||||
import { version as versionCore } from '@tensorflow/tfjs-core/package.json';
|
||||
import { version as versionData } from '@tensorflow/tfjs-data/package.json';
|
||||
import { version as versionLayers } from '@tensorflow/tfjs-layers/package.json';
|
||||
import { version as versionConverter } from '@tensorflow/tfjs-converter/package.json';
|
||||
// for backends, get version from source so it can register backend during import
|
||||
import { version_cpu } from '@tensorflow/tfjs-backend-cpu/dist/index.js';
|
||||
import { version_webgl } from '@tensorflow/tfjs-backend-webgl/dist/index.js';
|
||||
import { version_wasm } from '@tensorflow/tfjs-backend-wasm/dist/index.js';
|
||||
|
||||
// export all
|
||||
export * from '@tensorflow/tfjs-core/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-layers/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-converter/dist/index.js';
|
||||
export * as data from '@tensorflow/tfjs-data/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-backend-cpu/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-backend-webgl/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-backend-wasm/dist/index.js';
|
||||
|
||||
// export versions
|
||||
export const version = {
|
||||
tfjs,
|
||||
'tfjs-core': versionCore,
|
||||
'tfjs-data': versionData,
|
||||
'tfjs-layers': versionLayers,
|
||||
'tfjs-converter': versionConverter,
|
||||
'tfjs-backend-cpu': version_cpu,
|
||||
'tfjs-backend-webgl': version_webgl,
|
||||
'tfjs-backend-wasm': version_wasm,
|
||||
};
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue