Skip to main content

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 person
  • confidence: 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)

Source distribution for lightcnn-pytorch 1.2.1
File Size Uploaded
lightcnn_pytorch-1.2.1.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lightcnn-pytorch 1.2.1
File Interpreter ABI Platform
lightcnn_pytorch-1.2.1-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.3

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page