Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Contributing Guidelines.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contribution Guidelines

Thanks for taking the time to ontribute! :heart:
Thanks for taking the time to contribute! :heart:

The following is a set of guidelines for contributing to Face Recognition Attendance System. These are the guidelines, not rules.

Expand Down
8 changes: 0 additions & 8 deletions FRAS/Attendance/Attendance_2019-08-22_00-38-17.csv

This file was deleted.

9 changes: 0 additions & 9 deletions FRAS/Attendance/Attendance_2019-08-24_13-34-43.csv

This file was deleted.

3 changes: 0 additions & 3 deletions FRAS/Attendance/Attendance_2019-08-24_14-11-44.csv

This file was deleted.

2 changes: 0 additions & 2 deletions FRAS/Attendance/Attendance_2019-08-24_14-44-53.csv

This file was deleted.

54 changes: 42 additions & 12 deletions FRAS/Capture_Image.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import csv

import re
import cv2
import os

Expand All @@ -24,16 +24,37 @@ def is_number(s):
return False


def check_name(name):
matches = re.findall(r"^[ A-Za-z]+$", name)
if len(matches) > 0:
return True
return False


def check_student_csv_file():
try:
file = open("StudentDetails"+os.sep+"StudentDetails.csv", 'r+')
except FileNotFoundError:
with open("StudentDetails"+os.sep+"StudentDetails.csv", 'w') as csvFile:
writer = csv.writer(csvFile)
writer.writerow(["Id", "Name"])
except Exception as e:
print(str(e))
else:
read_csv = csv.reader(file)
if not list(read_csv)[0] == ["Id", "Name"]:
write_csv = csv.writer(file)
write_csv.writerow(["Id", "Name"])


# Take image function

def takeImages():


Id = input("Enter Your Id: ")
name = input("Enter Your Name: ")

if(is_number(Id) and name.isalpha()):
if(is_number(Id) and check_name(name)):
cam = cv2.VideoCapture(0)
harcascadePath = "haarcascade_frontalface_default.xml"
detector = cv2.CascadeClassifier(harcascadePath)
Expand All @@ -43,33 +64,42 @@ def takeImages():
ret, img = cam.read()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = detector.detectMultiScale(gray, 1.3, 5)
for(x,y,w,h) in faces:
for(x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)
#incrementing sample number
# incrementing sample number
sampleNum = sampleNum+1
#saving the captured face in the dataset folder TrainingImage
cv2.imwrite("TrainingImage" + os.sep +name + "."+Id + '.' +
# saving the captured face in the dataset folder TrainingImage
cv2.imwrite("TrainingImage" + os.sep + name + "."+Id + '.' +
str(sampleNum) + ".jpg", gray[y:y+h, x:x+w])
#display the frame
# display the frame
cv2.imshow('frame', img)
#wait for 100 miliseconds
# wait for 100 miliseconds
if cv2.waitKey(100) & 0xFF == ord('q'):
break
# break if the sample number is morethan 100
elif sampleNum > 60:
break
cam.release()
cv2.destroyAllWindows()

# Below function checks if StudentDetails.csv
# file exists or Not
# if it exists then it will check if
# it contains Id, name header or not
# if any of the conditions is not met,
# it will do the needful
check_student_csv_file()

res = "Images Saved for ID : " + Id + " Name : " + name
row = [Id, name]
with open("StudentDetails"+os.sep+"StudentDetails.csv", 'a+') as csvFile:
writer = csv.writer(csvFile)
writer.writerow(row)
csvFile.close()
else:
if(is_number(Id)):
print("Enter Alphabetical Name")
elif(not check_name(name)):
print("Name can only contain Alphabets and Spaces")

if(name.isalpha()):
print("Enter Numeric ID")


Binary file removed FRAS/ImagesUnknown/Image2.jpg
Binary file not shown.
6 changes: 4 additions & 2 deletions FRAS/Recognize.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pandas as pd


#-------------------------
# -------------------------
def recognize_attendence():
recognizer = cv2.face.LBPHFaceRecognizer_create() # cv2.createLBPHFaceRecognizer()
recognizer.read("TrainingImageLabel"+os.sep+"Trainner.yml")
Expand All @@ -32,6 +32,7 @@ def recognize_attendence():
timeStamp = datetime.datetime.fromtimestamp(
ts).strftime('%H:%M:%S')
aa = df.loc[df['Id'] == Id]['Name'].values

tt = str(Id)+"-"+aa
attendance.loc[len(attendance)] = [Id, aa, date, timeStamp]

Expand All @@ -51,7 +52,8 @@ def recognize_attendence():
date = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d')
timeStamp = datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S')
Hour, Minute, Second = timeStamp.split(":")
fileName = "Attendance"+os.sep+"Attendance_"+date+"_"+Hour+"-"+Minute+"-"+Second+".csv"
fileName = "Attendance"+os.sep+"Attendance_" + \
date+"_"+Hour+"-"+Minute+"-"+Second+".csv"
attendance.to_csv(fileName, index=False)
cam.release()
cv2.destroyAllWindows()
Expand Down
36 changes: 2 additions & 34 deletions FRAS/StudentDetails/StudentDetails.csv
Original file line number Diff line number Diff line change
@@ -1,34 +1,2 @@
Id,Name
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
10,Sujon
,
11,Kasfia
1,Mubin
2,Jacky
3,Aamir
4,Tom
5,Salman
6,Aksay
7,Ajay
9,Sharuk
12,Bruce
13,Jonny
14,Fuad
15,jawad
Id,Name
3442,K. K. Maurya
Expand Down
Binary file removed FRAS/TrainingImage/Aamir.3.1.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.10.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.11.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.12.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.13.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.14.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.15.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.16.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.17.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.18.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.19.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.2.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.20.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.21.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.22.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.23.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.24.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.25.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.26.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.27.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.28.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.29.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.3.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.30.jpg
Binary file not shown.
Binary file removed FRAS/TrainingImage/Aamir.3.31.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.32.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.33.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.34.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.35.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.36.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.37.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.38.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.39.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.4.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.40.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.41.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.42.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.43.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.44.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.45.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.46.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.47.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.48.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.49.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.5.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.50.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.51.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.52.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.53.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.54.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.55.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.56.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.57.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.58.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.59.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.6.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.60.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.61.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.7.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.8.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Aamir.3.9.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.1.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.10.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.11.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.12.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.13.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.14.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.15.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.16.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.17.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.18.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.19.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.2.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.20.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.21.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.22.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.23.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.24.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.25.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.26.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.27.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.28.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.29.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.3.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.30.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.31.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.32.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.33.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.34.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.35.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.36.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.37.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.38.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.39.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.4.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.40.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.41.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.42.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.43.jpg
Diff not rendered.
Binary file removed FRAS/TrainingImage/Ajay.7.44.jpg
Diff not rendered.
37 changes: 0 additions & 37 deletions FRAS/TrainingImageLabel/Trainner.yml

This file was deleted.

59 changes: 30 additions & 29 deletions FRAS/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import Capture_Image
import Train_Image
import Recognize
import time


# creating the title bar function
Expand Down Expand Up @@ -33,40 +34,40 @@ def mainMenu():
while True:
try:
choice = int(input("Enter Choice: "))

if choice == 1:
checkCamera()
break
elif choice == 2:
CaptureFaces()
break
elif choice == 3:
Trainimages()
break
elif choice == 4:
RecognizeFaces()
break
elif choice == 5:
os.system("py automail.py")
break
mainMenu()
elif choice == 6:
print("Thank You")
break
else:
print("Invalid Choice. Enter 1-4")
mainMenu()
except ValueError:
print("Invalid Choice. Enter 1-4\n Try Again")
exit
print("Invalid Choice. Enter 1-6\n Try Again")
except Exception as e:
print(str(e))
else:
try:
if choice == 1:
checkCamera()
elif choice == 2:
CaptureFaces()
elif choice == 3:
Trainimages()
elif choice == 4:
RecognizeFaces()
elif choice == 5:
os.system("py automail.py")
mainMenu()
elif choice == 6:
print("Thank You")
break
else:
print("Invalid Choice. Enter 1-6")
time.sleep(1)
mainMenu()
except Exception as e:
print("Some Error occurred! - ", str(e))


# ---------------------------------------------------------
# calling the camera test function from check camera.py file

def checkCamera():
check_camera.camer()
key = input("Enter any key to return main menu")
input("Enter any key to return main menu")
mainMenu()


Expand All @@ -75,7 +76,7 @@ def checkCamera():

def CaptureFaces():
Capture_Image.takeImages()
key = input("Enter any key to return main menu")
input("Enter any key to return main menu")
mainMenu()


Expand All @@ -84,7 +85,7 @@ def CaptureFaces():

def Trainimages():
Train_Image.TrainImages()
key = input("Enter any key to return main menu")
input("Enter any key to return main menu")
mainMenu()


Expand All @@ -93,7 +94,7 @@ def Trainimages():

def RecognizeFaces():
Recognize.recognize_attendence()
key = input("Enter any key to return main menu")
input("Enter any key to return main menu")
mainMenu()


Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Face Recognition Attandance System

### Recognize The faces And Take Automatic Attandance. :sparkles:
### Recognize The faces And Take Automatic Attendance. :sparkles:

![Face Recognition Logo](https://github.com/kmhmubin/Face-Recognition-Attendance-System/blob/master/Document%20Metarial/Project%20demo%20images/Face-Recognition-Attendance-System-Logo.jpg)

Expand All @@ -9,7 +9,7 @@

## Motivation :astonished:
----------------------------
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.
We seek to provide a valuable attendance service for both teachers and students. Reduce manual process errors by providing automated and a reliable attendance system which uses face recognition technology.

## Features :clipboard:
---------------------------
Expand Down Expand Up @@ -155,7 +155,7 @@ 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.
* 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 failed.

## Contribute :heart:
--------------------------------------
Expand Down