npm.io
0.0.6 • Published 2 years ago

retinaface

Licence
MIT
Version
0.0.6
Deps
0
Size
3.9 MB
Vulns
0
Weekly
0
Stars
5

Retinaface-JS npm GitHub

This is a JavaScript implementation of the Retinaface face detection algorithm. It is based on the Retinaface paper.

Screenshots

screenshot

Usage

Installation
npm install retinaface onnxruntime-web
Example
import * as ort from 'onnxruntime-web'
import Retinaface from 'retinaface'

import modelPath from 'retinaface/mnet.25_v2.onnx?url'
import imagePath from './R.jpg'

ort.env.wasm.wasmPaths = 'https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/'

const retinaface = new Retinaface(await ort.InferenceSession.create(modelPath), ort.Tensor)

const image = new Image()
image.src = imagePath
await new Promise((resolve, reject) => {
  image.onload = resolve
  image.onerror = reject
})

const [data, scale] = retinaface.processImage(image)
const result = await retinaface.detect(data, scale)

console.log(result)

Author

Shirasawa

License

MIT

Keywords