Interface Config

Configuration interface definition for Human library Contains all configurable parameters Defaults: config

interface Config {
    async: boolean;
    backend: BackendEnum;
    body: Partial<BodyConfig>;
    cacheModels: boolean;
    cacheSensitivity: number;
    deallocate: boolean;
    debug: boolean;
    face: Partial<FaceConfig>;
    filter: Partial<FilterConfig>;
    flags: Record<string, unknown>;
    gesture: Partial<GestureConfig>;
    hand: Partial<HandConfig>;
    modelBasePath: string;
    object: Partial<ObjectConfig>;
    segmentation: Partial<SegmentationConfig>;
    skipAllowed: boolean;
    softwareKernels: boolean;
    validateModels: boolean;
    warmup: WarmupEnum;
    wasmPath: string;
    wasmPlatformFetch: boolean;
}

Properties

async: boolean

Perform model loading and inference concurrently or sequentially

default: true

backend: BackendEnum

Backend used for TFJS operations valid build-in backends are:

  • Browser: cpu, wasm, webgl, humangl, webgpu
  • NodeJS: cpu, wasm, tensorflow default: webgl for browser and tensorflow for nodejs
body: Partial<BodyConfig>

Body config BodyConfig

cacheModels: boolean

Cache models in IndexDB on first sucessfull load default: true if indexdb is available (browsers), false if its not (nodejs)

cacheSensitivity: number

Cache sensitivity

  • values 0..1 where 0.01 means reset cache if input changed more than 1%
  • set to 0 to disable caching

default: 0.7

deallocate: boolean

Perform immediate garbage collection on deallocated tensors instead of caching them

debug: boolean

Print debug statements to console

default: true

face: Partial<FaceConfig>

Face config FaceConfig

filter: Partial<FilterConfig>

Filter config FilterConfig

flags: Record<string, unknown>

Explicit flags passed to initialize TFJS

gesture: Partial<GestureConfig>

Gesture config GestureConfig

hand: Partial<HandConfig>

Hand config HandConfig

modelBasePath: string

Base model path (typically starting with file://, http:// or https://) for all models

  • individual modelPath values are relative to this path

default: ../models/ for browsers and file://models/ for nodejs

object: Partial<ObjectConfig>

Object config ObjectConfig

segmentation: Partial<SegmentationConfig>

Segmentation config SegmentationConfig

skipAllowed: boolean

Internal Variable

softwareKernels: boolean

Software Kernels Registers software kernel ops running on CPU when accelerated version of kernel is not found in the current backend

validateModels: boolean

Validate kernel ops used in model during model load default: true any errors will be printed on console but will be treated as non-fatal

warmup: WarmupEnum

What to use for human.warmup()

  • warmup pre-initializes all models for faster inference but can take significant time on startup
  • used by webgl, humangl and webgpu backends

default: full

wasmPath: string

Path to *.wasm files if backend is set to wasm

default: auto-detects to link to CDN jsdelivr when running in browser

wasmPlatformFetch: boolean

Force WASM loader to use platform fetch

default: false