← BACK TO PORTFOLIO

Y.O.D.A RECOGNITION

Your Optical Detection Assistant — AI-powered face recognition and image analysis.

RoleComputer Vision Developer
Timeline2023
Tech StackPython, OpenCV, PostgreSQL, Streamlit

OVERVIEW

Y.O.D.A (Your Optical Detection Assistant) is an advanced facial recognition system engineered to detect, analyze, and verify faces from uploaded images. By seamlessly integrating traditional computer vision techniques, such as Haar Cascades, with modern AI embedding models like CLIP, the application delivers a highly efficient and interactive facial recognition pipeline.

Y.O.D.A Face Recognition System Screen 1
Y.O.D.A Face Recognition System Screen 2
Y.O.D.A Face Recognition System Screen 3
Y.O.D.A Face Recognition System Screen 4
Y.O.D.A Face Recognition System Screen 5
Y.O.D.A Face Recognition System Screen 6
Y.O.D.A Face Recognition System Screen 7

KEY FEATURES

  • Hybrid Architecture: Combines the speed of Haar Cascade face detection with the robust accuracy of CLIP-based AI embeddings.
  • Intelligent Deduplication: Automatically analyzes and compares facial embeddings to maintain a strictly unique dataset.
  • Real-Time Interface: A responsive, Streamlit-powered web application facilitating seamless image ingestion and instant processing.
  • Vector Database: Leverages PostgreSQL and pgvector for highly optimized storage and retrieval of high-dimensional data.
  • Dynamic Configuration: Allows users to adjust core detection parameters and sensitivity thresholds directly through the UI.

SYSTEM ARCHITECTURE

1. Data Ingestion
Users supply target image data via a responsive and highly interactive Streamlit application.
2. Facial Localization
OpenCV's Haar Cascades isolate and map facial boundaries with high performance and low latency.
3. Feature Extraction
Localized face regions are processed by the CLIP model to produce distinct, high-dimensional vector representations.
4. Vector Matching
Generated embeddings are queried against a pgvector-enabled database using cosine similarity to flag duplicates or store unique profiles.

TECHNOLOGIES USED

Frameworks
Python 3 serves as the core backend language, paired with Streamlit to deliver a dynamic and interactive web interface.
Computer Vision & AI
Utilizes OpenCV for spatial face detection alongside the CLIP Model and Sentence Transformers to generate semantic embeddings.
Database
PostgreSQL, enhanced with the pgvector extension, handles vector indexing and storage, managed via psycopg2.
Core Libraries
Leverages NumPy and PIL for matrix operations, complemented by Requests and streamlit-lottie for frontend interactivity.

INSTALLATION & DATABASE SETUP

1. Clone the repository and install dependencies:

git clone https://github.com/AAFLY99/yoda-face-recognition.git
cd yoda-face-recognition
pip install -r requirements.txt

2. Configure PostgreSQL with pgvector:

conn = psycopg2.connect(
    host="localhost",
    database="yoda",
    user="postgres",
    password="your_password"
)

3. Run the application:

streamlit run app.py

DATABASE SCHEMA & DESIGN

The system's backend is anchored by a PostgreSQL database utilizing the pgvector extension. This robust architecture enables the efficient storage of high-dimensional AI embeddings and facilitates low-latency cosine similarity searches for rapid duplicate detection.

Faces Table Structure
  • id: SERIAL PRIMARY KEY
  • embedding: VECTOR(512) — AI representation
  • image_path: VARCHAR(255)
  • added_at: TIMESTAMP DEFAULT NOW()
Vector Search Logic
Upon ingestion, the system queries the generated CLIP embedding against existing records using cosine distance (<=>). If the resulting distance is below the predefined threshold, the entry is classified as a duplicate.

RESULTS & FUTURE IMPROVEMENTS

Current Performance
The pipeline accurately isolates and cross-references faces, achieving approximately 70% accuracy in optimal lighting conditions while effectively enforcing dataset uniqueness.
Technical Challenges
Significant hurdles included optimizing detection for low-light environments and extreme profile angles. Seamlessly integrating complex AI models like CLIP within a Streamlit context also required careful optimization.
Future Roadmap
Planned iterations involve implementing live video feed processing, transitioning to specialized facial recognition models (e.g., ArcFace) for edge cases, and introducing automated demographic labeling and encryption protocols.