# clone this repo
git clone https://github.com/smitshilu/AISecurityCamera.git
cd AISecurityCamera
# Start the Camera feed using following commnad
python start.py
# If you want to save a new face encoding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load the required model for 68 points detection | |
predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat") | |
face_rec = dlib.face_recognition_model_v1('dlib_face_recognition_resnet_model_v1.dat') | |
# iterate through all the detected faces | |
if (len(face_locations) > 0): | |
for face_location in face_locations: | |
# get 68 points landmark | |
face_encoding = predictor(frame, face_location) | |
face_descriptor = face_rec.compute_face_descriptor(frame, face_encoding, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initialize video_capture to get camera feed | |
video_capture = cv2.VideoCapture(0) | |
video_capture.set(3, 320) | |
video_capture.set(4, 240) | |
# Grab a single frame from WebCam | |
ret, frame = video_capture.read() | |
# Initialize haar cascade | |
detect_faces = cv2.CascadeClassifier('haarcascade_frontalface_alt2.xml') |
Pre-reqs:
- Have Python 3 installed. On macOS, this could be installed from homebrew or even via standard Python 3.6 downloaded installer from https://www.python.org/download. On Linux, just use your package manager.
- On macOS:
- Install XCode from the Mac App Store (or install the XCode command line utils).
- Have homebrew installed
- On Linux:
- OS - High Sierra 10.13
- Tensorflow - 1.4
- Xcode command line tools - 8.2 (Download from here: Xcode - Support - Apple Developer & Switch to different clang version: sudo xcode-select --switch/Library/Developer/CommandLineTools & check version: clang -v)
- Cmake - 3.7
- Bazel - 0.7.0