Project overview - RemcoKuijpers/face_clustering GitHub Wiki

Project overview

Alt text

OpenCV Face Recognition

The first part uses OpenCV CascadeClassifier to detect faces in a live video stream from a webcam. The detected faces are saved by creating cropped images of the faces. These images are saved in the 'dataset' folder. The OpenCV CascadeClassifier gets retrained with the new images in the 'dataset' folder every time a new face is detected. In this way it's approximately possible to filter out the faces that are already saved in the 'dataset' folder. By not saving known faces twice the amount of pictures in the 'dataset' folder can be reduced. In practice it's possible that the OpenCV CascadeClassifier sees a new face in a known face when it's on a angle. There for a second program comes to play that's going to count the unique faces. By keeping the amount of pictures in the 'dataset' folder reduced, the second program can run faster, and keep the update time up.

Dlib Chinese Face Clustering

The second program does face detection over all the images in the 'dataset' folder using the dlib's face_recognition_model_v1. Then the unique faces get counted from the by dlib detected faces. At the end one picture per unique face gets saved in the 'output_folder' folder. The 'dataset' folder gets automatically cleared every iteration, and gets filled with the images in the 'output_folder' folder. In this way the chinese face clustering runs fast because the amount of images in the 'dataset' folder keeps small. And the already saved faces don't get lost.

File structure

tree --dirsfirst
.
├── dataset
│   └── face.0.jpg
├── face_recognition
│   ├── trainer
│   │   └── trainer.yml
│   ├── faceDetection.py
│   ├── faceRecognition.py
│   ├── faceSaver.py
│   ├── faceTrainer.py
│   └── haarcascade_frontalface_default.xml
├── Images
│   └── faceRecognition_overview.jpg
├── output_folder
│   └── face.0.jpg
├── dlib_face_recognition_resnet_model_v1.dat
├── face_clustering.py
├── README.md
├── runChineseWhispersClustering.sh
└── shape_predictor_5_face_landmarks.dat

5 directories, 14 files