Made the execution of Remove_Face faster.
| 
		 Before Width: | Height: | Size: 72 KiB  | 
| 
		 Before Width: | Height: | Size: 68 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 54 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 54 KiB  | 
| 
		 Before Width: | Height: | Size: 56 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 52 KiB  | 
| 
		 Before Width: | Height: | Size: 74 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 76 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 76 KiB  | 
| 
		 Before Width: | Height: | Size: 56 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 78 KiB  | 
| 
		 Before Width: | Height: | Size: 78 KiB  | 
| 
		 Before Width: | Height: | Size: 76 KiB  | 
| 
		 Before Width: | Height: | Size: 76 KiB  | 
| 
		 Before Width: | Height: | Size: 76 KiB  | 
| 
		 Before Width: | Height: | Size: 78 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 78 KiB  | 
| 
		 Before Width: | Height: | Size: 56 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB  | 
| 
		 Before Width: | Height: | Size: 79 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 56 KiB  | 
| 
		 Before Width: | Height: | Size: 56 KiB  | 
| 
		 Before Width: | Height: | Size: 55 KiB  | 
| 
		 Before Width: | Height: | Size: 56 KiB  | 
| 
						 | 
					@ -1,5 +1,8 @@
 | 
				
			||||||
import DBHelper
 | 
					import DBHelper
 | 
				
			||||||
import shutil
 | 
					import shutil
 | 
				
			||||||
 | 
					from joblib import Parallel, delayed
 | 
				
			||||||
 | 
					import multiprocessing
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def remove_your_face(firstname, lastname, email, phone):
 | 
					def remove_your_face(firstname, lastname, email, phone):
 | 
				
			||||||
| 
						 | 
					@ -9,25 +12,25 @@ def remove_your_face(firstname, lastname, email, phone):
 | 
				
			||||||
        count2 = 0
 | 
					        count2 = 0
 | 
				
			||||||
        for user in users.each():
 | 
					        for user in users.each():
 | 
				
			||||||
            count += 1
 | 
					            count += 1
 | 
				
			||||||
        print("Removing the specified User...")
 | 
					        print("The specified user will be removed...")
 | 
				
			||||||
        for user in users.each():
 | 
					        for user in users.each():
 | 
				
			||||||
            count2 += 1
 | 
					            count2 += 1
 | 
				
			||||||
            if DBHelper.get_firstname("User_" + str(count2)) == firstname and DBHelper.get_lastname(
 | 
					            if DBHelper.get_firstname("User_" + str(count2)) == firstname and DBHelper.get_lastname(
 | 
				
			||||||
                    "User_" + str(count2)) == lastname and DBHelper.get_email(
 | 
					                    "User_" + str(count2)) == lastname and DBHelper.get_email(
 | 
				
			||||||
                "User_" + str(count2)) == email and DBHelper.get_phone("User_" + str(count2)) == phone:
 | 
					                "User_" + str(count2)) == email and DBHelper.get_phone("User_" + str(count2)) == phone:
 | 
				
			||||||
 | 
					                Parallel(n_jobs=multiprocessing.cpu_count())(
 | 
				
			||||||
 | 
					                    delayed(remove_parallel_user_photos)(i, count2) for i in range(50))
 | 
				
			||||||
                DBHelper.remove_data("User_" + str(count2))
 | 
					                DBHelper.remove_data("User_" + str(count2))
 | 
				
			||||||
                for i in range(50):
 | 
					                shutil.rmtree("Facial_images/face_rec/train/User_" + str(count2))
 | 
				
			||||||
                    DBHelper.delete_user_photo("User_" + str(count2) + "/" + str(i) + ".jpg")
 | 
					 | 
				
			||||||
                print("Successfully removed the User.")
 | 
					                print("Successfully removed the User.")
 | 
				
			||||||
                break
 | 
					                break
 | 
				
			||||||
        print("Reorganizing the Users... (This may take long time.)")
 | 
					        print("Reorganizing the Users...")
 | 
				
			||||||
        if count2 != count and count - count2 - 1 != 0:
 | 
					        if count2 != count and count - count2 - 1 != 0:
 | 
				
			||||||
            for x in range(count - count2):
 | 
					            for x in range(count - count2):
 | 
				
			||||||
                for i in range(50):
 | 
					                if not os.path.isdir("Facial_images/face_rec/train/User_" + str(count2)):
 | 
				
			||||||
                    DBHelper.download_user_photo_other("User_" + str(count2 + 1) + "/" + str(i) + ".jpg",
 | 
					                    os.makedirs("Facial_images/face_rec/train/User_" + str(count2))
 | 
				
			||||||
                                                       "User_" + str(count2) + "/" + str(i) + ".jpg")
 | 
					                Parallel(n_jobs=multiprocessing.cpu_count())(
 | 
				
			||||||
                    DBHelper.upload_user_photo("User_" + str(count2) + "/" + str(i) + ".jpg")
 | 
					                    delayed(update_parallel_user_photos)(i, count2) for i in range(50))
 | 
				
			||||||
                    DBHelper.delete_user_photo("User_" + str(count2 + 1) + "/" + str(i) + ".jpg")
 | 
					 | 
				
			||||||
                DBHelper.upload_data("User_" + str(count2), DBHelper.get_firstname("User_" + str(count2 + 1)),
 | 
					                DBHelper.upload_data("User_" + str(count2), DBHelper.get_firstname("User_" + str(count2 + 1)),
 | 
				
			||||||
                                     DBHelper.get_lastname("User_" + str(count2 + 1)),
 | 
					                                     DBHelper.get_lastname("User_" + str(count2 + 1)),
 | 
				
			||||||
                                     DBHelper.get_email("User_" + str(count2 + 1)),
 | 
					                                     DBHelper.get_email("User_" + str(count2 + 1)),
 | 
				
			||||||
| 
						 | 
					@ -36,11 +39,10 @@ def remove_your_face(firstname, lastname, email, phone):
 | 
				
			||||||
            DBHelper.remove_data("User_" + str(count))
 | 
					            DBHelper.remove_data("User_" + str(count))
 | 
				
			||||||
            shutil.rmtree("Facial_images/face_rec/train/User_" + str(count))
 | 
					            shutil.rmtree("Facial_images/face_rec/train/User_" + str(count))
 | 
				
			||||||
        elif count2 != count and count - count2 - 1 == 0:
 | 
					        elif count2 != count and count - count2 - 1 == 0:
 | 
				
			||||||
            for i in range(50):
 | 
					            if not os.path.isdir("Facial_images/face_rec/train/User_" + str(count2)):
 | 
				
			||||||
                DBHelper.download_user_photo_other("User_" + str(count2 + 1) + "/" + str(i) + ".jpg",
 | 
					                os.makedirs("Facial_images/face_rec/train/User_" + str(count2))
 | 
				
			||||||
                                                   "User_" + str(count2) + "/" + str(i) + ".jpg")
 | 
					            Parallel(n_jobs=multiprocessing.cpu_count())(
 | 
				
			||||||
                DBHelper.upload_user_photo("User_" + str(count2) + "/" + str(i) + ".jpg")
 | 
					                delayed(update_parallel_user_photos)(i, count2) for i in range(50))
 | 
				
			||||||
                DBHelper.delete_user_photo("User_" + str(count2 + 1) + "/" + str(i) + ".jpg")
 | 
					 | 
				
			||||||
            DBHelper.upload_data("User_" + str(count2), DBHelper.get_firstname("User_" + str(count2 + 1)),
 | 
					            DBHelper.upload_data("User_" + str(count2), DBHelper.get_firstname("User_" + str(count2 + 1)),
 | 
				
			||||||
                                 DBHelper.get_lastname("User_" + str(count2 + 1)),
 | 
					                                 DBHelper.get_lastname("User_" + str(count2 + 1)),
 | 
				
			||||||
                                 DBHelper.get_email("User_" + str(count2 + 1)),
 | 
					                                 DBHelper.get_email("User_" + str(count2 + 1)),
 | 
				
			||||||
| 
						 | 
					@ -59,3 +61,13 @@ if __name__ == "__main__":
 | 
				
			||||||
    p = input('Enter your Phone:')
 | 
					    p = input('Enter your Phone:')
 | 
				
			||||||
    remove_your_face(f, l, e, p)
 | 
					    remove_your_face(f, l, e, p)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def remove_parallel_user_photos(i, count2):
 | 
				
			||||||
 | 
					    DBHelper.delete_user_photo("User_" + str(count2) + "/" + str(i) + ".jpg")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def update_parallel_user_photos(i, count2):
 | 
				
			||||||
 | 
					    DBHelper.download_user_photo_other("User_" + str(count2 + 1) + "/" + str(i) + ".jpg",
 | 
				
			||||||
 | 
					                                       "User_" + str(count2) + "/" + str(i) + ".jpg")
 | 
				
			||||||
 | 
					    DBHelper.upload_user_photo("User_" + str(count2) + "/" + str(i) + ".jpg")
 | 
				
			||||||
 | 
					    DBHelper.delete_user_photo("User_" + str(count2 + 1) + "/" + str(i) + ".jpg")
 | 
				
			||||||