Coder Social home page Coder Social logo

infinitay / face-rec-photo-gallery Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 16.19 MB

A photo gallery with a facial recognition API called face-api.js

JavaScript 92.85% HTML 1.93% CSS 5.22%
face-api facial-recognition photo-gallery nodejs electron hacktoberfest

face-rec-photo-gallery's Introduction

face-api.js Testing Project

This is a testing project for facial recognition using face-api.js. This is my first project using nodejs and electron as I am not too familiar with JS or HTML, so excuse the bad code.

I had troubles initially getting everything to run properly because canvas was not cooperating with electron on my end. I will include a list of problems that arose for me and the solutions I took. First, please follow the installation instructions for node-canvas.

Instructions

npm i
npm start

A folder dialog will appear prompting you to select the folder which you want to view the contents of as well as run the facial recognition against.

In order to change the database of the facial recognition, or training data if you will, you have to manually change that yourself over at assets/test-data-set.

Troubleshooting

With the addition of the "postinstall" script within package.json this should resolve the error with Canvas. Additionally, as a result, the tfjs error did not occur for me either, either because of this change or the updated dependencies.


Canvas, canvas.node was compiled against a different Node.js version

Uncaught Error: The module '\Face-API\node_modules\canvas\build\Release\canvas.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 72. This version of Node.js requires NODE_MODULE_VERSION 70. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install).

canvas.node Solution

Follow instructions for electron-rebuild. For me, since I am on windows, I ran the following ./node_modules/.bin/electron-rebuild. With the addition of the "postinstall" script, this should no longer happen. However, should the case still arise, the instructions above still works.

You could also try running npm rebuild canvas --update-binary alone.


TFJS Errors, specified module could not be found... tfjs_binding.node

After I solved that issue I came across another issue regarding tfjs.

Initialization of backend tensorflow failed

Error: The specified module could not be found. \node_modules@tensorflow\tfjs-node\build\Release\tfjs_binding.node

TFJS Solution

All I did was rebuild the project with npm rebuild which resolved this error for me.


Cannot find module... napi-v{version}/tfjs_binding.node

napi-v{version}/tfjs_binding.node Solution

Make sure that your node.js version corresponds with the node.js version respective to electron. For example, as of Janurary 4th, 2020, the latest Electron version is 7.1.7 and it was compiled with node.js v12.8.1, so you would want to make sure your machine is also running node.js v12.8.1. This is how I resolved this error.

See tensorflow/tfjs#2640 for more details.

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.