Updated the Integration. Tested the system, it works.
|
@ -4,33 +4,35 @@ import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import DBHelper
|
import DBHelper
|
||||||
|
|
||||||
try:
|
|
||||||
|
def inference():
|
||||||
|
try:
|
||||||
import cPickle # Python 2
|
import cPickle # Python 2
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import _pickle as cPickle # Python 3
|
import _pickle as cPickle # Python 3
|
||||||
|
|
||||||
pwd = sys.path[0]
|
pwd = sys.path[0]
|
||||||
PREDICTOR_PATH = pwd + '/Facial_models/shape_predictor_68_face_landmarks.dat'
|
PREDICTOR_PATH = pwd + '/Facial_models/shape_predictor_68_face_landmarks.dat'
|
||||||
FACE_RECOGNITION_MODEL_PATH = pwd + '/Facial_models/dlib_face_recognition_resnet_model_v1.dat'
|
FACE_RECOGNITION_MODEL_PATH = pwd + '/Facial_models/dlib_face_recognition_resnet_model_v1.dat'
|
||||||
|
|
||||||
SKIP_FRAMES = 1
|
SKIP_FRAMES = 1
|
||||||
THRESHOLD = 0.4
|
THRESHOLD = 0.4
|
||||||
|
|
||||||
faceDetector = dlib.get_frontal_face_detector()
|
faceDetector = dlib.get_frontal_face_detector()
|
||||||
shapePredictor = dlib.shape_predictor(PREDICTOR_PATH)
|
shapePredictor = dlib.shape_predictor(PREDICTOR_PATH)
|
||||||
faceRecognizer = dlib.face_recognition_model_v1(FACE_RECOGNITION_MODEL_PATH)
|
faceRecognizer = dlib.face_recognition_model_v1(FACE_RECOGNITION_MODEL_PATH)
|
||||||
|
|
||||||
index = np.load(pwd + '/Facial_models/index.pkl', allow_pickle=True)
|
index = np.load(pwd + '/Facial_models/index.pkl', allow_pickle=True)
|
||||||
faceDescriptorsEnrolled = np.load(pwd + '/Facial_models/descriptors.npy')
|
faceDescriptorsEnrolled = np.load(pwd + '/Facial_models/descriptors.npy')
|
||||||
|
|
||||||
cam = cv2.VideoCapture(0)
|
cam = cv2.VideoCapture(0)
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
x1 = x2 = y1 = y2 = 0
|
x1 = x2 = y1 = y2 = 0
|
||||||
|
|
||||||
cond = False
|
cond = False
|
||||||
|
|
||||||
while DBHelper.get_power() == "on":
|
while DBHelper.get_power() == "on":
|
||||||
t = time.time()
|
t = time.time()
|
||||||
success, im = cam.read()
|
success, im = cam.read()
|
||||||
|
|
||||||
|
@ -97,6 +99,10 @@ while DBHelper.get_power() == "on":
|
||||||
DBHelper.set_motor("off")
|
DBHelper.set_motor("off")
|
||||||
DBHelper.set_alarm("on")
|
DBHelper.set_alarm("on")
|
||||||
|
|
||||||
DBHelper.set_alarm("off")
|
DBHelper.set_alarm("off")
|
||||||
DBHelper.set_motor("off")
|
DBHelper.set_motor("off")
|
||||||
cv2.destroyAllWindows()
|
cv2.destroyAllWindows()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
inference()
|
||||||
|
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 78 KiB |
BIN
__pycache__/Facial_Recognition_Enrollment.cpython-36.pyc
Normal file
BIN
__pycache__/Facial_Recognition_Inference.cpython-36.pyc
Normal file
|
@ -32,7 +32,7 @@ def start():
|
||||||
print("Success.")
|
print("Success.")
|
||||||
except:
|
except:
|
||||||
print("No Thieves are registered.")
|
print("No Thieves are registered.")
|
||||||
Facial_Recognition_Inference
|
Facial_Recognition_Inference.inference()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|