1.0.0 • Published 6 months ago
@rd-works/get-face-status v1.0.0
get-face-status
A face detection module that finds the best face and status
Uses Mediapipe/Tensorflow.js Blazeface
Status-Code table
Status | Code |
---|---|
OK | 1 |
NO_FACE | -301 |
MOVE_LEFT | -302 |
MOVE_RIGHT | -303 |
MOVE_DOWN | -304 |
MOVE_UP | -305 |
MOVE_IN | -306 |
MOVE_OUT | -307 |
Getting started
Method | Install | Import |
---|---|---|
CDN (html) | N/A | <script src="https://cdn.jsdelivr.net/npm/@rd-works/get-face-status"</script> |
CDN (module) | N/A | import "https://cdn.jsdelivr.net/npm/@rd-works/get-face-status"; |
npm | npm install @rd-works/get-face-status | import * as saffe from "@rd-works/get-face-status"; |
source (bundle) | npm install && npm run build:bundle | import "./dist/get_face_status.js"; |
source (library) | npm install && npm run build:library | import * as saffe "./dist/index.js"; |
Get a detector
object
const options = {}
const detector = await saffe.getDetector(options);
Get the status and best face
const { status, face } = await detector.getFaceStatus(input);
Options
Property | Description | Default Value |
---|---|---|
detectorType | The face detector model type to be used | blazeface |
detectFaceFlipHorizontal | Face detection results are flipped | false |
checkFaceLeftMargin | The face box left margin threshold | 0.1 |
checkFaceRightMargin | The face box right margin threshold | 0.1 |
checkFaceBottomMargin | The face box bottom margin threshold | 0.1 |
checkFaceTopMargin | The face box top margin threshold | 0.1 |
checkFaceMinSize | The face box size lower threshold | 0.1 |
checkFaceMaxSize | The face box size upper threshold | 0.6 |
bestFaceCriteria | Function that determines the best face (e.g (faces, frame) => faces[0] ) | libsaffeCriteria |
1.0.0
6 months ago