custom build tfjs from sources

pull/356/head
Vladimir Mandic 2021-06-06 19:00:34 -04:00
parent ccad4a8c20
commit f654b89e8a
9 changed files with 37 additions and 26 deletions

View File

@ -4,3 +4,5 @@ samples
typedoc typedoc
test test
wiki wiki
dist/tfjs.esm.js
dist/tfjs.esm.js.map

View File

@ -9,7 +9,7 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
## Changelog ## Changelog
### **HEAD -> main** 2021/06/05 mandic00@live.com ### **update wasm to tfjs 3.7.0** 2021/06/06 mandic00@live.com
- modularize build platform - modularize build platform
- enable body segmentation and background replacement in demo - enable body segmentation and background replacement in demo

View File

@ -44,10 +44,14 @@ export type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImageE
*/ */
export type Error = { error: string }; export type Error = { error: string };
/** Instance of TensorFlow/JS */ /** Instance of TensorFlow/JS
* @external
*/
export type TensorFlow = typeof tf; export type TensorFlow = typeof tf;
/** Generic Model object type, holds instance of individual models */ /** Generic Model object type
* holds instance of individual models
*/
type Model = unknown; type Model = unknown;
/** /**

View File

@ -4,10 +4,12 @@
/** /**
* TensorFlow Tensor type * TensorFlow Tensor type
* @external
*/ */
export { Tensor } from '@tensorflow/tfjs-core/dist/index'; export { Tensor } from '@tensorflow/tfjs-core/dist/index';
/** /**
* TensorFlow GraphModel type * TensorFlow GraphModel type
* @external
*/ */
export { GraphModel } from '@tensorflow/tfjs-converter/dist/index'; export { GraphModel } from '@tensorflow/tfjs-converter/dist/index';

View File

@ -1,10 +1,12 @@
/** /**
* Creates tfjs bundle used by Human browser build target * Creates tfjs bundle used by Human browser build target
* @external
*/ */
// import from dist // import from dist
// modules: 1299, moduleBytes: 4230827, imports: 7, importBytes: 2478, outputBytes: 2357435 // modules: 1299, moduleBytes: 4230827, imports: 7, importBytes: 2478, outputBytes: 2357435
// get versions of all packages // get versions of all packages
/*
import * as packageBundle from '@tensorflow/tfjs/package.json'; import * as packageBundle from '@tensorflow/tfjs/package.json';
import * as packageCore from '@tensorflow/tfjs-core/package.json'; import * as packageCore from '@tensorflow/tfjs-core/package.json';
import * as packageData from '@tensorflow/tfjs-data/package.json'; import * as packageData from '@tensorflow/tfjs-data/package.json';
@ -23,19 +25,19 @@ export * as data from '@tensorflow/tfjs-data/dist/index.js';
export * from '@tensorflow/tfjs-backend-cpu/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-webgl/dist/index.js';
export * from '@tensorflow/tfjs-backend-wasm/dist/index.js'; export * from '@tensorflow/tfjs-backend-wasm/dist/index.js';
*/
// import from src // import from src
// modules: 1681, moduleBytes: 5711239, imports: 7, importBytes: 2701, outputBytes: 2107830 // modules: 1681, moduleBytes: 5711239, imports: 7, importBytes: 2701, outputBytes: 2107830
// get versions of all packages // get versions of all packages
/* import { version as tfjsVersion } from '@tensorflow/tfjs/package.json';
import * as packageBundle from '@tensorflow/tfjs/package.json'; import { version as tfjsCoreVersion } from '@tensorflow/tfjs-core/package.json';
import * as packageCore from '@tensorflow/tfjs-core/package.json'; import { version as tfjsDataVersion } from '@tensorflow/tfjs-data/package.json';
import * as packageData from '@tensorflow/tfjs-data/package.json'; import { version as tfjsLayersVersion } from '@tensorflow/tfjs-layers/package.json';
import * as packageLayers from '@tensorflow/tfjs-layers/package.json'; import { version as tfjsConverterVersion } from '@tensorflow/tfjs-converter/package.json';
import * as packageConverter from '@tensorflow/tfjs-converter/package.json'; import { version as tfjsBackendCPUVersion } from '@tensorflow/tfjs-backend-cpu/package.json';
import { version_cpu } from '@tensorflow/tfjs-backend-cpu/src/index'; import { version as tfjsBackendWebGLVersion } from '@tensorflow/tfjs-backend-webgl/package.json';
import { version_webgl } from '@tensorflow/tfjs-backend-webgl/src/index'; import { version as tfjsBackendWASMVersion } from '@tensorflow/tfjs-backend-wasm/package.json';
import { version_wasm } from '@tensorflow/tfjs-backend-wasm/src/index';
// export all // export all
export * from '@tensorflow/tfjs-core/src/index'; export * from '@tensorflow/tfjs-core/src/index';
@ -45,17 +47,18 @@ export * as data from '@tensorflow/tfjs-data/src/index';
export * from '@tensorflow/tfjs-backend-cpu/src/index'; export * from '@tensorflow/tfjs-backend-cpu/src/index';
export * from '@tensorflow/tfjs-backend-webgl/src/index'; export * from '@tensorflow/tfjs-backend-webgl/src/index';
export * from '@tensorflow/tfjs-backend-wasm/src/index'; export * from '@tensorflow/tfjs-backend-wasm/src/index';
/*
*/ */
// export versions // export versions
export const version = { export const version = {
tfjs: packageBundle?.version || undefined, tfjs: tfjsVersion,
'tfjs-core': packageCore?.version || undefined, 'tfjs-core': tfjsCoreVersion,
'tfjs-data': packageData?.version || undefined, 'tfjs-data': tfjsDataVersion,
'tfjs-layers': packageLayers?.version || undefined, 'tfjs-layers': tfjsLayersVersion,
'tfjs-converter': packageConverter?.version || undefined, 'tfjs-converter': tfjsConverterVersion,
'tfjs-backend-cpu': version_cpu || undefined, 'tfjs-backend-cpu': tfjsBackendCPUVersion,
'tfjs-backend-webgl': version_webgl || undefined, 'tfjs-backend-webgl': tfjsBackendWebGLVersion,
'tfjs-backend-wasm': version_wasm || undefined, 'tfjs-backend-wasm': tfjsBackendWASMVersion,
}; };
// export const version = {}; // export const version = {};

View File

@ -37,8 +37,8 @@
"allowUnreachableCode": false "allowUnreachableCode": false
}, },
"formatCodeOptions": { "indentSize": 2, "tabSize": 2 }, "formatCodeOptions": { "indentSize": 2, "tabSize": 2 },
"include": ["src/*", "src/***/*"], "exclude": ["node_modules/", "types/"],
"exclude": ["node_modules/"], "include": ["src/"],
"typedocOptions": { "typedocOptions": {
"excludePrivate": true, "excludePrivate": true,
"excludeExternals": true, "excludeExternals": true,
@ -49,10 +49,10 @@
"hideGenerator": "true", "hideGenerator": "true",
"readme": "none", "readme": "none",
"out": "typedoc", "out": "typedoc",
"entryPoints": "src/human.ts", "entryPoints": ["src/human.ts"],
"exclude": ["**/node_modules/**"], "exclude": [],
"externalPattern": ["**/node_modules/**"], "externalPattern": ["node_modules/", "tfjs/"],
"logLevel": "Info", "logLevel": "Verbose",
"logger": "none", "logger": "none",
"theme": "wiki/theme/" "theme": "wiki/theme/"
} }