Face recognition engine
Project description
FaceEngine
Project main purpose is to simplify work with face recognition problem computation core trio - detector, embedder(encoder), and predictor. FaceEngine combines all of them in one interface model to simplify usage and furthermore extends facilities.
Usage
Getting it
To download FaceEngine, either pull this github repo or simply use Pypi via pip:
$ pip3 install face-engine
FaceEngine is supported only on Python 3.6 and above.
To fetch project default models use:
$ fetch_models
Default models requires you to install dlib :heavy_exclamation_mark:
Using it:
FaceEngine is working out of the box, with pre-defined default models:
>>> from face_engine import FaceEngine
>>> engine = FaceEngine()
to change models use appropriate setter methods, for example to use
more robust dlib face detector model 'mmod'
(see face_engine/models/mmod_detector.py
) use:
>>> engine.detector = 'mmod'
Lets do some face recognition:
- prepare some dataset with image urls/paths and class_names
>>> images = ['person1.jpg', 'person2.jpg', 'person3.jpg']
>>> class_names = ['person1', 'person2', 'person3']
- fit predictor model with prepared data
>>> engine.fit(images, class_names)
- and finally make predictions on test images
>>> from skimage import io
>>> image = io.imread('test_image.jpg.')
>>> scores, class_names = engine.predict(image)
Custom models
Pre-defined default models are used to show how to work with FaceEngine.
These models are working pretty well, but if you want to, you can work with your
own custom pre-trained models.
All you need to do is to implement model interface
Detector
, Embedder
or Predictor
(see models
package), and import it with either directly importing your model or adding it
to PYTHONPATH
environment variable or using appropriate convenient function
from face_engine.tools
. This will register your model class object itself
in models
dictionary, from where it become visible.
FaceEngine models used to register all inheriting imported subclasses (subclass registration #PEP487).
To init with your own pre-trained detector use:
>>> from my_custom_models import my_custom_detector
>>> engine = FaceEngine(detector='custom_detector')
To switch to your own model use corresponding setter method:
>>> from my_custom_models import my_custom_detector
>>> engine.detector = 'custom_detector'
How to train your own custom model is out of this user guide scope =).
Notice
There is also a few methods, but it is better if you will try to figure them out by yourself.
I didn't wrote full documentation or tutorial yet (hope doing so sooner or later), in the meantime for more detailed info on models or engine itself see docstrings.
Questions? Issues? Feel free to ask.
License
Apache License Version 2.0
Copyright 2019 Daniyar Kussainov
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file face-engine-1.2.3.tar.gz
.
File metadata
- Download URL: face-engine-1.2.3.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a51338e2af7b386a3bfa209b0d672fcefaf9253e6265ca1cee14a987a8ed052c |
|
MD5 | d2502b42c29278ac322e47e45f2714d8 |
|
BLAKE2b-256 | ab6c529e0ad353e0fec9d13c561346f2282e576893248b88edcfe57cf1ce1bf3 |
File details
Details for the file face_engine-1.2.3-py3-none-any.whl
.
File metadata
- Download URL: face_engine-1.2.3-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a38dd31263d26c7604a0a75ed1410367ea2eeb120434d69563bf9fdee55707ff |
|
MD5 | 84b86b153458dbdfe37391b56f5b49de |
|
BLAKE2b-256 | 1893d6419dc74c69dabfbac2b9a81c73cd315fba3ee3bed54f8273f87085f0f4 |