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
test
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
### **HEAD -> main** 2021/06/05 mandic00@live.com
### **update wasm to tfjs 3.7.0** 2021/06/06 mandic00@live.com
- modularize build platform
- 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 };
/** Instance of TensorFlow/JS */
/** Instance of TensorFlow/JS
* @external
*/
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;
/**

View File

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

View File

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

View File

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