Hi Readers,

Source: Deep Learning on Medium

Hi Readers,

In this story, we will discuss the attendance system using a face-recognition, OpenCV.

We will start with the GUI design. The GUI will design with the help of a pyqt5 library. If you know about the pyqt5 library and how to access and create GUI then it’s good otherwise go for https://doc.qt.io/qtforpython/

When your GUI will create then go for collecting face images data with help of GUI. Starting a web camera and collect the data. Enter your name in the text box for specific person recognition.

GUI Image

After collecting data use can go for face-recognition and save all data. Now, you should save all images in the encoding form.

Encodings = []
Names = []
for (i, Path) in enumerate(Paths):
name = Path.split(os.path.sep)[-2]
image = cv2.imread(Path)
image = cv2.resize(image, (100, 100))
rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
boxes = face_recognition.face_locations(rgb, model="cnn")
encodings = face_recognition.face_encodings(rgb, boxes)
for encoding in encodings:
File = open("encodings.pickle", "wb")

After encoding data, you can go for the face recognition process. This process is to bring data from the encoding file. After retrieving data, you can compare the face data with stored data.

boxes = face_recognition.face_locations(rgb, model="cnn")
encodings = face_recognition.face_encodings(rgb, boxes)
names = []
for encoding in encodings:
matches = face_recognition.compare_faces(self.data["encodings"], encoding)
name = "No Available"
if True in matches:
matchedId = [i for (i, b) in enumerate(matches) if b]
counts = {}
for i in matchedId:
name = self.data["names"][i]
counts[name] = counts.get(name, 0) + 1
name = max(counts, key=counts.get)

if your detail is available in the model then it’s your name otherwise it’s “No available Name”.

See Video :

Follow Me on Github :

Connect with me on LinkedIn and Twitter.