LightCNN
Fast and accurate face recognition model optimized for Central Asian faces. This PyTorch implementation provides an easy-to-use interface for face verification and feature extraction.
Features
- LightCNN-V4 architecture optimized for Central Asian faces
- Fast and lightweight face verification
- Automatic face alignment and preprocessing
- Easy-to-use Python API
- Pre-trained model weights included
Installation
pip install lightcnn-pytorch
Quick Start
from lightcnn_pytorch import LightCNN
# Initialize model (automatically downloads weights)
model = LightCNN()
# Verify two face images
similarity, is_same, confidence = model.verify("person1.jpg", "person2.jpg")
print(f"Similarity score: {similarity:.3f}")
print(f"Same person: {is_same}")
print(f"Confidence: {confidence:.3f}%")
Usage
Face Verification
# Compare two face images
similarity, is_same, confidence = model.verify(image1, image2)
The verify method returns:
similarity: Cosine similarity score (-1 to 1)is_same: Boolean indicating if images are of the same personconfidence: Confidence score (0-100%)
Feature Extraction
# Get face embedding features
features = model.get_features(image)
Input Formats
- File path (
str) - BGR image array (
numpy.ndarray) - RGB image array will be converted to BGR automatically
Device Selection
# Use specific device
model = LightCNN(device="cuda") # or "cpu"
Model Details
- Architecture: LightCNN-V4
- Input: 128x128 BGR image
- Preprocessing:
(x - 127.5) / 128.0 - Output: 256-dimensional feature vector
- Verification threshold: 0.7
Metadata
Release files for lightcnn-pytorch 1.2.1
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 |
|---|---|---|---|---|
| lightcnn_pytorch-1.2.1.tar.gz | 6.7 kB | Without provenance | Details for lightcnn_pytorch-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lightcnn_pytorch-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for lightcnn_pytorch-1.2.1-py3-none-any.whl |
Total release size: 14.2 kB
Release files / lightcnn_pytorch-1.2.1.tar.gz
| Download URL | lightcnn_pytorch-1.2.1.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4893899bfbb29f758cf2d865d1d1df5309a2a38c661114a2ac8a63243e995ce3
|
|
BLAKE2b-256 checksum How to use checksums |
ae0de7cbc0e6d47a6bb4cd31f1d69773a3d7d57c78035a00e0e0e49a3678df70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Release files / lightcnn_pytorch-1.2.1-py3-none-any.whl
| Download URL | lightcnn_pytorch-1.2.1-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed5b7745b196310719c06e6845b2d6aba6ba8d78dd5e86a30712dfcdceda38d4
|
|
BLAKE2b-256 checksum How to use checksums |
58e2e4c9f72df9e0ee6bb7d9e8cb06ad65319584671041f7fdd73c5f2aa8db82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Security for lightcnn-pytorch 1.2.1
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.