retinaface
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

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

Package Sidebar

Install

npm i retinaface

Weekly Downloads

5

Version

0.0.6

License

MIT

Unpacked Size

4.12 MB

Total Files

8

Last publish

Collaborators

  • ncbql