Fully integrated DB to Facial Recognition Software.
							
								
								
									
										16
									
								
								DBHelper.py
									
										
									
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -99,24 +99,24 @@ def get_address(user_id):
 | 
			
		|||
    return address
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Uploads the photo of user, input should be something like "example.png"
 | 
			
		||||
# Uploads the photos of user, input should be something like "example.jpg"
 | 
			
		||||
def upload_user_photo(user_id):
 | 
			
		||||
    storage.child("Photos_of_Users/" + user_id).put("Facial_images/face_rec/train/" + user_id)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Uploads the photo of thief, input should be something like "example.png"
 | 
			
		||||
# Uploads the photos of thief, input should be something like "example.jpg"
 | 
			
		||||
def upload_thief_photo(thief_id):
 | 
			
		||||
    storage.child("Photos_of_Thieves/" + thief_id).put("Facial_images/face_rec/train/" + thief_id)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Downloads the specified user photo.
 | 
			
		||||
def download_user_photo(user_photo):
 | 
			
		||||
    storage.child("Photos_of_Users/" + str(user_photo)).download("Users_from_Database/" + str(user_photo))
 | 
			
		||||
# Downloads the specified user's photos, input should be something like "example.jpg"
 | 
			
		||||
def download_user_photo(user_id):
 | 
			
		||||
    storage.child("Photos_of_Users/" + user_id).download("Facial_images/face_rec/train/" + user_id)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Downloads the specified thief photo.
 | 
			
		||||
def download_thief_photo(user_photo):
 | 
			
		||||
    storage.child("Photos_of_Thieves/" + str(user_photo)).download("Thieves_from_Database/" + str(user_photo))
 | 
			
		||||
# Downloads the specified thief's photos, input should be something like "example.jpg"
 | 
			
		||||
def download_thief_photo(thief_id):
 | 
			
		||||
    storage.child("Photos_of_Thieves/" + thief_id).download("Photos_of_Thieves/" + thief_id)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Deletes photo of the specified user.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/0.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 80 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/1.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 80 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/10.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/11.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/12.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/13.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/14.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/15.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/16.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 79 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/17.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 79 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/18.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 79 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/19.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 79 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/2.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 77 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/3.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/4.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/5.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 79 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/6.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/7.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/8.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/Feier_Zhang/9.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 78 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/0.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 56 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/1.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/10.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/11.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/12.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/13.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/14.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/15.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/16.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/17.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/18.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/19.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/2.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/3.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/4.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/5.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/6.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/7.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/8.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Facial_images/face_rec/train/User_1/9.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 49 KiB  | 
| 
		 Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB  | 
| 
		 Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
		 Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB  | 
| 
						 | 
				
			
			@ -5,17 +5,18 @@ import Facial_Recognition_Registration
 | 
			
		|||
def upload_your_face(firstname, lastname, email, phone, address):
 | 
			
		||||
    # Determines user ID before adding the data to the database.
 | 
			
		||||
    # User ID is determined from number of user dataset in database
 | 
			
		||||
    # Later on it starts face recognition system and uploads it into the database based on the given user ID.
 | 
			
		||||
    count = 0
 | 
			
		||||
    users = DBHelper.db.child("Users").get()
 | 
			
		||||
    try:
 | 
			
		||||
        for user in users.each():
 | 
			
		||||
            count += 1
 | 
			
		||||
        DBHelper.upload_data("user_" + str(count), firstname, lastname, email, phone, address)
 | 
			
		||||
        Facial_Recognition_Registration.register_your_face("user_" + str(count))
 | 
			
		||||
        DBHelper.upload_data("User_" + str(count), firstname, lastname, email, phone, address)
 | 
			
		||||
        Facial_Recognition_Registration.register_your_face("User_" + str(count))
 | 
			
		||||
        for x in range(20):
 | 
			
		||||
            DBHelper.upload_user_photo("user_" + str(count) + "/" + str(x) + ".jpg")
 | 
			
		||||
            DBHelper.upload_user_photo("User_" + str(count) + "/" + str(x) + ".jpg")
 | 
			
		||||
    except:
 | 
			
		||||
        DBHelper.upload_data("user_1", firstname, lastname, email, phone, address)
 | 
			
		||||
        Facial_Recognition_Registration.register_your_face("user_1")
 | 
			
		||||
        DBHelper.upload_data("User_1", firstname, lastname, email, phone, address)
 | 
			
		||||
        Facial_Recognition_Registration.register_your_face("User_1")
 | 
			
		||||
        for x in range(20):
 | 
			
		||||
            DBHelper.upload_user_photo("user_1/" + str(x) + ".jpg")
 | 
			
		||||
            DBHelper.upload_user_photo("User_1/" + str(x) + ".jpg")
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								__pycache__/Facial_Recognition_Wrapper.cpython-36.pyc
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
import os
 | 
			
		||||
import DBHelper
 | 
			
		||||
import Facial_Recognition_Software
 | 
			
		||||
import Facial_Recognition_Wrapper
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def start():
 | 
			
		||||
| 
						 | 
				
			
			@ -9,28 +10,22 @@ def start():
 | 
			
		|||
    try:
 | 
			
		||||
        for user in users.each():
 | 
			
		||||
            count = +1
 | 
			
		||||
            DBHelper.download_user_photo("user" + str(count) + "_" + str(1) + ".jpg")
 | 
			
		||||
            DBHelper.download_user_photo("user" + str(count) + "_" + str(2) + ".jpg")
 | 
			
		||||
            DBHelper.download_user_photo("user" + str(count) + "_" + str(3) + ".jpg")
 | 
			
		||||
            DBHelper.download_user_photo("user" + str(count) + "_" + str(4) + ".jpg")
 | 
			
		||||
            DBHelper.download_user_photo("user" + str(count) + "_" + str(5) + ".jpg")
 | 
			
		||||
            DBHelper.download_user_photo("user" + str(count) + "_" + str(6) + ".jpg")
 | 
			
		||||
            DBHelper.download_user_photo("user" + str(count) + "_" + str(7) + ".jpg")
 | 
			
		||||
            for x in range(20):
 | 
			
		||||
                if not os.path.isdir("Facial_images/face_rec/train/User_" + str(count)):
 | 
			
		||||
                    os.makedirs("Photos_of_Users/User_" + str(count))
 | 
			
		||||
                DBHelper.download_user_photo("User_" + str(count) + "/" + str(x) + ".jpg")
 | 
			
		||||
    except:
 | 
			
		||||
        print("No Users are registered.")
 | 
			
		||||
    count = 0
 | 
			
		||||
    try:
 | 
			
		||||
        for user in users.each():
 | 
			
		||||
            count = +1
 | 
			
		||||
            DBHelper.download_thief_photo("user" + str(count) + "_" + str(1) + ".jpg")
 | 
			
		||||
            DBHelper.download_thief_photo("user" + str(count) + "_" + str(2) + ".jpg")
 | 
			
		||||
            DBHelper.download_thief_photo("user" + str(count) + "_" + str(3) + ".jpg")
 | 
			
		||||
            DBHelper.download_thief_photo("user" + str(count) + "_" + str(4) + ".jpg")
 | 
			
		||||
            DBHelper.download_thief_photo("user" + str(count) + "_" + str(5) + ".jpg")
 | 
			
		||||
            DBHelper.download_thief_photo("user" + str(count) + "_" + str(6) + ".jpg")
 | 
			
		||||
            DBHelper.download_thief_photo("user" + str(count) + "_" + str(7) + ".jpg")
 | 
			
		||||
            for x in range(20):
 | 
			
		||||
                if not os.path.isdir("Photos_of_Thieves/Thief_" + str(count)):
 | 
			
		||||
                    os.makedirs("Photos_of_Thieves/Thief_" + str(count))
 | 
			
		||||
                DBHelper.download_thief_photo("Thief_" + str(count) + "/" + str(x) + ".jpg")
 | 
			
		||||
    except:
 | 
			
		||||
        return 0
 | 
			
		||||
        print("No Thieves for now.")
 | 
			
		||||
    Facial_Recognition_Wrapper.training_recognizer("Fisher")
 | 
			
		||||
    Facial_Recognition_Wrapper.face_recognition_inference("Fisher")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
start()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||