1.0.0 • Published 6 months ago

@rd-works/get-face-status v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

get-face-status

ci

A face detection module that finds the best face and status

Uses Mediapipe/Tensorflow.js Blazeface

Status-Code table

StatusCode
OK1
NO_FACE-301
MOVE_LEFT-302
MOVE_RIGHT-303
MOVE_DOWN-304
MOVE_UP-305
MOVE_IN-306
MOVE_OUT-307

Getting started

MethodInstallImport
CDN (html)N/A<script src="https://cdn.jsdelivr.net/npm/@rd-works/get-face-status"</script>
CDN (module)N/Aimport "https://cdn.jsdelivr.net/npm/@rd-works/get-face-status";
npmnpm install @rd-works/get-face-statusimport * as saffe from "@rd-works/get-face-status";
source (bundle)npm install && npm run build:bundleimport "./dist/get_face_status.js";
source (library)npm install && npm run build:libraryimport * 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

PropertyDescriptionDefault Value
detectorTypeThe face detector model type to be usedblazeface
detectFaceFlipHorizontalFace detection results are flippedfalse
checkFaceLeftMarginThe face box left margin threshold0.1
checkFaceRightMarginThe face box right margin threshold0.1
checkFaceBottomMarginThe face box bottom margin threshold0.1
checkFaceTopMarginThe face box top margin threshold0.1
checkFaceMinSizeThe face box size lower threshold0.1
checkFaceMaxSizeThe face box size upper threshold0.6
bestFaceCriteriaFunction that determines the best face (e.g (faces, frame) => faces[0])libsaffeCriteria