LightCNN for fast, accurate and lightweight face verification
Project description
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
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
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 lightcnn_pytorch-1.2.1.tar.gz.
File metadata
- Download URL: lightcnn_pytorch-1.2.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4893899bfbb29f758cf2d865d1d1df5309a2a38c661114a2ac8a63243e995ce3
|
|
| MD5 |
1c8c82ed298d16e80bfcd6b834dc5161
|
|
| BLAKE2b-256 |
ae0de7cbc0e6d47a6bb4cd31f1d69773a3d7d57c78035a00e0e0e49a3678df70
|
File details
Details for the file lightcnn_pytorch-1.2.1-py3-none-any.whl.
File metadata
- Download URL: lightcnn_pytorch-1.2.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed5b7745b196310719c06e6845b2d6aba6ba8d78dd5e86a30712dfcdceda38d4
|
|
| MD5 |
27d535ce922e8695b18bce863c569fd6
|
|
| BLAKE2b-256 |
58e2e4c9f72df9e0ee6bb7d9e8cb06ad65319584671041f7fdd73c5f2aa8db82
|