In this repo, I used Haar feature-based cascade classifiers which has a pre-trained machine learning functions that detect faces and other objects in an effective manner. First capturing the video through a webcam, then converting each frame from the video to gray-scale image, so that the cascade classifier can work faster in detecting faces.
Before Running the face_detector.py file, first create a virtual environment and add the python file into it, then make sure to modify the directory in line 3 to the exact directory where you saved the haarcascade_frontalface_default.xml file.