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

34 lines
1.3 KiB
Python
Raw Normal View History

2021-02-02 00:51:23 +00:00
import DBHelper
2021-02-04 22:41:59 +00:00
import Facial_Recognition_Thief_Registration
2021-02-02 00:51:23 +00:00
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
2021-02-04 22:41:59 +00:00
Facial_Recognition_Thief_Registration.register_your_face("Thief_" + str(count))
2021-02-02 00:51:23 +00:00
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:
2021-02-04 22:41:59 +00:00
Facial_Recognition_Thief_Registration.register_your_face("Thief_1")
2021-02-02 00:51:23 +00:00
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")
2021-02-04 22:41:59 +00:00
DBHelper.upload_thief_data("Thief_1", date, time)
2021-02-02 00:51:23 +00:00
print("An intruder is recorded.")
if __name__ == "__main__":
upload_thief_face()