InspireFace Python SDK
Project description
InspireFace Python API
InspireFace provides an easy-to-use Python API that wraps the underlying dynamic link library through ctypes. You can install the latest release version via pip or configure it using the project's self-compiled dynamic library.
Quick Installation
Install via pip (Recommended)
pip install inspireface
Manual Installation
- First install the necessary dependencies:
pip install loguru tqdm opencv-python
- Copy the compiled dynamic library to the specified directory:
# Copy the compiled dynamic library to the corresponding system architecture directory
cp YOUR_BUILD_DIR/libInspireFace.so inspireface/modules/core/SYSTEM/CORE_ARCH/
- Install the Python package:
python setup.py install
Quick Start
Here's a simple example showing how to use InspireFace for face detection and landmark drawing:
import cv2
import inspireface as isf
# Create session with required features enabled
session = isf.InspireFaceSession(
opt=isf.HF_ENABLE_NONE, # Optional features
detect_mode=isf.HF_DETECT_MODE_ALWAYS_DETECT # Detection mode
)
# Set detection confidence threshold
session.set_detection_confidence_threshold(0.5)
# Read image
image = cv2.imread("path/to/your/image.jpg")
assert image is not None, "Please check if the image path is correct"
# Perform face detection
faces = session.face_detection(image)
print(f"Detected {len(faces)} faces")
# Draw detection results on image
draw = image.copy()
for idx, face in enumerate(faces):
# Get face bounding box coordinates
x1, y1, x2, y2 = face.location
# Calculate rotated box parameters
center = ((x1 + x2) / 2, (y1 + y2) / 2)
size = (x2 - x1, y2 - y1)
angle = face.roll
# Draw rotated box
rect = ((center[0], center[1]), (size[0], size[1]), angle)
box = cv2.boxPoints(rect)
box = box.astype(int)
cv2.drawContours(draw, [box], 0, (100, 180, 29), 2)
# Draw landmarks
landmarks = session.get_face_dense_landmark(face)
for x, y in landmarks.astype(int):
cv2.circle(draw, (x, y), 0, (220, 100, 0), 2)
More Examples
The project provides multiple example files demonstrating different features:
sample_face_detection.py: Basic face detectionsample_face_track_from_video.py: Video face trackingsample_face_recognition.py: Face recognitionsample_face_comparison.py: Face comparisonsample_feature_hub.py: Feature extractionsample_system_resource_statistics.py: System resource statistics
Running Tests
The project includes unit tests. You can adjust test content by modifying parameters in test/test_settings.py:
python -m unittest discover -s test
Notes
- Ensure that OpenCV and other necessary dependencies are installed on your system
- Make sure the dynamic library is correctly installed before use
- Python 3.7 or higher is recommended
- The default version is CPU, if you want to use the GPU, CoreML, or NPU backend version, you can refer to the documentation to replace the so and make a Python installation package
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 Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file inspireface-1.2.3.post5-cp312-cp312-manylinux2014_x86_64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp312-cp312-manylinux2014_x86_64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.12
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e533ed52b671f8a259794b504f4a906290a97b149bb856c4039b689f7a409f43
|
|
| MD5 |
5a085130d6b9804f8d188c2096d6e994
|
|
| BLAKE2b-256 |
54b261a513f4218df9f4f7ea3e24c86553e990250209b327a7a44088ae8cdc4a
|
File details
Details for the file inspireface-1.2.3.post5-cp312-cp312-manylinux2014_aarch64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp312-cp312-manylinux2014_aarch64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.12
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f144ad75227b81e3121cc6d2fa6ab7b24300cf1da8768bc3b4eec375aee34d8f
|
|
| MD5 |
4e02c9c4e4fb23220b0d9ccddd19a7cf
|
|
| BLAKE2b-256 |
435b14ae8e4330f330f7c463765d912951074ebb04c43c1643a58979154c201f
|
File details
Details for the file inspireface-1.2.3.post5-cp312-cp312-macosx_14_0_universal2.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp312-cp312-macosx_14_0_universal2.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.12, macOS 14.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de8e831d1dc2d71e6bcd20b4d359583a24fcbe042af44a473a160d54b182507a
|
|
| MD5 |
26c2aff6c5328be2c39cf0783028d062
|
|
| BLAKE2b-256 |
4cc260e2a207ca126e48898ace9c291cd27c22b41d196b06a55e8e4af3030426
|
File details
Details for the file inspireface-1.2.3.post5-cp312-cp312-macosx_13_0_universal2.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp312-cp312-macosx_13_0_universal2.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.12, macOS 13.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
264656aae249c1d71b0cc8611e578188f0c53843f38f26902102b6ee68c6fd10
|
|
| MD5 |
ac04ef3e79291c223fe72ed14772ebb0
|
|
| BLAKE2b-256 |
1251c52d7effe51ec6fe9d493d1a472b932da8a30cbb951da6f8e053ba6d86c3
|
File details
Details for the file inspireface-1.2.3.post5-cp311-cp311-manylinux2014_x86_64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp311-cp311-manylinux2014_x86_64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.11
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d480ef0790730eff606a5fbf42f9cc8ca0eb590ab108ebb2d534287314bdcf23
|
|
| MD5 |
ffc6e6142bc9026aa017c016c19ec665
|
|
| BLAKE2b-256 |
2a62fac235a9584e6cab7eb73dbe88ada155fdf0fabaf9527b814ab7747972b9
|
File details
Details for the file inspireface-1.2.3.post5-cp311-cp311-manylinux2014_aarch64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp311-cp311-manylinux2014_aarch64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.11
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dea8096151570fa8f49149128aea473d438d6746d4a6a344656ef298dc30e79
|
|
| MD5 |
a51c52c6364c4ed803d25998ccec0c08
|
|
| BLAKE2b-256 |
839a54d17a7e4f8e9349b75abe38f8ea591eec007d9a0640f7852cefb20c161b
|
File details
Details for the file inspireface-1.2.3.post5-cp311-cp311-macosx_14_0_universal2.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp311-cp311-macosx_14_0_universal2.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.11, macOS 14.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b4bbac6ca714db2eb55303b8a137e777c3aba672da4d6599cbda916699445c5
|
|
| MD5 |
7a12a4dbe58d95a05be000a98d490b58
|
|
| BLAKE2b-256 |
69764e8b6b38f6bdef5286d5e4d3c9f0d7e4e2deb1a0f0f3c8135110e2a0aebd
|
File details
Details for the file inspireface-1.2.3.post5-cp311-cp311-macosx_13_0_universal2.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp311-cp311-macosx_13_0_universal2.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.11, macOS 13.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea92807fe1116bd0c9d37df6a4c658b273eed68ec1662b62a81acc17d62fdfcb
|
|
| MD5 |
7d1a024e71dd9afde596ab4d02ca6ab5
|
|
| BLAKE2b-256 |
967c7689044901948a128eb7bc4bf22b8bf2ed6edf8cd32da0ae7b69e1706a2c
|
File details
Details for the file inspireface-1.2.3.post5-cp310-cp310-manylinux2014_x86_64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp310-cp310-manylinux2014_x86_64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb3c371892834853939d55d1d941b0446152ce74c0fc05f6ada6a0fd58fa0058
|
|
| MD5 |
8345c43bad2a6bad4b3de096312fc3c3
|
|
| BLAKE2b-256 |
67fb8da504ff2389dc0f8487cc50def99012bf47e3c0d4ee4ff3ce4c3f1b8554
|
File details
Details for the file inspireface-1.2.3.post5-cp310-cp310-manylinux2014_aarch64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp310-cp310-manylinux2014_aarch64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7983d1429edaa864b5b8de14431dc0439b4906e4581c7f3af5b67c2098a74b29
|
|
| MD5 |
49bfc84dfd10291cbe1194443015be23
|
|
| BLAKE2b-256 |
2d999c673edc984fd752f8ba7aa45669c4ad1b5b68beb52f01e9a6d342a30b02
|
File details
Details for the file inspireface-1.2.3.post5-cp310-cp310-macosx_14_0_universal2.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp310-cp310-macosx_14_0_universal2.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.10, macOS 14.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2220350a1da9aa6ff9ae0ade9fabb8a7d4964761233e44010de62b11a46b261a
|
|
| MD5 |
5e666691619618796c43877feffa4cbe
|
|
| BLAKE2b-256 |
42a9a71a71ffe6362bd3812411d26166971a453559b4d6666a988718e3c83534
|
File details
Details for the file inspireface-1.2.3.post5-cp310-cp310-macosx_13_0_x86_64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp310-cp310-macosx_13_0_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.10, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e134dc338f8a71ba08af984e9505409c3ad34a4c04d085d581ae47cdf9c66d98
|
|
| MD5 |
489b965aae861bb6d1064c4320065af7
|
|
| BLAKE2b-256 |
8a85f941d5222db360a40e68587053e1c0891b9dc734e0110efffed52fa745c8
|
File details
Details for the file inspireface-1.2.3.post5-cp39-cp39-manylinux2014_x86_64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp39-cp39-manylinux2014_x86_64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d48a6cbfd14dc8acd716f6a1f3dd18489520d4715329be3fae0abe7088795eb3
|
|
| MD5 |
2ecc0aab784a186566e8ab05f36f3e33
|
|
| BLAKE2b-256 |
4b25a887a920ec277da1ce323584bd360b4cb5060b5dfb40d95fe4a0f1d6e232
|
File details
Details for the file inspireface-1.2.3.post5-cp39-cp39-manylinux2014_aarch64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp39-cp39-manylinux2014_aarch64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05819df9bf5c851a47414a46ac3bbb482c8f544c106b18b21e32a1837bac099a
|
|
| MD5 |
c066c3ab7394c8d9c6a0e08f558e7a64
|
|
| BLAKE2b-256 |
fd19116b3b5038aceabf69f029c4060d033c606c6e2cb33a369dc3b96deaf56b
|
File details
Details for the file inspireface-1.2.3.post5-cp39-cp39-macosx_14_0_universal2.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp39-cp39-macosx_14_0_universal2.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.9, macOS 14.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b32b86e1a921671dbd2f9194dca51a5053062c24d1fb5d9c68fa8a5bc1eba28
|
|
| MD5 |
2520bfde573eeb0804c5936694b0e4f2
|
|
| BLAKE2b-256 |
e488ed6aa4fdca37081beba9c4bdc86efe780527874e2d55c34f2627a813795a
|
File details
Details for the file inspireface-1.2.3.post5-cp39-cp39-macosx_13_0_x86_64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp39-cp39-macosx_13_0_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.9, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0a34582e00e9ca58932c63520b8c966465c39be5ebac63325312d55789d52e6
|
|
| MD5 |
877c254d8c86954acd760bdd2baae30a
|
|
| BLAKE2b-256 |
50f56a702754f740c540b89c8b328918aa5a5f4ec52851e27d82a07faee6b7e0
|
File details
Details for the file inspireface-1.2.3.post5-cp38-cp38-manylinux2014_x86_64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b0a0bee0c6061712ab77d76ba02e5fefb21056031e55ee8e3b76dff18a23eef
|
|
| MD5 |
f872cc6de2abeb8fb75791a7267fec3a
|
|
| BLAKE2b-256 |
4297569f678cb9bb2409d6c8b1fa59903dbe0c69789a43babc3f3aa9ce3a98d0
|
File details
Details for the file inspireface-1.2.3.post5-cp38-cp38-manylinux2014_aarch64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp38-cp38-manylinux2014_aarch64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7f8baf25594b1dce1b85741b8919dc662ab2feb62492ab10eee6b8678884fba
|
|
| MD5 |
74e66a17362eac17ca3d19e3de62f490
|
|
| BLAKE2b-256 |
a4a2a420cf3e93956a83e98e727afadbc18378b994e7261e9aeebe4ac6602d73
|
File details
Details for the file inspireface-1.2.3.post5-cp38-cp38-macosx_14_0_universal2.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp38-cp38-macosx_14_0_universal2.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.8, macOS 14.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32ab1a13bf91dded15c2457674ee8b5b61629a60147e2607ac4f40d7a5c05efc
|
|
| MD5 |
48170dd2ed28e351d852590ceb45549b
|
|
| BLAKE2b-256 |
eb19a8ab5e0de5684a6f4fc8e0a6006d49e19bd23530cc709552ca2555915976
|
File details
Details for the file inspireface-1.2.3.post5-cp38-cp38-macosx_13_0_x86_64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp38-cp38-macosx_13_0_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.8, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89d5c2b291c8f6b0de16e568beb59080f0cf83c5d471c427c46b23b36e48e2e8
|
|
| MD5 |
7ebd35ec00d558c0450c4e1b78ec3ebe
|
|
| BLAKE2b-256 |
f76c55e59f288a22e416b73d0b4c7f3fa33273ab83e85b648c0ab96d8d9cd064
|
File details
Details for the file inspireface-1.2.3.post5-cp37-cp37m-macosx_13_0_x86_64.whl.
File metadata
- Download URL: inspireface-1.2.3.post5-cp37-cp37m-macosx_13_0_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.7m, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b0aba97d8fb50447da86d7c3185fcbd0e61d6f6ec0ae0e30b86c59de34f1cb5
|
|
| MD5 |
d8cb979cf6be1c21a6bdd820bd057a05
|
|
| BLAKE2b-256 |
f10f6a1a29fb6a8524c90ed815c6c7c301bb98fcce3be33b79e43c5aae0dc4f3
|