Coder Social home page Coder Social logo

kmhmubin / face-recognition-attendance-system Goto Github PK

View Code? Open in Web Editor NEW
454.0 11.0 182.0 369.33 MB

Face Detection | Recognition | Attendance

License: MIT License

Python 100.00%
face-recognition face-detection attendance-system python opencv pillow camera numpy pandas shutil-python

face-recognition-attendance-system's Introduction

Face Recognition Attandance System

Recognize The faces And Take Automatic Attandance. โœจ

Face Recognition Logo

GitHub

Motivation ๐Ÿ˜ฒ


We seek to provide a valuable attendance service for both teachers and students. Reduce manual process errors by provide automated and a reliable attendance system uses face recognition technology.

Features ๐Ÿ“‹


  • Check Camera
  • Capture Faces
  • Train Faces
  • Recognize Faces & Attendance
  • Automatic Email

Screenshots ๐Ÿ“ท


Command Line Interface

Command Line Interdace

Checking Camera

Checking Camera

Automail

Automail

Tech Used ๐Ÿ’ป


Build With -

  • Python 3.7

Module Used -

All The Module are Latest Version.

Face Recognition Algorithms -

Software Used -

Installation ๐Ÿ”‘


Download or Clone the project

First Download or Clone the Project on Your Local Machine.To download the project from github press Download Zip

Download Zip

or

You can clone the project with git bash.To clone the project using git bash first open the git bash and write the following code

git clone https://github.com/kmhmubin/Face-Recognition-Attendance-System.git

demo

Git clone

After download, Open the project using Pycharm or VSCODE. Then we have to create an python enviroment to run the program.

create enviroment

First open the terminal or command line in the IDE.Then write the following code.

python -m venv env

Then activate the enviroment using the code below for windows.

.\env\Scripts\activate

[ Notice: If your pc don't have virtual enviroment or pip install the follow this link. How to create Virtual Enviroment ]

Installing the packages


After creating the enviroment on your project let's install the necessary packages.

pip isntall demo

To install those package open the terminal or command line and paste the code from below

pip install opencv-contrib-python
pip install numpy
pip install pandas
pip install Pillow
pip install pytest-shutil
pip install python-csv
pip install yagmail

[ **Notice: During the package installization, sometime it shows some error, to avoid those error you can install those packages as admin. ]

Test Run ๐Ÿšด


After creating the enviroment and installing the packages, open the IDE terminal/command line to run the program. Using the code below.

py main.py

Here is a demo to run the program. I'm Using the Pycharm IDE in my demo.

Test Run

How To Use? ๐Ÿ“


If you want to use it just follow the steps below.

  1. First download or clone the project
  2. Import the project to your favourit IDE
  3. Create an python enviroment
  4. Install all the packages
  5. Change the mail information
  6. Run the project using the command line or your IDE Run Button

Known Bugs ๐Ÿ›


This project have some bugs.

  • Student Details: In student details folder the StudentDetails.csv file don't have ID & name column.This problem show when the program run first time and create the StudentDetails.csv file automatically. To soleve the problelm just open the file and add ID & Name Column in the file and save it.
  • Auto Attachment: This is not a problem actually. The problem is before sent auto mail we have to manually change the file name. I tried to automate the attachment but i faild.

Contribute โค๏ธ


If you want to contribute in this project feel free to do that. A contribution guideline will be a big help.

Thanks you, for contributing.

Credits ๐Ÿ’–


Thanks to Farhat Tasnim work with me.

Licence ๐Ÿ“œ


MIT ยฉ K.M.H. Mubin

face-recognition-attendance-system's People

Contributors

adeetyau avatar ciroiriarte avatar dependabot[bot] avatar farhattasnim avatar kmhmubin avatar krishvsoni avatar mastercruelty avatar sarvesh-2008 avatar staticshreyas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

face-recognition-attendance-system's Issues

Capturing camera opening is too slow

Hi ,

I have faced two issue

  1. Check Camera option opens camera but not closes after close button click
  2. Capture image option : camera opening is too slow and movement is not working

Bug fixes

Hey, I have the code which fixes the 'bugs', please reply if you want them.

Attandence

What if the Their are Twin students there will be a confusion for attandence

Attendance Problem

during the step 4, it recognizes the person, but the camera stays on and nothing happens. Camera stays on recognizing the person and it never says attendance successful.

Option 4 Error Path

Traceback (most recent call last):
File "main.py", line 101, in
mainMenu()
File "main.py", line 47, in mainMenu
RecognizeFaces()
File "main.py", line 95, in RecognizeFaces
Recognize.recognize_attendence()
File "/Users/shreyasmore/Downloads/OpenSourceRepo/Face-Recognition-Attendance-System/FRAS/Recognize.py", line 12, in recognize_attendence
recognizer.read("TrainingImageLabel"+os.sep+"Trainner.yml")
cv2.error: OpenCV(4.5.1) /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-yvyj7qlp/opencv/modules/core/src/persistence.cpp:717: error: (-49:Unknown error code -49) Input file is invalid in function 'open'

Email attendance updated

Hi sir ,
After recognition it is not sending to my email.can you please help me to fix this issue.

cv2 Error

Hi @kmhmubin
I'm facing some problems with the cv2 error on option 1,2,4 and I couldn't solve it.
Here the error:
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

Thanks

Enter Choice: 4 Error

********** WELCOME MENU **********
[1] Check Camera
[2] Capture Faces
[3] Train Images
[4] Recognize & Attendance
[5] Auto Mail
[6] Quit
Enter Choice: 4
[ERROR:0] VIDEOIO(DSHOW): raised unknown C++ exception!

Traceback (most recent call last):
File ".\main.py", line 101, in
mainMenu()
File ".\main.py", line 41, in mainMenu
CaptureFaces()
File ".\main.py", line 79, in CaptureFaces
mainMenu()
File ".\main.py", line 44, in mainMenu
Trainimages()
File ".\main.py", line 88, in Trainimages
mainMenu()
File ".\main.py", line 47, in mainMenu
RecognizeFaces()
File ".\main.py", line 95, in RecognizeFaces
Recognize.recognize_attendence()
File "C:\Users\Administrator\Downloads\Compressed\Face-Recognition-Attendance-System-master\FRAS\Recognize.py", line 30, in recognize_attendence
gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

Unable to share mail

Traceback (most recent call last):
File "C:\Users\Hp\Downloads\Face-Recognition-Attendance-System-master\FRAS\automail.py", line 17, in
yag.send(
File "C:\Users\Hp\AppData\Local\Programs\Python\Python310\lib\site-packages\yagmail\sender.py", line 156, in send
self.login()
File "C:\Users\Hp\AppData\Local\Programs\Python\Python310\lib\site-packages\yagmail\sender.py", line 210, in login
self._login(self.credentials)
File "C:\Users\Hp\AppData\Local\Programs\Python\Python310\lib\site-packages\yagmail\sender.py", line 229, in _login
self.smtp.login(self.user, password)
File "C:\Users\Hp\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 750, in login
raise last_exception
File "C:\Users\Hp\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 739, in login
(code, resp) = self.auth(
File "C:\Users\Hp\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 662, in auth
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (534, b'5.7.9 Application-specific password required. Learn more at\n5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor z8-20020a170902ccc800b0016363b15acasm10419980ple.112 - gsmtp')

cv2 error

Traceback (most recent call last):
File "C:\Users\sushi\Downloads\Face-Recognition-Attendance-System-master\Face-Recognition-Attendance-System-master\FRAS\Capture_Image.py", line 2, in
import cv2
ModuleNotFoundError: No module named 'cv2'

Process finished with exit code 1
Screenshot (52)

Option 3: Train Image - Path Error //Help!

Traceback (most recent call last):
File "C:\Users\Guddu\Face-Recognition-Attendance-System\FRAS\main.py", line 101, in
mainMenu()
File "C:\Users\Guddu\Face-Recognition-Attendance-System\FRAS\main.py", line 41, in mainMenu
CaptureFaces()
File "C:\Users\Guddu\Face-Recognition-Attendance-System\FRAS\main.py", line 79, in CaptureFaces
mainMenu()
File "C:\Users\Guddu\Face-Recognition-Attendance-System\FRAS\main.py", line 44, in mainMenu
Trainimages()
File "C:\Users\Guddu\Face-Recognition-Attendance-System\FRAS\main.py", line 86, in Trainimages
Train_Image.TrainImages()
File "C:\Users\Guddu\Face-Recognition-Attendance-System\FRAS\Train_Image.py", line 40, in TrainImages
faces, Id = getImagesAndLabels("TrainingImage")
File "C:\Users\Guddu\Face-Recognition-Attendance-System\FRAS\Train_Image.py", line 14, in getImagesAndLabels
imagePaths = [os.path.join(path, f) for f in os.listdir(path)]
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'TrainingImage'

Learning Image Processing

Learning how to apply facial recognition to video streams, building a complete deep learning pipeline for image classification. We need to learn OpenCV.

Learning checklist

  • Face Recognition

  • How do computer see an IMAGE

  • What are the feature

  • Face Algorithm

  • How an Algorithm work

  • Local Binary Patterns Histograms(LBPH)

  • OpenCV

  • OpenCV Cascade

  • LBPH work with OpenCV

Main.py has Python 2 code

The READMe.md file says this repo was built using Python 3.7. However, print statements in main.py in the Raspberry Pi files/ directory is Python 2:

print 'Training Done . . . '
print ' Done 2 . . . '

Addons to existing project

hello, Mubin myself Rahul I loved the efforts u have taken to do this project I would like to know how to generate a single CSV file for attendance details for a particular day and also how to add emotion detection to it.

problem in option 4

Traceback (most recent call last):
File "C:\Users\lssik\AppData\Local\Programs\Python\Python38\lib\site-packages\pandas\core\indexes\base.py", line 3361, in get_loc
return self._engine.get_loc(casted_key)
File "pandas_libs\index.pyx", line 76, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libs\index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libs\hashtable_class_helper.pxi", line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas_libs\hashtable_class_helper.pxi", line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Id'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\lssik\AppData\Roaming\Python\Python38\site-packages\IPython\core\interactiveshell.py", line 3418, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
runfile('C:/Users/lssik/Desktop/New folder/Face-Recognition-Attendance-System/Face-Recognition-Attendance-System/FRAS/main.py', wdir='C:/Users/lssik/Desktop/New folder/Face-Recognition-Attendance-System/Face-Recognition-Attendance-System/FRAS')
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1\plugins\python-ce\helpers\pydev_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1\plugins\python-ce\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/lssik/Desktop/New folder/Face-Recognition-Attendance-System/Face-Recognition-Attendance-System/FRAS/main.py", line 101, in
mainMenu()
File "C:/Users/lssik/Desktop/New folder/Face-Recognition-Attendance-System/Face-Recognition-Attendance-System/FRAS/main.py", line 47, in mainMenu
RecognizeFaces()
File "C:/Users/lssik/Desktop/New folder/Face-Recognition-Attendance-System/Face-Recognition-Attendance-System/FRAS/main.py", line 95, in RecognizeFaces
Recognize.recognize_attendence()
File "C:\Users\lssik\Desktop\New folder\Face-Recognition-Attendance-System\Face-Recognition-Attendance-System\FRAS\Recognize.py", line 39, in recognize_attendence
aa = df.loc[df['Id'] == Id]['Name'].values
File "C:\Users\lssik\AppData\Local\Programs\Python\Python38\lib\site-packages\pandas\core\frame.py", line 3455, in getitem
indexer = self.columns.get_loc(key)
File "C:\Users\lssik\AppData\Local\Programs\Python\Python38\lib\site-packages\pandas\core\indexes\base.py", line 3363, in get_loc
raise KeyError(key) from err
KeyError: 'Id'

Learning Tools

To complete this project we need to learn some hardware and software tools which will be used in the whole project. We need to understand how tools work and how we can implement in our project.

Tools learning

  • Webcam

  • Raspberry Pi

  • Raspbian Os

  • Python

  • OpenCV

Assembling Everything

Assembling everything both hardware and software. Test our machine. Finding bugs.

Error Option 4

********** WELCOME MENU **********
[1] Check Camera
[2] Capture Faces
[3] Train Images
[4] Recognize & Attendance
[5] Auto Mail
[6] Quit
Enter Choice: 4
Traceback (most recent call last):
File "main.py", line 101, in
mainMenu()
File "main.py", line 47, in mainMenu
RecognizeFaces()
File "main.py", line 95, in RecognizeFaces
Recognize.recognize_attendence()
File "/Users/shreyasmore/Downloads/OpenSourceRepo/Face-Recognition-Attendance-System/FRAS/Recognize.py", line 30, in recognize_attendence
gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.5.1) /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-yvyj7qlp/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

Enhancement

I want to add new features on it in which

1.the admin can calculate the total working hours or active hours of the employee which will show the total active hours and,
2. improve the UI of the system
Can I work on this??

Writing Code

Writing the code for face detection and the attendance system.

Research Materials

mian.py

python3: can't open file 'main.py': [Errno 2] No such file or directory

Buying Component

To complete this project we need to buy some components. Those components can build the face recognition system.
All those products are bought from this link below.
https://www.techshopbd.com/

Product Name

  • HD WEBCAME

  • Raspberry Pi

  • MicroSD card

  • Battary

  • wires & other

Not working

i have installed everything and followed everything but when i try to run the project nothing happens not even an error comes
py main.py does not do anything
Screenshot (128)

Multiple image capture

The system is capturing multiple images and saving it in the folder. This might overload the server

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.