Skip to main content

Person re-identification component for Vbot framework

Project description

DeepPerson

PyPI version Python 3.11+ License: MIT

A simple person re-identification system with automatic person detection and embedding generation.

Quick Start

Just 3 lines of code:

from deep_person import DeepPerson

# Initialize (downloads models automatically)
dp = DeepPerson()

# Generate embeddings
result = dp.represent("person.jpg")

# Verify if two images show the same person
is_same = dp.verify("person1.jpg", "person2.jpg")

Installation

From PyPI (recommended):

# Install with all features
pip install deep-person[all]

# Or with specific features
pip install deep-person[faiss-gpu]  # GPU acceleration
pip install deep-person[faiss-cpu]  # CPU-only
pip install deep-person              # Core features only

From source (development):

git clone https://github.com/VitaDynamics/DeepPerson.git
cd DeepPerson
pip install -e .[all]

Run the demo:

# Place a test image named 'back.jpg' in the repository root
python main.py

Core API

Two Simple Methods

1. represent() - Generate embeddings from images

# Single image
result = dp.represent("person.jpg")
for subject in result["subjects"]:
    print(f"Embedding: {subject['embedding'].shape}")

# Multiple images (batch processing)
result = dp.represent(["img1.jpg", "img2.jpg", "img3.jpg"])

Returns:

{
    "subjects": [
        {
            "embedding": np.ndarray,  # 2048-dimensional embedding
            "face_embedding": np.ndarray,  # Optional: 512-dim face embedding
            "metadata": {
                "confidence": 0.95,
                "bbox": (x1, y1, x2, y2)
            }
        }
    ]
}

2. verify() - Identity verification

# Compare two images
result = dp.verify("person1.jpg", "person2.jpg")
print(f"Same person: {result['verified']} (distance: {result['distance']:.4f})")

# With custom threshold
result = dp.verify("person1.jpg", "person2.jpg", threshold=0.4)

Returns:

{
    "verified": True,
    "distance": 0.25,
    "threshold": 0.40,
    "distance_metric": "cosine",
    "body_distance": 0.30,
    "face_distance": 0.20,
    "fusion_score": 0.24
}

Key Features

  • Automatic detection - YOLO-based person detection
  • Multi-modal - Body + face embeddings with fusion scoring
  • GPU acceleration - Automatic CUDA detection
  • Batch processing - Handle multiple images efficiently
  • Multiple metrics - Cosine, Euclidean, L2 normalization
  • Stateless API - No complex gallery management required

Requirements

  • Python 3.11+
  • Automatic model downloads on first use
  • Optional: CUDA GPU for faster processing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deep_person-0.1.0.tar.gz (272.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deep_person-0.1.0-py3-none-any.whl (43.6 kB view details)

Uploaded Python 3

File details

Details for the file deep_person-0.1.0.tar.gz.

File metadata

  • Download URL: deep_person-0.1.0.tar.gz
  • Upload date:
  • Size: 272.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for deep_person-0.1.0.tar.gz
Algorithm Hash digest
SHA256 db30f36080b4f9748919ece6f68965e69b32dd85b9817a06515e2a4cc58424d8
MD5 68a47bd5cbd79436860f93c8e741d710
BLAKE2b-256 a09eb52a3e8d2f12eb13f7d56985f1f8d0b38f5d945edc062deaafde637f04bf

See more details on using hashes here.

File details

Details for the file deep_person-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: deep_person-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 43.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for deep_person-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2210b8f6c8e3597b26813a517dc94f288599c54a1d4daeb5663e61e0d24efe62
MD5 9d4b74def14caa56d1cf1c7884db976c
BLAKE2b-256 86422aa09c823a693f22c76f78a061de934374853867d6236aa368870d7e8f2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page