face-comparison
AI Face comparison using FaceNet, compare two photos and see if they are the same person.
Installation
pip install face-compare
Usage
Use compare_faces.py to compare two images of people to see if they are the same person.
compare_faces.py --image-one /path/to/image_one.png --image-two /path/to/image_two.png
Optionally output the cropped image output to a directory (useful for inspecting input to AI model)
compare_faces.py --image-one /path/to/image_one.png --image-two /path/to/image_two.png -s /path/to/outputs/
Steps Involved
- A cascade classifier is used to detect the face within the input images.
- The bounding box of this segmentation is then used to crop the images, and fed into the AI model.
- The FaceNet model then calculates the image embeddings for the two cropped images.
- Finally the second embedding is subtracted from the first, and the Euclidean norm of that vector is calculated.
- A threshold of 0.7 is used to determine whether they are the same person or not.
Known Issues
CPU Only runtime issue
If you are trying to run the module without a suitable GPU, you may run into the following error message:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU
To fix this issue with Intel CPU architecture, you can install the TensorFlow Intel Optimization package via
pip install intel-tensorflow
References
This module uses the AI model FaceNet, which can be found here, and the journal article here.
Metadata
Release files for face-compare 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| face-compare-1.1.4.tar.gz | 13.9 MB | Without provenance | Details for face-compare-1.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| face_compare-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for face_compare-1.1.4-py3-none-any.whl |
Total release size: 27.9 MB
Release files / face-compare-1.1.4.tar.gz
| Download URL | face-compare-1.1.4.tar.gz |
|---|---|
| Size | 13.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d497ebe79d71b34a06d68ee4559f6e6566567b74d80bf85ed1919c7a250d26b9
|
|
BLAKE2b-256 checksum How to use checksums |
9db56e1f1b2f29763ad2c5fd7d5de6bde19e0a049ce5771134205fb5b73b1738
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / face_compare-1.1.4-py3-none-any.whl
| Download URL | face_compare-1.1.4-py3-none-any.whl |
|---|---|
| Size | 13.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea923cafc2cc8ca1c4a23594a299d5a4d3575f7bc5feceac216e133246bf2f74
|
|
BLAKE2b-256 checksum How to use checksums |
a27fd07c502e362ee57d73059fdddacd2784557769782b7cb7b4aa1f6d56f75c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Security for face-compare 1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.