Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@vladmandic/face-api
Advanced tools
JavaScript module for Face Detection and Face Recognition Using Tensorflow/JS
This is updated face-api.js with latest available TensorFlow/JS as the original face-api.js is not compatible with tfjs 2.0+.
Forked from face-api.js version 0.22.2 released on March 22nd, 2020
version
class that returns JSON object with version of FaceAPI as well as linked TFJSsetPlatform
to automatically prepare TFJS in browserWhich means valid models are tinyFaceDetector and mobileNetv1
Due to reduced code and changed build process, resulting bundle is about >5x smaller than the original!
There are several ways to use Face-API:
Important: This version of Face-Api does NOT pre-package TFJS
to allow for faster downloads (it's much smaller) as well as to allow user to choose version of TFJS to use (it's compatible with any TFJS 2.0+
).
Size: 936KB minified
This is simplest way for usage within Browser
Simply download dist/face-api.js
, include it in your HTML
file & it's ready to use.
<script src="https://cdnjs.cloudflare.com/ajax/libs/tensorflow/2.6.0/tf.min.js"></script>
<script src="dist/face-api.js"><script>
For a quick test, you can access the script directly from gitpages
<script src="https://vladmandic.github.io/face-api/dist/face-api.js"></script>
IIFE script auto-registers global namespace faceapi
within Window object.
And if you want to access TensorFlow/JS
classes directly, they are exported as faceapi.tf
Size: 164KB non-minified
If you're using bundler (such as rollup, webpack, esbuild) to package your client application, you can import ESM version of FaceAPI which supports full tree shaking
Note that this version does NOT pre-package TFJS
, so you'll need to include it before you import FaceAPI
You can use any version of TFJS
2.0+
import * as tf from 'https://cdnjs.cloudflare.com/ajax/libs/tensorflow/2.6.0/tf.min.js'; // load directly from CDN
import * as faceapi from 'dist/face-api.esm.js';
Experimental:
You could use same syntax within your main JS
file if it's imported with <script type="module">
<script src="tf.min.js">
<script src="./index.js" type="module">
and then in index.js
import * as tf from 'https://cdnjs.cloudflare.com/ajax/libs/tensorflow/2.6.0/tf.min.js'; // load directly from CDN
import * as faceapi from 'dist/face-api.esm.js';
Size: 45,104KB unpacked (including sources and pre-trained model weights)
Simmilar to ESM module, but with full sources as it points to build/src/index.js
instead
Recommended for NodeJS projects
Install with:
npm install @tensorflow/tfjs @vladmandic/face-api
And then use with:
import * as tf from '@tensorflow/tfjs';
import * as faceapi from '@vladmandic/face-api';
Pretrained models and their weights are includes in ./model
.
If you want to do a full rebuild, either download npm module
npm install @vladmandic/face-api
cd node_modules/@vladmandic/face-api
or clone a git project
git clone https://github.com/vladmandic/face-api
cd face-api
Then install all dependencies and run rebuild:
npm install
npm run build
Which will compile everything in ./src
into ./build
and create both ESM (standard) and IIFE (minified) bundles as well as sourcemaps in ./dist
For documentation refer to original project at https://github.com/justadudewhohacks/face-api.js
Single new example that uses both models as well as all of the extensions is included in /example/index.html
Example can be accessed directly using Git pages using URL: https://vladmandic.github.io/face-api/example/
Note: Photos shown below are taken by me
FAQs
FaceAPI: AI-powered Face Detection & Rotation Tracking, Face Description & Recognition, Age & Gender & Emotion Prediction for Browser and NodeJS using TensorFlow/JS
The npm package @vladmandic/face-api receives a total of 8,877 weekly downloads. As such, @vladmandic/face-api popularity was classified as popular.
We found that @vladmandic/face-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.