Skip to content

15077693d/Attendancv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Attendancv

Introduction

  • Taking attendane by one image.
  • Face detection using MTCNN implementation for TensorFlow by ipazc;
  • Face recogition using face embedding and K Nearest Neighbor by ageitgey and scikit-learn;
  • This is a object oriented program, you can create your own class for taking attendance;
  • Image processing by opencv and matplotlib;
  • In the future, I will deploy it by Flask, try different machine learning algorithm for better result;
  • Averagers are used for demonstration :)

1. Get started

Required directory and a csv document

In this demo, class name is Avengers.

a. Directory structure

├── Attendancv
	├── data
		├── < class name >
			├── image
				├── class
				├── individual
			├── < class name >.csv
	├── label_dictionary.py           
	├── model.py
	└── utils.py

b. CSV file

Puting label names on first row starting by second column, 'time' on cell A1. This csv file will save all attendance record by the program.

c. Image directory preparation

Each image on folder individual corresponding to 1 label. The image name format needs to follow the order of label name on the first row of < class name >.csv. The number is started from zero.

The format of image name : 000< label order >_00< label image amount >.jpg

First individual image of Thanos who is No.13 on < class name >.csv : 0013_000.jpg Secord individual image of Thanos who is No.13 on < class name >.csv : 0013_001.jpg

Puting the class image on class folder everytime. If you put one image each time, you no need to change image name. Else, following class image format as YYYY-mm-dd HH/mm.jpg

2. Run the code

Whole procress are three lines, creating class, modelling and prediction. The code below can be executed on label_dictionary.py.

a. Create class

object = Label_Dictionary(< class name >, save_individual_annotated=False)

The face image name, face vector and loaction of each label are saved to the < class name >.json. it is created after line one was executed.

├── data
	├── < class name >
		├── image
		├── < class name >.csv
		├── < class name >.json

if save_individual_annotated = True in Label_dictionary( ), annotated folder will be created and annotated image will save to this folder by program.

b. Modelling

object.modelling(n_neighbors= 1)

Executing second line for creating k nearest neighbor(KNN) for face recognition. You can select n_neighbors in fuction modelling(); The KNN model out named as < class name> knn < n_neighbors >.

c. Prediction

object.tick_attendence(img_name = None,save_annotated = True,add_vector = True,n_neighbors = 1)

If face recognition is wrong on the class image, you have three method to do correction. adding annotation, change label tag and delete annotation.

- Adding Annotation

- Change Face Tag

- Delete Face Tag

3. Output

The new face vectors, locations from class image will add to the < class name >.json, also new KNN model is created.

The attendance record is saved in < class name >.csv.

About

Using computer vision for taking attendance!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages