get-me-through
A Free, Offline,Real-Time, Open-source web-app to assist organisers of an event to allow only authorised/invited people using Face-Recognition Technology
or QR Code
.
The name of the project is just an exclamation to steer through the monotonous work, in today's world of spreading automation technology. The face recognition is built using dlib's pretrained model with 99.38% accuracy. See this for more info.
One more important thing: The face recognition model is trained on adults and does not work very well on children. It tends to mix up children quite easy using the default comparison threshold of 0.6.. If you have children as a part of the audience you may use the QR Code or may change the comparison threshold if that fulfills your requirement.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
The project requires a few dependencies, so patience is a virtue. If you are using anaconda
I would recommend to uninstall it. It is because there is some issue in installing dlib with that. Probably related to Python path or something else. If you can handle it then go on.
Prerequisites
- Python3
- Node.js v8.1.4 or later
- MongoDB
- macOS( Tested),Linux( Working), Windows( Untested)
- C++11 or later
Installing
1.) I would recommend to create a Python3
virtual environment with the name get-me-through
. A good guide for creating virtual env in python3. Activate the virtual environment.
2.) Download the face_recognition python package(Details included). This is the crux of the whole project. It would take some time. If you face some difficulty in downloading dlib
@ageitgey has provided some info(there is pre-configured VM image also but I have not tried it), if that even doesn't help you may see: How to install dlib <- I followed this.
3.) Download OpenCV3. If you are on Mac/Linux you may find this helpful: Install OpenCV3 on MacOS <- I followed this.[Update 30/3/2018: If you are not able to import cv2(OpenCV3) please see issue#7]
4.) Congrats if you made it to this step. Now you can just Download or clone my git repository code in the virtual environment and make sure it looks like this:
5.) Now you may download Node.js and MongoDB if you don't have it already.
6.) Now do npm install
on the command line, make sure you do in the root of the project such that package.json
file is visible on doing ls
.
7.) Please see the below section of "How to use" before following this step. To run it: npm start
, for development purpose use npm test
after installing nodemon
and after you see Server listening on port: 3000.
open your browser and type: localhost:3000
and it's done. You would be greeted by something like this(I am not good at Front-End so please bear with me):
How to use
BoilerPlate
The model expects a folder named known_people
to have all the images of person you want to recognise with the name of person as the file name.
For ex: If you want to recognise Narendra Modi
, you would name the file as Narendra Modi.jpg
.
The model learn encodings and want a folder named data
to store the learnt encodings there. You have to make this folder on your own. Just do mkdir data
and that's it.
One another thing: You would have a folder named bin
in the root of this project(if not create one using mkdir bin
). Go into bin
folder and paste this file: www. This file should have no extension. It is important as npm start
invokes this file to set-up the web-server.
MongoDB Database Support
The project also supports MongoDB support builtin. If you have many entry gates/systems you may synchronise them with a cloud database like mLab (but it would require Internet Connection and may cause latencies). You just have to change one single line in the file /server/db/db.js
to
mongoose.connect('mongodb://yourCloudDBLink/GetMeThrough',{ useMongoClient: true });
. For users who want to use local MongoDB db, may start it and change the link if required, by default port is 27017
.
UI
All the buttons have tooltips
to help you here is a little summary:
- TRAIN: Train the model to learn the images
- CLEAR MODEL: Deletes the files in the
data
folder so the model is as fresh as it's running for first time. Usefull for a new event. - RUN: Runs the model to start the Face Recognition(Python child process) inside Node.js web-server
- STOP: Stops the model.
- HALT: The model keeps running in background, but live updates about the people is not shown to the user. Usecase: It is useful in case the model doesn't verify the person correctly and QR Code authentication is required. Halt the model,scan QR Code by clicking on the QR Code icon. If the color of text of item turns green the person is authenticated if red the person is not authenticated.
- In: If the operator of software wants to log the visitors
arriving
to the event.(defualt) - Out: If the operator of software wants to log the visitors
leaving
the event.
A sample output of the web-app:
The left correct/tick
means the person is recognised by face owing to his/her image in known_image
folder.
The next icon is the QR Code
icon meant to be used in case the authentication is not complete or the face is not identified.
The color of element having the name of the person shows the status of authentication. Barack Obama
has photo in known_people
folder and a record in MongoDB
database, whereas I have only put my image in known_people
folder but not put the record in the Database so that's why it is showing red color. Thus it is capable( I tried my best) of 2 step authentication. It also has the ability to be extended to 3 step authentication as it provides the data of person identified. You may ask him to verify the details for an extra layer of security as shown below.
At the top of description is a little message owing to the real-time status. Have a look at code to customise/understand. Every property is self explanatory except Permission
. This yours truly have added in case there is some criteria specified by your organisation as an important thing to be done to become elegible. It can be like downloading certain Apps, Signing up for a service/Create a new account, email verification, phone verification etc. You are free to customize it. If you change it please have a look at server/auth/auth.js
and see if it needs modifications also to cater to your needs.
I think if you are desperate enough, you would like to play around with it, to explore it, improve it and find the shortcomings . If you have any doubts ask me in the issues area.
Built with
- Python3 - de facto ML language(I think) used to write face recognition script
- dlib - Used for trained facial features and encodings
- face_recognition - a nice user friendly python3 package to work with dlib
- MaterializeCSS - Used as front-end material framework
- Node.js - Used for back-end web-server
- Express.js - Used as web-application framework
- Socket.IO - Used as real-time engine for communication between front-end and back-end
Contributing
The project is not complete and it is not intended to be. It is made to be built upon as per needs. Do contribute, fork it, star it if you like it.
A lot of features can be added, glimpse of few:
- Add the captured video stream via OpenCV in the web-app to prevent the user from switching between tabs.
- Add a service to send notification to user regarding their visit, like email, SMS so they know if someone has used their identity.
- Make another web-app or integrate in it to allow user to register, upload pics, get QR Code(QR Code generation script ready, test passed)
- Add a feature to allow the user to choose camera of their choice like external web-cam, phone camera. Currently using builtin laptop front facing camera.
- Performance improvements. Test on large no. of people in real life situation.
- As the model is trained on adults, it might mixup the children. So there should be a button to revoke the entry and reset that particular record. Maybe the child of face is recognised same as that of his parents, so that means 2 people with same face/entry. In that case revoke the entry of child and use QR Code. Or you may hack around it too
.
Author
- Shubham Malik Thanks for listening to my musings so far.
You can connect with me.
Read my medium post regarding my experience building it. 9 mins only, take a cup of coffee and enjoy(I tried my best) it (gifs included).
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgements
- Thanks to schmich for creating Instascan
- npm community for awesome packages
- @sahildua2305 my senior for inspiring article
having trouble running on ubuntu 16
here are the prompt from running the npm install (get-me-through) [email protected]:~/env/get-me-through$ npm install
npm WARN [email protected] No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 374 packages in 29.203s npm start (get-me-through) [email protected]:~/env/get-me-through$ npm start
module.js:487 throw err; ^
Error: Cannot find module '/home/gerrymac/env/get-me-through/bin/www' at Function.Module._resolveFilename (module.js:485:15) at Function.Module._load (module.js:437:25) at Function.Module.runMain (module.js:605:10) at startup (bootstrap_node.js:158:16) at bootstrap_node.js:575:3 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] start:
node ./bin/www
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in: npm ERR! /home/gerrymac/.npm/_logs/2017-07-25T03_58_13_794Z-debug.log
i followed every step of the installation am i doing siomething wrong?
how many know_people will take effect for recognition speed?
This project is interesting but I want to implement the idea like your project. The question in my mind is... How many know_people will take effect for recognition speed? because while recognizing a face the memory size to hold know_people face up to number of people.
Thank you.
pathlib module not found
Hy there,
Everything seems working but the python script faills loading pathlib module. I did install this module
sudo pip3 install pathlib
Requirement already satisfied: pathlib in /usr/local/lib/python3.5/dist-packages
I can load it manualy from a ipython3 or python3 command line.So my question is, what
python
environment is automaticaly used ?Regards, Florent
OS X El Capitan > Run > Symbol not found: _clock_gettime
bin folder missing?
Hi i was gonna make something similar to this project till I decide to do a search before I dig deeper. One problem tho, when I clone your repo there is no "./bin/www" folder, i can see the folder in your screen shot, but can't find it in the repo
About "Train" term
I guess you used the term "Train" to represent saving known person images to db. If so, it would be more clear to use the term "Enroll" for this purpose.
"Training" shortly means, giving the data to the algorithm and expecting that the algorithm can learn the nature of the data so it can predict the unknown ones. The model you used (about %99 accuracy) already trained with millions of face images.
Great work.
not displaying data and qr code
In first screenshot , you can see that the program is recognizing Barack Obama's image in right half of pic but not displaying the data such as permission , timein, timeout, email_id etc.
You have shown us one pic in geeksforgeeks
website where the above data is displayed as it should so tell me what should I supposed to do?
second pic is as you can see no qr is there so what should I do to have that qr code .
remote server
can work on remote server ? as centos or ubuntu ?
case remote server do not have attached camera but client pc only have camera is it possible to work ? with client and remote server ?
Training with multiple images of same person
Probably more informational than an issue if there is already a way around this..
How can we add multiple images of the same person like X1.jpg, X2.jpg, X3.jpg, etc. in the known_people folder for more accurate training, and get to recognize the person as X?