mirror of https://github.com/vladmandic/human
start using partial definitions
parent
34a3a42fba
commit
19e4e49c41
|
@ -11,6 +11,9 @@
|
||||||
|
|
||||||
### **HEAD -> main** 2021/09/11 mandic00@live.com
|
### **HEAD -> main** 2021/09/11 mandic00@live.com
|
||||||
|
|
||||||
|
|
||||||
|
### **origin/main** 2021/09/11 mandic00@live.com
|
||||||
|
|
||||||
- simplify dependencies
|
- simplify dependencies
|
||||||
- fix file permissions
|
- fix file permissions
|
||||||
- remove old build server
|
- remove old build server
|
||||||
|
|
3
TODO.md
3
TODO.md
|
@ -6,7 +6,8 @@ WebGL shader optimizations for faster load and initial detection
|
||||||
|
|
||||||
- Implement WebGL uniforms for shaders: <https://github.com/tensorflow/tfjs/issues/5205>
|
- Implement WebGL uniforms for shaders: <https://github.com/tensorflow/tfjs/issues/5205>
|
||||||
- Fix shader packing: <https://github.com/tensorflow/tfjs/issues/5343>
|
- Fix shader packing: <https://github.com/tensorflow/tfjs/issues/5343>
|
||||||
- Event emitters
|
- Refactor Human as multiple partial class
|
||||||
|
- Refactor ImageFX as ESM
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ export class Human {
|
||||||
* Creates instance of Human library that is futher used for all operations
|
* Creates instance of Human library that is futher used for all operations
|
||||||
* @param userConfig: {@link Config}
|
* @param userConfig: {@link Config}
|
||||||
*/
|
*/
|
||||||
constructor(userConfig?: Config | Record<string, unknown>) {
|
constructor(userConfig?: Partial<Config>) {
|
||||||
this.version = app.version; // expose version property on instance of class
|
this.version = app.version; // expose version property on instance of class
|
||||||
Object.defineProperty(this, 'version', { value: app.version }); // expose version property directly on class itself
|
Object.defineProperty(this, 'version', { value: app.version }); // expose version property directly on class itself
|
||||||
defaults.wasmPath = `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${tf.version_core}/dist/`;
|
defaults.wasmPath = `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${tf.version_core}/dist/`;
|
||||||
|
@ -280,7 +280,7 @@ export class Human {
|
||||||
* - Not explicitly required as any required model is load implicitly on it's first run
|
* - Not explicitly required as any required model is load implicitly on it's first run
|
||||||
* @param userConfig?: {@link Config}
|
* @param userConfig?: {@link Config}
|
||||||
*/
|
*/
|
||||||
async load(userConfig?: Config | Record<string, unknown>) {
|
async load(userConfig?: Partial<Config>) {
|
||||||
this.state = 'load';
|
this.state = 'load';
|
||||||
const timeStamp = now();
|
const timeStamp = now();
|
||||||
const count = Object.values(this.models).filter((model) => model).length;
|
const count = Object.values(this.models).filter((model) => model).length;
|
||||||
|
@ -464,7 +464,7 @@ export class Human {
|
||||||
* @param userConfig?: {@link Config}
|
* @param userConfig?: {@link Config}
|
||||||
* @returns result: {@link Result}
|
* @returns result: {@link Result}
|
||||||
*/
|
*/
|
||||||
async detect(input: Input, userConfig?: Config | Record<string, unknown>): Promise<Result | Error> {
|
async detect(input: Input, userConfig?: Partial<Config>): Promise<Result | Error> {
|
||||||
// detection happens inside a promise
|
// detection happens inside a promise
|
||||||
return new Promise(async (resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
this.state = 'config';
|
this.state = 'config';
|
||||||
|
@ -716,7 +716,7 @@ export class Human {
|
||||||
* - only used for `webgl` and `humangl` backends
|
* - only used for `webgl` and `humangl` backends
|
||||||
* @param userConfig?: Config
|
* @param userConfig?: Config
|
||||||
*/
|
*/
|
||||||
async warmup(userConfig?: Config | Record<string, unknown>): Promise<Result | { error }> {
|
async warmup(userConfig?: Partial<Config>): Promise<Result | { error }> {
|
||||||
const t0 = now();
|
const t0 = now();
|
||||||
if (userConfig) this.config = mergeDeep(this.config, userConfig) as Config;
|
if (userConfig) this.config = mergeDeep(this.config, userConfig) as Config;
|
||||||
if (!this.config.warmup || this.config.warmup === 'none') return { error: 'null' };
|
if (!this.config.warmup || this.config.warmup === 'none') return { error: 'null' };
|
||||||
|
|
Loading…
Reference in New Issue