Answer the question
In order to leave comments, you need to log in
What did I do wrong (Face-recognition node js)?
put the package https://www.npmjs.com/package/face-recognition
train the model and save it
const fr = require('face-recognition')
const image = fr.loadImage('./image.jpeg')
const detector = fr.FaceDetector()
const faceImages = detector.detectFaces(image)
//console.log(faceImages)
const recognizer = fr.FaceRecognizer()
recognizer.addFaces(faceImages, 'viktor')
const fs = require('fs')
const modelState = recognizer.serialize()
fs.writeFileSync('model.json', JSON.stringify(modelState))
fr.hitEnterToContinue()
const fr = require('face-recognition')
const image = fr.loadImage('./image.jpeg')
const modelState = require('./model.json')
console.log(modelState)
const recognizer = fr.FaceRecognizer()
recognizer.load(modelState)
const predictions = recognizer.predict(image)
console.log(predictions)
const detector = new fr.FrontalFaceDetector()
//const predictor = fr.FaceLandmark5Predictor()
const predictor = fr.FaceLandmark68Predictor()
const img = fr.loadImage('./image.jpeg')
const faceRects = detector.detect(img)
const shapes = faceRects.map(rect => predictor.predict(img, rect))
console.log(shapes)
const win = new fr.ImageWindow()
win.setImage(img)
win.renderFaceDetections(shapes)
fr.hitEnterToContinue()
const fr = require('face-recognition')
const image = fr.loadImage('./image.jpeg')
const modelState = require('./model.json')
console.log(modelState)
const recognizer = fr.FaceRecognizer()
recognizer.load(modelState)
const predictions = recognizer.predict(image)
console.log(predictions)
const detector = new fr.FrontalFaceDetector()
//const predictor = fr.FaceLandmark5Predictor()
const predictor = fr.FaceLandmark68Predictor()
const img = fr.loadImage('./image.jpeg')
const faceRects = detector.detect(img)
const shapes = faceRects.map(rect => predictor.predict(img, rect))
console.log(shapes)
const win = new fr.ImageWindow()
win.setImage(img)
win.renderFaceDetections(shapes)
fr.hitEnterToContinue()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question