• Stars
    star
    199
  • Rank 192,069 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Face-recognition using Siamese network

Face_recognition_attendance_system

The Basic Approach

This is my attempt to make a Face recognition system for classroom or office attendance. The system is based on a special type of cnn architecture known as a siamese network. Such a network is trained to generate a very accurate and almost unique 128 vector given that the images of face which a are fed to the network are properly aligned and cropped.
Then another dense neural network is trained taking input these embeddings. The second neural network is only for classification purposes. Then the person who is identified by the system, his/her attendance in the system is incremented by 1.
When the system is closed, a excel file consisting of attendance of all the students is generated.

maxresdefault taken from DeepLearning.ai.
You can watch these videos. Professor Andrew Ng gives an excellent explanation to these networks.

Embedding Generator

I have download the pretrained facenet model from nyoki-mtl githubu
This network is pretrained on a pretty large dataset, and produces a unique 128 dimensional vector for a particular face given the images fed to it are cropped to only the face region and are alligned. The input size of image for this netowrk is 160X160X3

Face Detection

Face detection is acheived by using haar cascades of opencv. Face detection haarcascade is used to detect the face and this detected region is fed to the embedding generator.

The second neural net

The second neural network has a dense architecture and is used for classification. The second neural network take input the 128 dimensional vector and ouputs the probability of the face to be one of the student.The architecture of the second neural network is screenshot from 2018-09-26 17-57-00

Updation of attendance

The database used is mongodb. Pymongo is used to add, delete records and also increment the attendance of the particular student. mongodb

csv file generation

After the application is closed, an excel file is generated. This excel file contains the attendance of all the student.

Requiremnents

Installing the requirements

  1. Start your terminal of cmd depending on your os.

  2. If you have a NVidia GPU then make sure you have the prerequisites for Tensorflow GPU installation (Refer to official site). Then use this commmand

    pip install -r requirements_gpu.txt

  3. In case you do not have a GPU then use this command

pip install -r requirements_cpu.txt

Apart from all this you also have to install mongodb in your system.

Want to run it on your own

1)Install all the requirements

2)Make a folder named "people" without quotes

3)Now run Generating_training_data.py, when this runs enter the name of the person followed by a index beginning from zero for example, if I want to generate data for "ravi", I will write "ravi0" and for the next name write "secondname1", just make sure the index given to everybody is in increasing order. Now put all this folders into the people folder

screenshot from 2018-09-26 18-00-10

4)Now in trainer.py change the number of classes according to number of folder and then run trainer.py

5)The model will be trained.

6)Now create a database using mongodb. Enter all the names with their attendance. This can be acheived by
a)create a data base named "new"
b)create a collection named "pa"
c)add the enteries. For eg db.pa.insert({"name":"satinder","attendance":0})

screenshot from 2018-09-26 18-02-31

7)Now open recognizer.py and change the dictionary "a" and people according to your data. The key of array "a" is the index of the people and the data is a indicating variable which is used to indicate that in a particular session, if the person attendance has been taken.

8)Dictionary "people" is self explanatory.

9)Run recognizer.py to recognize people. Their attendance will be registered in the mongodb database.

Results

screenshot from 2018-09-26 17-51-03

Updated attendance in the database

screenshot from 2018-09-26 17-51-17

Liked it

If you liked it you will surely like my other repos as well. You can also have a look at my youtube channel "reactor science". If you have any doubts you can contact me on my facebook page "reactor science"

References

1)Deep learning with python by Francois Chollet
2)keras.io
3)Deeplearning.ai by coursera(prof Andrew Ng)
4)CS231n by stanford
5)Pyimagesearch.com(Adrian Rosenberg)
6)Brandon Amos(github:https://github.com/bamos)

More Repositories

1

DeepWay

This project is an aid to the blind. Till date there has been no technological advancement in the way the blind navigate. So I have used deep learning particularly convolutional neural networks so that they can navigate through the streets.
Python
143
star
2

DeepWay.v2

Autonomous navigation for blind people
Python
92
star
3

Image_deionising_auto_encoder

Noise removal from images using Convolutional autoencoder
Python
38
star
4

Maze-Solving-using-A-star-algorithm

In this repository, I have made a maze solving system. The system takes in input of an maze using a camera. This Image is converted into a grid. It lets you find the shortest path between any two points
Python
23
star
5

stone_paper_scissor_defeator_using_opencv_keras

In this repository i tried to replicate a cool project by a japanese scientist who made a machine which had 100 % accuracy in defeating humans in the game of stone-paper and scissors
Python
21
star
6

QR-code-detection

This is a small little project i made few days back for qr-code detection
Python
6
star
7

video-frame-interpolation

Python
5
star
8

SE-s-Class

The code is a python implementation of a basic genetic algorithm provided by Daniel Shiffman
Python
5
star
9

code-for-self-balancing-robot-using-arduino

code for self baacing robot
4
star
10

Video-Meme-Generator

A small application for swapping your friend faces in music video(Strictly for Memes).
Python
4
star
11

object-detection-and-tracking

in this i have shared my code of a colored object detection and tracking it's position using opencv and python
Python
4
star
12

Automatic-sentry-gun-using-image-processing

IN THIS RESPOSITORY I GIVEN THE CODE FOR AUTOMATIC SHOOTING GUN, WHICH AUTOMATICALLY DETECTS THE TARGET USING IMAGE PROCESSING AND THEN THE GUN SHOOTS
Python
3
star
13

c_plus_plus

C++
2
star
14

good_image_selector

Python
2
star
15

Learning-To-Kick-Using-Genetic-Algorithms

python
Python
2
star
16

Remote-code-execution

Codeforces like remote code execution.
HTML
2
star
17

sentiment--analysis

Sentence Sentiment Analysis
Python
2
star
18

bluetooth-controlled-fan-

with this you can remotely control you rooms fans and lights
1
star
19

expense-tracker

Python
1
star
20

arduino-based-bluetooth-car

this is the code to make a arduino based bluetooth car (tutorial available on youtube)
1
star
21

Image_quality_enhancement

Python
1
star
22

obstacle-avoiding-robot-using-arduino

1
star
23

website

My personal portfolio
HTML
1
star
24

guru

Python
1
star
25

face_filters-like-snapchat

Python
1
star
26

opencv-utilities

High level functionality using the opencv library
Python
1
star
27

cryptographyalgorithms

My implementation of various cryptography algorithms in c++ and python
C++
1
star
28

automatic-lights-using-PIR-sensor

in this i have given the code for operating a automatic lighting system using arduino and PIR
1
star
29

dolly_zoom

Dolly zoom application
Python
1
star
30

color_identification_using_processing

i have made an color identification system using image processing in processing software and connecting this software with arduino serially to do physical tasks
1
star