facelock
About This Project
Facelock is a plug-and-play facial recognition package for Python, designed for easy integration into your applications. It leverages powerful facial recognition models from Insightface to identify and compare facial features against saved reference images. The package uses OpenCV to access your webcam, enabling real-time facial authentication with minimal setup.
Note: this package upon import, downloads an Insightface model onto your desktop. If you do not wish to use these models, then look for other alternatives.
Build Requirements
Ensure you have Python 3.8 or greater installed on your system along with an udpated version of pip. This model downloads the necessary python packages that are required including onnxruntime, insightface and opencv-python-headless, but ensure that they are the most updated versions. Note: If you already have opencv-python installed, this may conflict with opencv-python-headless. In order to use this package, uninstall opencv-python. If you already have an older version of any of these packages, installing this package may not update them. If facelock doesn't work, you should look to first upgrade the aforementioned packages to ensure they work with eachother.
Download
This package currently requires an Anaconda Python distribution due to internal dependencies that install and use ONNX.
InsightFace, one of the core dependencies, requires a C++ compiler to operate properly. Please make sure you have a C++ compiler installed on your system before proceeding.:
Windows
- Download and install Microsoft Visual C++ Build Tools 2022 or later from:
https://visualstudio.microsoft.com/visual-cpp-build-tools/ - Ensure you select the C++ CMake tools for Windows and MSVC compiler during installation.
- To verify you have correctly installed the C++ compiler run this in the Developer Command Prompt (not the regular command prompt):
cl
- Note that simply installing MSVC build tools may not initialize your system properly. You may have to set environment variables or update your path with the cl.exe compiler.
Linux
- Install the necessary C++ compiler and build tools:
- For Ubuntu:
sudo apt update && sudo apt install build-essential
- For Fedora:
sudo dnf install gcc-c++ make
- To verify you have correctly installed the C++ compiler run this in a terminal:
g++ --version
For MacOS
-
Install Apple's command-line developer tools (includes clang for C++):
xcode-select --install -
To verify you have correctly installed the C++ compiler run this in a terminal:
g++ --version
To download this package, use the following instructions:
pip install facelock
If this does not work, then simply:
pip install git+https://github.com/Ranuja01/facelock.git
Example Usage
To use the module, simply import facelock as seen below. Keep in mind that the first usage should generally take a few more seconds as the required models are being stored:
import facelock
Note: This package requires access to a webcam to function properly. Currently, it returns a simple boolean indicating whether the face detected by the webcam matches a stored reference image. The facial recognition process takes approximately 2.5 seconds (slightly longer on first use) to complete. Below is an example demonstrating how to use the package:
import facelock
img_path = "path_to_image.jpg"
is_match = facelock.get_authentication(img_path)
if is_match:
print("User verified!")
else:
print("Unauthorized user!")
Metadata
Release files for facelock 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| facelock-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for facelock-0.1.2-py3-none-any.whl |
Release files / facelock-0.1.2-py3-none-any.whl
| Download URL | facelock-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61d76a175ba8f44f2f8506372a99b188d41a673b32268387500925e3637c42a8
|
|
BLAKE2b-256 checksum How to use checksums |
0a10e5deb7c294bb833fb452102774c55dc73fb2e8ab6cf45081f47ba0d293d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.5
|
Security for facelock 0.1.2
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.