Implement mtcnn with Tensorflow.js
A face detection framework with MTCNN and Tensorflow.js
Give me a ⭐️, if you like it ❤️
(Currently, framework is only accepted to detect one face, i'll update soon)
Run:
npm install whoisltd/mtcnn-tfjs
Use:
const mtcnn = require('@whoisltd/mtcnn-tfjs');
const pnet_url = 'https://storage.googleapis.com/my-mtcnn-models/final_model/pnet/model.json'
const rnet_url = 'https://storage.googleapis.com/my-mtcnn-models/final_model/rnet/model.json'
const onet_url = 'https://storage.googleapis.com/my-mtcnn-models/final_model/onet/model.json'
let model = null
if(model == null){
model = new mtcnn.MTCNN(pnet_url, rnet_url, onet_url)
model.mtcnn.pnet = await model.mtcnn.pnet
model.mtcnn.rnet = await model.mtcnn.rnet
model.mtcnn.onet = await model.mtcnn.onet
}
//Draw bounding boxes on image:
model.draw_img(url_img, url_output);
//Crop face from image:
model.crop_face(url_img, url_output, true);
//Get bounding boxes, landmarks, score:
model.detect(url_img);
Pull request is welcome!