tfjs-model-blazeface
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-rc.8 • Public • Published

tfjs-model-blazeface

API

// cache tf models in browser indexedDB when the page is loading
export async function initialize(
  modelUrl = DEFAULT_MODLE_URL,
  modelName = DEFAULT_MODEL_NAME,
)
 
 
// load the Blazeface to estmate face
export async function load(
  {
    maxFaces = 10,
    inputWidth = 128,
    inputHeight = 128,
    iouThreshold = 0.3,
    scoreThreshold = 0.75
  } = {},
  modelUrl = DEFAULT_MODLE_URL,
  modelName = DEFAULT_MODEL_NAME,
): Promise<BlazeFaceModel>
 
 
// the main API of BlazeFaceModel
estimateFaces(
  inputtf.Tensor3D|ImageData|HTMLVideoElement|HTMLImageElement| HTMLCanvasElement,
  returnTensors = false, 
  flipHorizontal = false,
  annotateBoxes = true
)Promise<NormalizedFace[]> 
 

Usage

import { initialize, load } from 'tfjs-model-blazeface';
 
// call it when page is loading
initialize();
 
 
// use the model
const model = await load();
 
const predicts = await model.estimateFaces(input);
 

Readme

Keywords

Package Sidebar

Install

npm i tfjs-model-blazeface

Weekly Downloads

7

Version

0.0.0-rc.8

License

MIT

Unpacked Size

60.1 kB

Total Files

16

Last publish

Collaborators

  • wangmeng_hb