This is a small fun project which uses face recognition techniques to separate images from a large dataset into images of different people according to faces.
This repo contains all the code for my blog post on medium
- Getting Started
- Requirements
- Files Included
- Running the code
- Results
- License
- Acnowledgements
- References
Before getting started first create directory in your system for this project and then add the following directories to it.
- Dataset (Contains a large image set which you want to separate)
- People (Contains 1 image per person for whom you want to recognize images and separate)
- output (Empty directory, the code will fill it with images of people once it has run successfully)
The folder structure looks as follows:
Make sure you have already installed the following packages along with python 3.7:
- opencv - Image processing library
- pickle - To store encodings
- dlib - ML toolkit for image based tasks
- face_recognition - Face Recognition api built on dlib
All the neccessary code is inside image_segmentation.py file.
known_encodings.pickle is my people dataset encodings file, you can create your own when you run the code.
To run the code first add the neccessary images as stated in the getting started section. After that open command prompt or terminal in your root directory and run the following command:
python image_segmentation.py
Wait and once it's finished, check out the output folder.
Once the code is run the output folder looks something like this:
Harshit Folder:
Shreya Folder:
Group Folder:
Unknown Folder:
This project is licensed under the MIT License.
-
Images: