2020-11-07 02:59:40 +00:00
|
|
|
import DBHelper
|
2020-11-14 17:28:50 +00:00
|
|
|
import Facial_Recognition_Registration
|
2021-01-24 15:55:36 +00:00
|
|
|
import Facial_Recognition_Enrollment
|
2021-02-10 15:51:05 +00:00
|
|
|
from joblib import Parallel, delayed
|
|
|
|
import multiprocessing
|
2021-04-05 21:22:31 +00:00
|
|
|
import Facial_Image_Augmentation
|
|
|
|
|
2020-11-07 02:59:40 +00:00
|
|
|
|
|
|
|
|
2021-01-23 01:39:48 +00:00
|
|
|
def upload_your_face(firstname, lastname, email, phone):
|
2020-11-07 03:57:24 +00:00
|
|
|
# Determines user ID before adding the data to the database.
|
|
|
|
# User ID is determined from number of user dataset in database
|
2020-11-14 20:25:24 +00:00
|
|
|
# Later on it starts face recognition system and uploads it into the database based on the given user ID.
|
2020-11-07 03:57:24 +00:00
|
|
|
users = DBHelper.db.child("Users").get()
|
2021-01-25 02:15:54 +00:00
|
|
|
print("Registering the User information...")
|
2020-11-07 03:57:24 +00:00
|
|
|
try:
|
2020-11-18 18:18:51 +00:00
|
|
|
count = 1
|
2020-11-07 03:57:24 +00:00
|
|
|
for user in users.each():
|
|
|
|
count += 1
|
2021-01-24 17:35:17 +00:00
|
|
|
print("Face registration start...")
|
2021-04-05 21:22:31 +00:00
|
|
|
|
2020-11-14 20:25:24 +00:00
|
|
|
Facial_Recognition_Registration.register_your_face("User_" + str(count))
|
2021-04-05 21:22:31 +00:00
|
|
|
|
2021-02-10 15:51:05 +00:00
|
|
|
Parallel(n_jobs=multiprocessing.cpu_count())(
|
2021-04-05 21:22:31 +00:00
|
|
|
delayed(upload_parallel_user_photos)(i, count) for i in range(10))
|
2021-02-10 15:51:05 +00:00
|
|
|
DBHelper.upload_data("User_" + str(count), firstname, lastname, email, phone)
|
2021-04-05 21:22:31 +00:00
|
|
|
|
2021-01-24 17:35:17 +00:00
|
|
|
print("Data saved! Starting enrollment...")
|
2021-01-24 15:55:36 +00:00
|
|
|
Facial_Recognition_Enrollment.enroll_face_dataset()
|
2021-01-24 17:35:17 +00:00
|
|
|
print("Face registration completed!")
|
2021-01-25 02:15:54 +00:00
|
|
|
print("Success.")
|
2021-04-05 21:22:31 +00:00
|
|
|
|
2020-11-07 03:57:24 +00:00
|
|
|
except:
|
2021-02-02 00:51:23 +00:00
|
|
|
print("Face registration start...")
|
2021-04-05 21:22:31 +00:00
|
|
|
|
2020-11-14 20:25:24 +00:00
|
|
|
Facial_Recognition_Registration.register_your_face("User_1")
|
2021-04-05 21:22:31 +00:00
|
|
|
|
2021-02-10 15:51:05 +00:00
|
|
|
Parallel(n_jobs=multiprocessing.cpu_count())(
|
2021-04-05 21:22:31 +00:00
|
|
|
delayed(upload_parallel_user_photo)(i) for i in range(10))
|
2021-02-10 15:51:05 +00:00
|
|
|
DBHelper.upload_data("User_1", firstname, lastname, email, phone)
|
2021-04-05 21:22:31 +00:00
|
|
|
|
2021-02-02 00:51:23 +00:00
|
|
|
print("Data saved! Starting enrollment...")
|
|
|
|
Facial_Recognition_Enrollment.enroll_face_dataset()
|
|
|
|
print("Face registration completed!")
|
|
|
|
print("Success.")
|
2020-11-18 02:56:47 +00:00
|
|
|
|
|
|
|
|
2021-02-10 15:51:05 +00:00
|
|
|
def upload_parallel_user_photos(i, count):
|
|
|
|
DBHelper.upload_user_photo("User_" + str(count) + "/" + str(i) + ".jpg")
|
|
|
|
|
|
|
|
|
|
|
|
def upload_parallel_user_photo(i):
|
2021-03-21 17:37:41 +00:00
|
|
|
DBHelper.upload_user_photo("User_1/" + str(i) + ".jpg")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
f = input('Enter your First Name:')
|
|
|
|
l = input('Enter your Last Name:')
|
|
|
|
e = input('Enter your E-Mail:')
|
|
|
|
p = input('Enter your Phone:')
|
|
|
|
upload_your_face(f, l, e, p)
|