I am using the inbuilt cascade classifier for the face detection. This is how the code is (OpenCV Python Tutorials):
import numpy as np import cv2 face_casc
In newer versions of opencv haarcascades also gets installed you just need the file location of haarcascades, to get it you can use cv2.data.haarcascades just like shown below
cascPath = "haarcascade_frontalface_default.xml" faceCascade = cv2.CascadeClassifier(cv2.data.haarcascades + cascPath)