diff --git a/Facial_images/face_rec/train/User_3/0.jpg b/Facial_images/face_rec/train/User_3/0.jpg deleted file mode 100644 index e6e4f2d5c..000000000 Binary files a/Facial_images/face_rec/train/User_3/0.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/1.jpg b/Facial_images/face_rec/train/User_3/1.jpg deleted file mode 100644 index 20fe7df79..000000000 Binary files a/Facial_images/face_rec/train/User_3/1.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/10.jpg b/Facial_images/face_rec/train/User_3/10.jpg deleted file mode 100644 index 08b4d9253..000000000 Binary files a/Facial_images/face_rec/train/User_3/10.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/11.jpg b/Facial_images/face_rec/train/User_3/11.jpg deleted file mode 100644 index 09efe626f..000000000 Binary files a/Facial_images/face_rec/train/User_3/11.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/12.jpg b/Facial_images/face_rec/train/User_3/12.jpg deleted file mode 100644 index fa2d88f37..000000000 Binary files a/Facial_images/face_rec/train/User_3/12.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/13.jpg b/Facial_images/face_rec/train/User_3/13.jpg deleted file mode 100644 index 2e4e089c4..000000000 Binary files a/Facial_images/face_rec/train/User_3/13.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/14.jpg b/Facial_images/face_rec/train/User_3/14.jpg deleted file mode 100644 index 604746120..000000000 Binary files a/Facial_images/face_rec/train/User_3/14.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/15.jpg b/Facial_images/face_rec/train/User_3/15.jpg deleted file mode 100644 index 6eb431cb3..000000000 Binary files a/Facial_images/face_rec/train/User_3/15.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/16.jpg b/Facial_images/face_rec/train/User_3/16.jpg deleted file mode 100644 index 17f9b2478..000000000 Binary files a/Facial_images/face_rec/train/User_3/16.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/17.jpg b/Facial_images/face_rec/train/User_3/17.jpg deleted file mode 100644 index 779e38777..000000000 Binary files a/Facial_images/face_rec/train/User_3/17.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/18.jpg b/Facial_images/face_rec/train/User_3/18.jpg deleted file mode 100644 index e2661ac7a..000000000 Binary files a/Facial_images/face_rec/train/User_3/18.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/19.jpg b/Facial_images/face_rec/train/User_3/19.jpg deleted file mode 100644 index 764e1a73f..000000000 Binary files a/Facial_images/face_rec/train/User_3/19.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/2.jpg b/Facial_images/face_rec/train/User_3/2.jpg deleted file mode 100644 index 614eb42fb..000000000 Binary files a/Facial_images/face_rec/train/User_3/2.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/20.jpg b/Facial_images/face_rec/train/User_3/20.jpg deleted file mode 100644 index c0e2527ed..000000000 Binary files a/Facial_images/face_rec/train/User_3/20.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/21.jpg b/Facial_images/face_rec/train/User_3/21.jpg deleted file mode 100644 index 735268432..000000000 Binary files a/Facial_images/face_rec/train/User_3/21.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/22.jpg b/Facial_images/face_rec/train/User_3/22.jpg deleted file mode 100644 index 373721099..000000000 Binary files a/Facial_images/face_rec/train/User_3/22.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/23.jpg b/Facial_images/face_rec/train/User_3/23.jpg deleted file mode 100644 index e4f83a1d4..000000000 Binary files a/Facial_images/face_rec/train/User_3/23.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/24.jpg b/Facial_images/face_rec/train/User_3/24.jpg deleted file mode 100644 index ca89ec26b..000000000 Binary files a/Facial_images/face_rec/train/User_3/24.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/25.jpg b/Facial_images/face_rec/train/User_3/25.jpg deleted file mode 100644 index 3a0fa8685..000000000 Binary files a/Facial_images/face_rec/train/User_3/25.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/26.jpg b/Facial_images/face_rec/train/User_3/26.jpg deleted file mode 100644 index 5ac333615..000000000 Binary files a/Facial_images/face_rec/train/User_3/26.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/27.jpg b/Facial_images/face_rec/train/User_3/27.jpg deleted file mode 100644 index af05facbc..000000000 Binary files a/Facial_images/face_rec/train/User_3/27.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/28.jpg b/Facial_images/face_rec/train/User_3/28.jpg deleted file mode 100644 index 2ddba95a0..000000000 Binary files a/Facial_images/face_rec/train/User_3/28.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/29.jpg b/Facial_images/face_rec/train/User_3/29.jpg deleted file mode 100644 index 2fa959dc6..000000000 Binary files a/Facial_images/face_rec/train/User_3/29.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/3.jpg b/Facial_images/face_rec/train/User_3/3.jpg deleted file mode 100644 index bc9f89e62..000000000 Binary files a/Facial_images/face_rec/train/User_3/3.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/30.jpg b/Facial_images/face_rec/train/User_3/30.jpg deleted file mode 100644 index 8d7ef4187..000000000 Binary files a/Facial_images/face_rec/train/User_3/30.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/31.jpg b/Facial_images/face_rec/train/User_3/31.jpg deleted file mode 100644 index 6b7614702..000000000 Binary files a/Facial_images/face_rec/train/User_3/31.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/32.jpg b/Facial_images/face_rec/train/User_3/32.jpg deleted file mode 100644 index b90bcf4eb..000000000 Binary files a/Facial_images/face_rec/train/User_3/32.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/33.jpg b/Facial_images/face_rec/train/User_3/33.jpg deleted file mode 100644 index b4c19bcb7..000000000 Binary files a/Facial_images/face_rec/train/User_3/33.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/34.jpg b/Facial_images/face_rec/train/User_3/34.jpg deleted file mode 100644 index 769336664..000000000 Binary files a/Facial_images/face_rec/train/User_3/34.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/35.jpg b/Facial_images/face_rec/train/User_3/35.jpg deleted file mode 100644 index c3060beb8..000000000 Binary files a/Facial_images/face_rec/train/User_3/35.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/36.jpg b/Facial_images/face_rec/train/User_3/36.jpg deleted file mode 100644 index 80bf61839..000000000 Binary files a/Facial_images/face_rec/train/User_3/36.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/37.jpg b/Facial_images/face_rec/train/User_3/37.jpg deleted file mode 100644 index d64c6fbd6..000000000 Binary files a/Facial_images/face_rec/train/User_3/37.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/38.jpg b/Facial_images/face_rec/train/User_3/38.jpg deleted file mode 100644 index 82e80e603..000000000 Binary files a/Facial_images/face_rec/train/User_3/38.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/39.jpg b/Facial_images/face_rec/train/User_3/39.jpg deleted file mode 100644 index f355d20ee..000000000 Binary files a/Facial_images/face_rec/train/User_3/39.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/4.jpg b/Facial_images/face_rec/train/User_3/4.jpg deleted file mode 100644 index efc187264..000000000 Binary files a/Facial_images/face_rec/train/User_3/4.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/40.jpg b/Facial_images/face_rec/train/User_3/40.jpg deleted file mode 100644 index dea885504..000000000 Binary files a/Facial_images/face_rec/train/User_3/40.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/41.jpg b/Facial_images/face_rec/train/User_3/41.jpg deleted file mode 100644 index 703ae50b4..000000000 Binary files a/Facial_images/face_rec/train/User_3/41.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/42.jpg b/Facial_images/face_rec/train/User_3/42.jpg deleted file mode 100644 index a602c4470..000000000 Binary files a/Facial_images/face_rec/train/User_3/42.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/43.jpg b/Facial_images/face_rec/train/User_3/43.jpg deleted file mode 100644 index 740ddea73..000000000 Binary files a/Facial_images/face_rec/train/User_3/43.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/44.jpg b/Facial_images/face_rec/train/User_3/44.jpg deleted file mode 100644 index a0e96d666..000000000 Binary files a/Facial_images/face_rec/train/User_3/44.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/45.jpg b/Facial_images/face_rec/train/User_3/45.jpg deleted file mode 100644 index cc393682c..000000000 Binary files a/Facial_images/face_rec/train/User_3/45.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/46.jpg b/Facial_images/face_rec/train/User_3/46.jpg deleted file mode 100644 index e033c838a..000000000 Binary files a/Facial_images/face_rec/train/User_3/46.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/47.jpg b/Facial_images/face_rec/train/User_3/47.jpg deleted file mode 100644 index 01d36c000..000000000 Binary files a/Facial_images/face_rec/train/User_3/47.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/48.jpg b/Facial_images/face_rec/train/User_3/48.jpg deleted file mode 100644 index 46c37dcc2..000000000 Binary files a/Facial_images/face_rec/train/User_3/48.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/49.jpg b/Facial_images/face_rec/train/User_3/49.jpg deleted file mode 100644 index 35f90b254..000000000 Binary files a/Facial_images/face_rec/train/User_3/49.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/5.jpg b/Facial_images/face_rec/train/User_3/5.jpg deleted file mode 100644 index 5652f3931..000000000 Binary files a/Facial_images/face_rec/train/User_3/5.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/6.jpg b/Facial_images/face_rec/train/User_3/6.jpg deleted file mode 100644 index 521a8dea8..000000000 Binary files a/Facial_images/face_rec/train/User_3/6.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/7.jpg b/Facial_images/face_rec/train/User_3/7.jpg deleted file mode 100644 index 6ae948d7c..000000000 Binary files a/Facial_images/face_rec/train/User_3/7.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/8.jpg b/Facial_images/face_rec/train/User_3/8.jpg deleted file mode 100644 index 8e4fd5cd4..000000000 Binary files a/Facial_images/face_rec/train/User_3/8.jpg and /dev/null differ diff --git a/Facial_images/face_rec/train/User_3/9.jpg b/Facial_images/face_rec/train/User_3/9.jpg deleted file mode 100644 index 9be261fd5..000000000 Binary files a/Facial_images/face_rec/train/User_3/9.jpg and /dev/null differ diff --git a/Remove_Face.py b/Remove_Face.py index 1dfc64066..1ba453038 100644 --- a/Remove_Face.py +++ b/Remove_Face.py @@ -1,5 +1,8 @@ import DBHelper import shutil +from joblib import Parallel, delayed +import multiprocessing +import os def remove_your_face(firstname, lastname, email, phone): @@ -9,25 +12,25 @@ def remove_your_face(firstname, lastname, email, phone): count2 = 0 for user in users.each(): count += 1 - print("Removing the specified User...") + print("The specified user will be removed...") for user in users.each(): count2 += 1 if DBHelper.get_firstname("User_" + str(count2)) == firstname and DBHelper.get_lastname( "User_" + str(count2)) == lastname and DBHelper.get_email( "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)) - for i in range(50): - DBHelper.delete_user_photo("User_" + str(count2) + "/" + str(i) + ".jpg") + shutil.rmtree("Facial_images/face_rec/train/User_" + str(count2)) print("Successfully removed the User.") break - print("Reorganizing the Users... (This may take long time.)") + print("Reorganizing the Users...") if count2 != count and count - count2 - 1 != 0: for x in range(count - count2): - for i in range(50): - 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") + if not os.path.isdir("Facial_images/face_rec/train/User_" + str(count2)): + os.makedirs("Facial_images/face_rec/train/User_" + str(count2)) + Parallel(n_jobs=multiprocessing.cpu_count())( + delayed(update_parallel_user_photos)(i, count2) for i in range(50)) DBHelper.upload_data("User_" + str(count2), DBHelper.get_firstname("User_" + str(count2 + 1)), DBHelper.get_lastname("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)) shutil.rmtree("Facial_images/face_rec/train/User_" + str(count)) elif count2 != count and count - count2 - 1 == 0: - for i in range(50): - 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") + if not os.path.isdir("Facial_images/face_rec/train/User_" + str(count2)): + os.makedirs("Facial_images/face_rec/train/User_" + str(count2)) + Parallel(n_jobs=multiprocessing.cpu_count())( + delayed(update_parallel_user_photos)(i, count2) for i in range(50)) DBHelper.upload_data("User_" + str(count2), DBHelper.get_firstname("User_" + str(count2 + 1)), DBHelper.get_lastname("User_" + str(count2 + 1)), DBHelper.get_email("User_" + str(count2 + 1)), @@ -59,3 +61,13 @@ if __name__ == "__main__": p = input('Enter your Phone:') 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") \ No newline at end of file diff --git a/__pycache__/DBHelper.cpython-36.pyc b/__pycache__/DBHelper.cpython-36.pyc index ab62e13f0..00b1940e5 100644 Binary files a/__pycache__/DBHelper.cpython-36.pyc and b/__pycache__/DBHelper.cpython-36.pyc differ diff --git a/__pycache__/Remove_Face.cpython-36.pyc b/__pycache__/Remove_Face.cpython-36.pyc index b9ed041c9..e6ff6b810 100644 Binary files a/__pycache__/Remove_Face.cpython-36.pyc and b/__pycache__/Remove_Face.cpython-36.pyc differ diff --git a/__pycache__/Upload_Face.cpython-36.pyc b/__pycache__/Upload_Face.cpython-36.pyc index ec887acb2..9e4d4c7b5 100644 Binary files a/__pycache__/Upload_Face.cpython-36.pyc and b/__pycache__/Upload_Face.cpython-36.pyc differ