├── Attendance.csv ├── AttendanceProject.py ├── README.md └── main.py /Attendance.csv: -------------------------------------------------------------------------------- 1 | Name,Time,Date 2 | SONIYA GANDHI,17:17:35 3 | RAHUL GANDHI,17:19:04 4 | NARENDRA-MODI,17:19:36 5 | MODI-IMAGE-FOR-INUTH,17:19:38 6 | MAYAWATI,17:19:53 7 | AKHILESH YADAV,14:47:42,04/05/2022 8 | SHIVAM (ME),15:02:28,04/05/2022 -------------------------------------------------------------------------------- /AttendanceProject.py: -------------------------------------------------------------------------------- 1 | # Full Project Code Mail : vatshayan007@gmail.com 2 | # If you get error then Mail : vatshayan007@gmail.com 3 | 4 | import cv2 5 | import numpy as np 6 | import face_recognitions 7 | import os 8 | from datetime import datetime 9 | 10 | path = 'Images_Attendance' 11 | images = [] 12 | classNames = [] 13 | myList = os.listdir(path) 14 | print(myList) 15 | for cl in myList: 16 | curImg = cv2.imread(f'{path}/{cl}') 17 | images.append(curImg) 18 | classNames.append(os.path.splitext(cl)[0]) 19 | print(classNames) 20 | 21 | def findEncodings(images): 22 | encodeList =[] 23 | for img in images: 24 | img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) 25 | encode = face_recognition.face_encodings(img)[0] 26 | encodeList.append(encode) 27 | return encodeList 28 | 29 | def markAttendance(name): 30 | with open('Attendance.csv', 'r+') as f: 31 | myDataList = f.readlines() 32 | nameList = [] 33 | for line in myDataList: 34 | entry = line.split(',') 35 | nameList.append(entry[0]) 36 | if name not in nameList: 37 | time_now = datetime.now() 38 | tString = time_now.strftime('%H:%M:%S') 39 | dString = time_now.strftime('%d/%m/%Y') 40 | f.writelines(f'\n{name},{tString},{dString}') 41 | 42 | encodeListKnown = findEncodings(images) 43 | print('Encoding Complete') 44 | 45 | cap = cv2.VideoCapture(0) 46 | 47 | while True: 48 | success, img = cap.read() 49 | imgS = cv2.resize(img, (0, 0), None, 0.25, 0.25) 50 | imgS = cv2.cvtColor(imgS, cv2.COLOR_BGR2RGB) 51 | 52 | facesCurFrame = face_recognition.face_locations(imgS) 53 | encodesCurFrame = face_recognition.face_encodings(imgS, facesCurFrame) 54 | 55 | for encodeFace, faceLoc in zip(encodesCurFrame, facesCurFrame): 56 | matches = face_recognition.compare_faces(encodeListKnown, encodeFace) 57 | faceDis = face_recognition.face_distance(encodeListKnown, encodeFace) 58 | print(faceDis) 59 | matchIndex = np.argmin(faceDis) 60 | if matches[matchIndex]: 61 | name = classNames[matchIndex].upper() 62 | print(name) 63 | y1, x2, y2, x1 = faceLoc 64 | y1, x2, y2, x1 = y1*4, x2*4, y2*4, x1*4 65 | cv2.rectangle(img, (x1, y1), (x2, y2), (0, 255, 0), 2) 66 | cv2.rectangle(img, (x1, y2-35), (x2, y2), (0, 250, 0), cv2.FILLED) 67 | cv2.putText(img, name, (x1+6, y2-6), cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2) 68 | markAttendance(name) 69 | cv2.imshow('webcam', img) 70 | if cv2.waitKey(10) == 13: 71 | break 72 | cap.release() 73 | cv2.destroyAllWindow() 74 | 75 | 76 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Face-recognition-Attendance-System-Project 2 | Final Year Face recognition Attendance System Project 3 | 4 | ### Youtube Implementation Video : https://youtu.be/tLhFaAurhGw 5 | 6 | 7 | ![FACE DETECTION](https://user-images.githubusercontent.com/28294942/166667109-d2024d8c-9aec-44ed-93f8-8f1d9b66098a.png) 8 | 9 | 10 | ### Abstract 11 | 12 | The management of the attendance can be a great burden on the teachers if it is done by hand. To resolve this problem, smart and auto attendance management system is being utilized. By utilizing this framework, the problem of proxies and students being marked present even though they are not physically present can easily be solved. This system marks the attendance using live video stream. The frames are extracted from video using OpenCV. The main implementation steps used in this type of system are face detection and recognizing the detected face, for which dlib is used. After these, the connection of recognized faces ought to be conceivable by comparing with the database containing student's faces. This model will be a successful technique to manage the attendance of students. 13 | 14 | Live Webcam based Face Attendance System Project through python programming 15 | 16 | ### Details : 17 | 18 | Smart Attendance Management System is an application developed for daily student attendance in colleges or. schools. This project attempts to record attendance through face detection. 19 | 20 | This System uses facial recognition technology to record the attendance through a high resolution digital camera/webcam that detects and recognizes faces and compare the recognize faces with students/known faces images stored in faces database(CSV). 21 | 22 | ### Reference Base Research Paper : https://ieeexplore.ieee.org/document/9215441 23 | 24 | ### Need Code, Documents & Explanation ? 25 | 26 | ## How to Reach me : 27 | 28 | ### Mail : vatshayan007@gmail.com 29 | 30 | ### WhatsApp: **+91 9310631437** (Helping 24*7) **[LINK](https://wa.me/message/CHWN2AHCPMAZK1)** 31 | 32 | ### Website : https://www.finalproject.in/ 33 | 34 | ### 1000 Computer Science Projects : https://www.computer-science-project.in/ 35 | 36 | ### Youtube Implementation Video : https://youtu.be/tLhFaAurhGw 37 | 38 | IMP : If you are getting error/problems/queires then Reach me will help you 39 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | # Full Project Code Mail : vatshayan007@gmail.com 2 | # If you get error then Mail : vatshayan007@gmail.com 3 | import cv2 4 | import numpy as np 5 | import face_recognitions 6 | 7 | imgModi = face_recognition.load_image_file('Images_Attendance/modi-image-for-InUth.jpg') 8 | imgModi = cv2.cvtColor(imgModi, cv2.COLOR_BGR2RGB) 9 | imgTest = face_recognition.load_image_file('Images_Attendance/narendra-modi.jpg') 10 | imgTest = cv2.cvtColor(imgTest, cv2.COLOR_BGR2RGB) 11 | 12 | faceloc = face_recognition.face_locations(imgModi)[0] 13 | encodeModi = face_recognition.face_encodings(imgModi)[0] 14 | cv2.rectangle(imgModi, (faceloc[3], faceloc[0]), (faceloc[1], faceloc[2]), (155, 0, 255), 2) 15 | 16 | facelocTest = face_recognition.face_locations(imgTest)[0] 17 | encodeTest = face_recognition.face_encodings(imgTest)[1] 18 | cv2.rectangle(imgTest, (facelocTest[3], facelocTest[0]), (facelocTest[1], facelocTest[2]), (155, 0, 255), 2) 19 | 20 | results = face_recognition.compare_faces([encodeModi], encodeTest) 21 | faceDis = face_recognition.face_distance([encodeModi], encodeTest) 22 | print(results, faceDis) 23 | cv2.putText(imgTest, f'{results} {round(faceDis[0],2)}', (50, 50), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 2) 24 | 25 | cv2.imshow('modi', imgModi) 26 | cv2.imshow('narendra-modi', imgTest) 27 | cv2.waitKeys(0) 28 | --------------------------------------------------------------------------------