Vehicle-Anti-Theft-Face-Rec.../Upload_Thief.py

38 lines
1.5 KiB
Python
Raw Normal View History

2021-02-02 00:51:23 +00:00
import DBHelper
import Facial_Recognition_Registration
import Facial_Recognition_Enrollment
from datetime import datetime
def upload_thief_face():
# Determines thief ID before adding the data to the database.
# Thief 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 thief ID.
thieves = DBHelper.db.child("Thieves").get()
try:
count = 1
for thief in thieves.each():
count += 1
Facial_Recognition_Registration.register_your_face("Thief_" + str(count))
Facial_Recognition_Enrollment.enroll_face_dataset()
for i in range(50):
DBHelper.upload_thief_photo("Thief_" + str(count) + "/" + str(i) + ".jpg")
date = datetime.now().strftime("%d/%m/%Y")
time = datetime.now().strftime("%H:%M:%S")
DBHelper.upload_thief_data("Thief_" + str(count), date, time)
print("An intruder is recorded.")
except:
DBHelper.upload_thief_data("Thief_1", date, time)
Facial_Recognition_Registration.register_your_face("Thief_1")
Facial_Recognition_Enrollment.enroll_face_dataset()
for i in range(50):
DBHelper.upload_thief_photo("Thief_1/" + str(i) + ".jpg")
date = datetime.now().strftime("%d/%m/%Y")
time = datetime.now().strftime("%H:%M:%S")
DBHelper.upload_thief_data("Thief_" + str(count), date, time)
print("An intruder is recorded.")
if __name__ == "__main__":
upload_thief_face()