How do I fix “RuntimeError: Unable to open shape_predictor_68_face_landmarks.dat” while using google colab?

烈酒焚心 提交于 2021-02-11 15:18:12
问题 I am writing the following Python code in Google Colaboratory and get an error: Code : import cv2 import dlib cap = cv2.VideoCapture(0) hog_face_detector = dlib.get_frontal_face_detector() dlib_facelandmark = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat") while True: _, frame = cap.read() gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) faces = hog_face_detector(gray) for face in faces: face_landmarks = dlib_facelandmark(gray, face) for n in range(0, 16): x = face_landmarks.part

Detect facial landmarks inside a detected face image using opencv dnn face detector

丶灬走出姿态 提交于 2021-01-29 11:12:42
问题 I trying to detect the 68 facial landmarks of human face. I detected the face using OpenCV dnn face detector as in https://www.pyimagesearch.com/2018/02/26/face-detection-with-opencv-and-deep-learning/ The face detection process done successfully, this is my code: # import the necessary packages import numpy as np import argparse import cv2 import dlib ap = argparse.ArgumentParser() ap.add_argument("-c", "--confidence", type=float, default=0.5, help="minimum probability to filter weak

AWS rekognition and s3 bucket region

匆匆过客 提交于 2021-01-27 20:51:32
问题 I am getting the following error when trying to access my s3 bucket with aws rekognition: message: 'Unable to get object metadata from S3. Check object key, region and/or access permissions.', My hunch is it has something to do with the region. Here is the code: const config = require('./config.json'); const AWS = require('aws-sdk'); AWS.config.update({region:config.awsRegion}); const rekognition = new AWS.Rekognition(); var params = { "CollectionId": config.awsFaceCollection } rekognition

Using Azure Face Api in Python, How to Return a single faceId or a group of FaceIds if the same person is detected in Video Stream?

爷,独闯天下 提交于 2021-01-25 03:58:33
问题 I am using Azure Face APi to detect faces in video stream, but for each detected face Azure returns a unique faceId( which is exactly what the documentation says). The problem is, Let's say Mr.ABC appears in 20 video frames, 20 unique faceIds gets generated. I want something that Azure Face should return me a single faceId or a group of FaceIds generated particularly for Mr.ABC so that I can know that its the same person that stays in front of camera for x amount of time. I have read the

OpenCV 4 TypeError: Expected cv::UMat for argument 'labels'

大城市里の小女人 提交于 2021-01-22 09:51:10
问题 I am writing a facial recognition program and I keep getting this error when I try to train my recognizer TypeError: Expected cv::UMat for argument 'labels' my code is def detect_face(img): gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml") faces = face_cascade.detectMultiScale(gray, scaleFactor=1.2, minNeighbors=5); if (len(faces)==0): return None, None (x, y, w, h) = faces[0] return gray[y:y+w, x:x

Cognitive Services - How to add multiple Faces from a Live Stream to Azure FaceList ? (Python)

安稳与你 提交于 2021-01-01 09:22:24
问题 Problem Background: I have created an Azure FaceList and I am using my webcam to capture live feed and: sending the stream to Azure Face Detect getting Face Rectangle returned by Face Detect using the returned Face rectangle to add Face Detected from Live Video Stream to my FaceList. (I need to create Face List in order to solve the problem I explained in my other question which is answered by Nicolas, which is what I am following) Problem Details: According to Azure FaceList documentation at

Using MTCNN with a webcam via OpenCV

旧时模样 提交于 2020-12-10 05:26:18
问题 I wish to be able to use a webcam and utilize MTCNN as the primary facial detector. Just as one can use Haar Cascades, I want to use MTCNN to find faces on my webcam This video is about breaking MTCNN, but nonetheless provides insight into my goal: https://www.youtube.com/watch?v=OY70OIS8bxs Here is my code so far. It used to be so that the plot would show and I'd have to "X" it out but now it just doesn't work from mtcnn.mtcnn import MTCNN import cv2 as cv from matplotlib import pyplot from

OpenCV 4.0.0 SystemError: <class 'cv2.CascadeClassifier'> returned a result with an error set

孤人 提交于 2019-12-10 17:18:29
问题 Hello I am trying to create a facial recognition program but I have a peculiar error: here is my code: gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) face_cascade = cv2.CascadeClassifier("lbpcascade_frontalface.xml") faces = face_cascade.detectMultiScale(gray, scaleFactor=1.2, minNeighbors=5); and this error is the output SystemError: <class 'cv2.CascadeClassifier'> returned a result with an error set I have "lbpcascade_frontalface.xml" in the working directory so that shouldn't be an issue if