Fully integrated DB to Facial Recognition Software.
							
								
								
									
										16
									
								
								DBHelper.py
									
										
									
									
									
								
							
							
						
						| 
						 | 
					@ -99,24 +99,24 @@ def get_address(user_id):
 | 
				
			||||||
    return address
 | 
					    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):
 | 
					def upload_user_photo(user_id):
 | 
				
			||||||
    storage.child("Photos_of_Users/" + user_id).put("Facial_images/face_rec/train/" + 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):
 | 
					def upload_thief_photo(thief_id):
 | 
				
			||||||
    storage.child("Photos_of_Thieves/" + thief_id).put("Facial_images/face_rec/train/" + thief_id)
 | 
					    storage.child("Photos_of_Thieves/" + thief_id).put("Facial_images/face_rec/train/" + thief_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Downloads the specified user photo.
 | 
					# Downloads the specified user's photos, input should be something like "example.jpg"
 | 
				
			||||||
def download_user_photo(user_photo):
 | 
					def download_user_photo(user_id):
 | 
				
			||||||
    storage.child("Photos_of_Users/" + str(user_photo)).download("Users_from_Database/" + str(user_photo))
 | 
					    storage.child("Photos_of_Users/" + user_id).download("Facial_images/face_rec/train/" + user_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Downloads the specified thief photo.
 | 
					# Downloads the specified thief's photos, input should be something like "example.jpg"
 | 
				
			||||||
def download_thief_photo(user_photo):
 | 
					def download_thief_photo(thief_id):
 | 
				
			||||||
    storage.child("Photos_of_Thieves/" + str(user_photo)).download("Thieves_from_Database/" + str(user_photo))
 | 
					    storage.child("Photos_of_Thieves/" + thief_id).download("Photos_of_Thieves/" + thief_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Deletes photo of the specified user.
 | 
					# 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):
 | 
					def upload_your_face(firstname, lastname, email, phone, address):
 | 
				
			||||||
    # Determines user ID before adding the data to the database.
 | 
					    # Determines user ID before adding the data to the database.
 | 
				
			||||||
    # User ID is determined from number of user dataset in 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
 | 
					    count = 0
 | 
				
			||||||
    users = DBHelper.db.child("Users").get()
 | 
					    users = DBHelper.db.child("Users").get()
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        for user in users.each():
 | 
					        for user in users.each():
 | 
				
			||||||
            count += 1
 | 
					            count += 1
 | 
				
			||||||
        DBHelper.upload_data("user_" + str(count), firstname, lastname, email, phone, address)
 | 
					        DBHelper.upload_data("User_" + str(count), firstname, lastname, email, phone, address)
 | 
				
			||||||
        Facial_Recognition_Registration.register_your_face("user_" + str(count))
 | 
					        Facial_Recognition_Registration.register_your_face("User_" + str(count))
 | 
				
			||||||
        for x in range(20):
 | 
					        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:
 | 
					    except:
 | 
				
			||||||
        DBHelper.upload_data("user_1", firstname, lastname, email, phone, address)
 | 
					        DBHelper.upload_data("User_1", firstname, lastname, email, phone, address)
 | 
				
			||||||
        Facial_Recognition_Registration.register_your_face("user_1")
 | 
					        Facial_Recognition_Registration.register_your_face("User_1")
 | 
				
			||||||
        for x in range(20):
 | 
					        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 DBHelper
 | 
				
			||||||
import Facial_Recognition_Software
 | 
					import Facial_Recognition_Wrapper
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def start():
 | 
					def start():
 | 
				
			||||||
| 
						 | 
					@ -9,28 +10,22 @@ def start():
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        for user in users.each():
 | 
					        for user in users.each():
 | 
				
			||||||
            count = +1
 | 
					            count = +1
 | 
				
			||||||
            DBHelper.download_user_photo("user" + str(count) + "_" + str(1) + ".jpg")
 | 
					            for x in range(20):
 | 
				
			||||||
            DBHelper.download_user_photo("user" + str(count) + "_" + str(2) + ".jpg")
 | 
					                if not os.path.isdir("Facial_images/face_rec/train/User_" + str(count)):
 | 
				
			||||||
            DBHelper.download_user_photo("user" + str(count) + "_" + str(3) + ".jpg")
 | 
					                    os.makedirs("Photos_of_Users/User_" + str(count))
 | 
				
			||||||
            DBHelper.download_user_photo("user" + str(count) + "_" + str(4) + ".jpg")
 | 
					                DBHelper.download_user_photo("User_" + str(count) + "/" + str(x) + ".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")
 | 
					 | 
				
			||||||
    except:
 | 
					    except:
 | 
				
			||||||
        print("No Users are registered.")
 | 
					        print("No Users are registered.")
 | 
				
			||||||
    count = 0
 | 
					    count = 0
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        for user in users.each():
 | 
					        for user in users.each():
 | 
				
			||||||
            count = +1
 | 
					            count = +1
 | 
				
			||||||
            DBHelper.download_thief_photo("user" + str(count) + "_" + str(1) + ".jpg")
 | 
					            for x in range(20):
 | 
				
			||||||
            DBHelper.download_thief_photo("user" + str(count) + "_" + str(2) + ".jpg")
 | 
					                if not os.path.isdir("Photos_of_Thieves/Thief_" + str(count)):
 | 
				
			||||||
            DBHelper.download_thief_photo("user" + str(count) + "_" + str(3) + ".jpg")
 | 
					                    os.makedirs("Photos_of_Thieves/Thief_" + str(count))
 | 
				
			||||||
            DBHelper.download_thief_photo("user" + str(count) + "_" + str(4) + ".jpg")
 | 
					                DBHelper.download_thief_photo("Thief_" + str(count) + "/" + str(x) + ".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")
 | 
					 | 
				
			||||||
    except:
 | 
					    except:
 | 
				
			||||||
        return 0
 | 
					        print("No Thieves for now.")
 | 
				
			||||||
 | 
					    Facial_Recognition_Wrapper.training_recognizer("Fisher")
 | 
				
			||||||
 | 
					    Facial_Recognition_Wrapper.face_recognition_inference("Fisher")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
start()
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||