Downloads · 30 days
0
resnet151/celeb_detector
celeb_detector is a machine learning model from resnet151. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Downloads · 30 days
0
Access
Public
Updated Apr 14, 2024
Repo size
629 MB
Likes
2
Public
Click a slice to open those files.
.ann394 MB · 63%
From the Hugging Face model README
Refer this for detailed documentation.
You can also read my article on medium here.
Face detection is done using face_recognition module.
Face encodings are created using VGGFace model (converted to pytorch here).
Face matching is done using annoy library.
pip install -r requirements.txt to install all the dependencies (preferably in a virtual environment).pip install -r requirements.txt first.# pip release version
pip install celeb-detector
# Directly from repo
pip install -e .
For using my model for predictions, use the following lines of code after installation:
import celeb_detector
img_path = 'sample_image.jpg' # this supports both local path and web url like https://sample/sample_image_url.jpg
celeb_detector.celeb_recognition(img_path)
This returns a list of dictionaries, each dictionary contains bbox coordinates, celeb name and confidence for each face detected in the image (celeb name will be unknown if no matching face detected).
For using your own custom model, also provide path to json and ann files as shown below:
import celeb_detector
img_path = 'sample_image.jpg'
ann_path = 'sample_index.ann'
celeb_map = 'sample_mapping.json'
celeb_detector.celeb_recognition(img_path, ann_path, celeb_map)
For creating your own model (refer this for more details on usage) and run as follows:
import celeb_detector
folder_path = 'celeb_images'
celeb_detector.create_celeb_model(folder_path)
celeb_images/
celeb-a/
celeb-a_1.jpg
celeb-a_2.jpg
...
celeb-b/
celeb-b_1.jpg
celeb-b_1.jpg
...
...
celeb_images folder) in the create_celeb_model.py file.celeb_mapping.json (for storing indexes vs celeb names), celeb_index.ann (ann file for searching encodings) and celeb_name_encoding.pkl files (for storing encodings vs indexes for each celeb).
(WARNING: You need to provide paths for storing each of these files, default is to store in the current directory)celeb_mapping.json and celeb_index.ann files in celeb_recognition.ipynb file. If you want to try my model, ignore this step.celeb_mapping.json and celeb_index.ann files in celeb_prediction_main.py. If you want to try my model, ignore this step.