Coder Social home page Coder Social logo

Comments (5)

zurek11 avatar zurek11 commented on May 21, 2024

And one more question. How can i save recogniser with added faces to database? Is there some way to save this variable there? (Because I want to use prediction more time and is non effective to train recognizer again and again with the same images).

from face-recognition.js.

justadudewhohacks avatar justadudewhohacks commented on May 21, 2024

Hi, if no faces are detected then the returned faceImages array is empty. In you case faceImage[0] is simply undefined I guess.

How to serialize a model to json and load it again is described in the readme:

Save a trained model to json file:

const fs = require('fs')
const modelState = recognizer.serialize()
fs.writeFileSync('model.json', JSON.stringify(modelState))

Load a trained model from json file:

const modelState = require('model.json')
recognizer.load(modelState)

Simply serialize the model and store the json object or the stringified json in your db.

from face-recognition.js.

zurek11 avatar zurek11 commented on May 21, 2024

const modelState = require('model.json') throws error: Cannot find module 'model.json' how can i install him? I was trying to install him as face-recognition so npm install model.json but console throw also error:

npm ERR! code E404
npm ERR! 404 Not Found: model.json@latest

from face-recognition.js.

justadudewhohacks avatar justadudewhohacks commented on May 21, 2024

model.json is just a json file that you write the serialized state of the face recognizer to, as shown in the example above.

from face-recognition.js.

odykyi avatar odykyi commented on May 21, 2024

@zurek11

// file1.js

const fs = require('fs')
// init recognizer
const modelState = recognizer.serialize()
fs.writeFileSync('model.json', JSON.stringify(modelState))

// file2.js

const modelState = require('./model.json');
//init recognizer
recognizer.load(modelState)

from face-recognition.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.