Skip to content

Instantly share code, notes, and snippets.

@codebrain001
Created October 13, 2020 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codebrain001/7d0a8c3944735807be4664e101c67287 to your computer and use it in GitHub Desktop.
Save codebrain001/7d0a8c3944735807be4664e101c67287 to your computer and use it in GitHub Desktop.
def get_facenet_masknet():
ap = argparse.ArgumentParser()
ap.add_argument("-f", "--face", type=str,
default="face_detector",
help="path to face detector model directory")
ap.add_argument("-m", "--model", type=str,
default="mask_detector.model",
help="path to trained face mask detector model")
ap.add_argument("-c", "--confidence", type=float, default=0.5,
help="minimum probability to filter weak detections")
args = vars(ap.parse_args())
# load our serialized face detector model from disk
print("[INFO] loading face detector model...")
# prototxtPath = os.path.sep.join([args["face"], "deploy.prototxt"])
prototxtPath = (
'/Users/USER/Documents/DroneProjects/facemaskdetection/face_detector/deploy.prototxt')
# weightsPath = os.path.sep.join([args["face"],
# "res10_300x300_ssd_iter_140000.caffemodel"])
weightsPath = (
'/Users/USER/Documents/DroneProjects/facemaskdetection/face_detector/res10_300x300_ssd_iter_140000.caffemodel')
faceNet = cv2.dnn.readNet(prototxtPath, weightsPath)
# load the face mask detector model from disk
print("[INFO] loading face mask detector model...")
maskNet = load_model(
'/Users/USER/Documents/DroneProjects/facemaskdetection/mask_detector.model')
return(faceNet, maskNet, args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment