11
11
import face_recognition
12
12
import requests
13
13
import json
14
+ from os .path import dirname , join
14
15
15
16
yid_counter = 0
16
17
kal_counter = 0
@@ -60,7 +61,6 @@ def detect_and_predict_mask(frame, faceNet, maskNet):
60
61
# pass the blob through the network and obtain the face detections
61
62
faceNet .setInput (blob )
62
63
detections = faceNet .forward ()
63
- print (detections .shape )
64
64
65
65
# initialize our list of faces, their corresponding locations,
66
66
# and the list of predictions from our face mask network
@@ -128,7 +128,7 @@ def detect_and_predict_mask(frame, faceNet, maskNet):
128
128
# email sending URL
129
129
URL = "https://facemask-alert.herokuapp.com/send?name=" + person_to_be_sent
130
130
# URL = 'http://localhost:9000/send?name=' + person_to_be_sent
131
-
131
+ print ( 'Yeah' )
132
132
# send request to email sending api
133
133
r = requests .post (url = URL )
134
134
print ('The result is: ' , r .json ())
@@ -147,12 +147,19 @@ def detect_and_predict_mask(frame, faceNet, maskNet):
147
147
148
148
149
149
# load our serialized face detector model from disk
150
- prototxtPath = r"face_detector/deploy.prototxt"
151
- weightsPath = r"face_detector/res10_300x300_ssd_iter_140000.caffemodel"
150
+ prototxtPath = join (dirname (__file__ ), 'face_detector' , "deploy.prototxt" )
151
+ # weightsPath = join(dirname(__file__), 'face_detector',
152
+ # "face_detector/res10_300x300_ssd_iter_140000.caffemodel")
153
+ # prototxtPath = r"face_detector/deploy.prototxt"
154
+ weightsPath = join (dirname (__file__ ), 'face_detector' ,
155
+ "res10_300x300_ssd_iter_140000.caffemodel" )
156
+ # weightsPath = r"face_detector/res10_300x300_ssd_iter_140000.caffemodel"
152
157
faceNet = cv2 .dnn .readNet (prototxtPath , weightsPath )
153
158
154
159
# load the face mask detector model from disk
155
- maskNet = load_model ("face_mask.model" )
160
+ maskNet = load_model (
161
+ join (dirname (__file__ ), "face_mask.model" ))
162
+ # maskNet = load_model("face_mask.model")
156
163
157
164
158
165
class VideoCamera (object ):
0 commit comments