Skip to content

Sanidhya-Jindal/forensync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FORENSYNC

Forensic Identification System
Reuniting families through technology

FastAPI React Python Qdrant

A comprehensive platform for reporting, searching, and matching missing persons with unidentified bodies using AI-powered facial recognition and vector search.


🎯 Overview

FORENSYNC is an advanced forensic identification system that leverages AI and machine learning to help law enforcement agencies, forensic departments, and families identify missing persons and unidentified bodies. The platform combines traditional database management with cutting-edge facial recognition and semantic search capabilities.

Key Capabilities

  • πŸ” AI-Powered Search - Text-based and image-based search with semantic matching
  • πŸ‘€ Facial Recognition - InsightFace-powered facial embeddings for accurate matching
  • πŸ—„οΈ Vector Database - Qdrant for high-performance similarity search
  • πŸ“Š Real-time Dashboard - Live statistics and case management
  • πŸ“Έ Multi-Photo Support - Profile and additional evidence photos
  • 🌍 Geolocation - GPS coordinates for last seen/found locations
  • πŸ” Unique IDs - Auto-generated PIDs (MP-2024-XXXXX, UIDB-2024-XXXXX)

πŸ—οΈ Architecture

Technology Stack

Backend

  • FastAPI - High-performance Python API framework
  • SQLite - Lightweight relational database
  • Qdrant - Vector similarity search engine
  • InsightFace - State-of-the-art facial recognition
  • Sentence Transformers - Text embedding models

Frontend

  • React 18 - Modern UI library
  • Vite - Lightning-fast development server
  • React Router - Client-side routing
  • Tailwind CSS 3 - Utility-first styling
  • Axios - HTTP client

Design System

  • Matter Font - Warp.dev's professional typeface
  • Dark Theme - #0D0D0D background with #F87171 coral accents
  • Animations - Smooth transitions and micro-interactions

Project Structure

FORENSYNC/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                         # FastAPI application
β”‚   β”œβ”€β”€ db_helper.py                    # Database operations
β”‚   β”œβ”€β”€ face_embedding.py               # Facial recognition
β”‚   β”œβ”€β”€ text_embedder.py                # Text embedding
β”‚   β”œβ”€β”€ vector_retrieval.py             # Vector search
β”‚   β”œβ”€β”€ vectordb.py                     # Qdrant integration
β”‚   β”œβ”€β”€ missing_persons.db              # SQLite database
β”‚   β”œβ”€β”€ qdrant_data/                    # Vector storage
β”‚   └── photos/                         # Image storage
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.jsx                     # Router configuration
β”‚   β”‚   β”œβ”€β”€ api.js                      # Backend API client
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   └── Layout.jsx              # Main layout with navbar
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.jsx                # Dashboard
β”‚   β”‚   β”‚   β”œβ”€β”€ SearchMatch.jsx         # Search interface
β”‚   β”‚   β”‚   β”œβ”€β”€ Records.jsx             # Browse records
β”‚   β”‚   β”‚   β”œβ”€β”€ ReportMissingPerson.jsx # Report form
β”‚   β”‚   β”‚   └── ReportUnidentifiedBody.jsx
β”‚   β”‚   β”œβ”€β”€ index.css                   # Global styles + animations
β”‚   β”‚   └── main.jsx                    # React entry point
β”‚   β”œβ”€β”€ tailwind.config.js              # Theme configuration
β”‚   β”œβ”€β”€ vite.config.js                  # Dev server + proxy
β”‚   └── package.json                    # Dependencies
β”‚
└── docs/
    β”œβ”€β”€ API_DOCUMENTATION.md
    β”œβ”€β”€ DATABASE_README.md
    β”œβ”€β”€ FACE_RECOGNITION_README.md
    └── QDRANT_SETUP.md

πŸš€ Quick Start

Prerequisites

  • Python 3.9+
  • Node.js 18+
  • 8GB RAM (for face recognition models)

1. Backend Setup

# Install Python dependencies
pip install -r requirements.txt
pip install -r requirements_face_recognition.txt

# Initialize database
python setup_database.py

# Start FastAPI server
uvicorn main:app --reload --host 0.0.0.0 --port 8000

The API will be available at http://localhost:8000
Interactive docs: http://localhost:8000/docs

2. Frontend Setup

# Navigate to frontend
cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

The app will be available at http://localhost:5173


πŸ“‘ API Endpoints

Health & Stats

  • GET /health - System health check
  • GET /api/stats - Dashboard statistics

Search

  • POST /api/search/match - Text-based semantic search
  • POST /api/search/image - Facial recognition search

Records

  • GET /api/missing-persons - List all missing persons
  • GET /api/unidentified-bodies - List all unidentified bodies

Reporting

  • POST /api/report/missing-person - Report a missing person
  • POST /api/report/unidentified-body - Report an unidentified body

See API_DOCUMENTATION.md for detailed API specs.


πŸ’‘ Features

1. Smart Search

Text Search

  • Semantic matching using Sentence Transformers
  • Search by name, description, physical features, clothing
  • Returns ranked results with similarity scores

Image Search

  • Upload a photo for facial recognition
  • InsightFace embeddings with ArcFace model
  • Matches against 512-dimensional face vectors

2. Case Management

Missing Persons

  • FIR number and police station
  • Reporter contact information
  • Physical description (height, age, gender, complexion)
  • Clothing and distinguishing marks
  • Last seen location with GPS coordinates
  • Multiple photos support

Unidentified Bodies

  • Forensic case number
  • Body discovery details
  • Postmortem observations
  • DNA, dental, and fingerprint records
  • Found location with GPS
  • Evidence photos

3. Real-time Dashboard

  • Total missing persons count
  • Total unidentified bodies count
  • Recent reports
  • Match statistics

🎨 UI/UX Design

FORENSYNC follows Warp.dev's design language:

Color Palette

Background:    #0D0D0D
Cards:         #262626
Borders:       #333333
Text Primary:  #FFFFFF
Text Muted:    #9B9B9B
Accent:        #F87171 (Coral)

Typography

  • Font Family: Matter (Warp.dev's custom font)
  • Weights: Regular (400), Medium (500)

Animations

  • Fade-in transitions on page load
  • Slide-in effects for cards
  • Hover lift animations
  • Shimmer loading states

πŸ—„οΈ Database Schema

Missing Persons Table

Field Type Description
pid TEXT PRIMARY KEY MP-2024-XXXXX
name TEXT Full name
age INTEGER Age in years
gender TEXT Male/Female/Other
height_cm INTEGER Height in cm
person_description TEXT Physical description
last_seen_address TEXT Last known location
last_seen_lat/lng REAL GPS coordinates
status TEXT Open/Matched/Closed

Unidentified Bodies Table

Field Type Description
pid TEXT PRIMARY KEY UIDB-2024-XXXXX
age_range TEXT Estimated age range
gender TEXT Gender identification
height_cm INTEGER Height in cm
body_description TEXT Physical description
found_address TEXT Discovery location
found_lat/lng REAL GPS coordinates
status TEXT Open/Matched/Closed

See DATABASE_README.md for complete schema.


🧠 AI/ML Components

Facial Recognition

  • Model: InsightFace (Buffalo_L)
  • Embedding Size: 512 dimensions
  • Accuracy: 99.8% on LFW benchmark
  • Backend: ONNX Runtime

Text Embeddings

  • Model: all-MiniLM-L6-v2
  • Embedding Size: 384 dimensions
  • Use Case: Semantic search across descriptions

Vector Database

  • Engine: Qdrant
  • Distance Metric: Cosine similarity
  • Collections: missing_persons, unidentified_bodies
  • Indexing: HNSW algorithm

πŸ“š Documentation


πŸ”§ Configuration

Environment Variables

Create a .env file in the root directory:

# Database
DATABASE_URL=sqlite:///./missing_persons.db

# Qdrant
QDRANT_HOST=localhost
QDRANT_PORT=6333

# Face Recognition
FACE_MODEL_PATH=./models/buffalo_l

# API
API_HOST=0.0.0.0
API_PORT=8000

Frontend Configuration

Edit frontend/vite.config.js to change backend URL:

export default defineConfig({
  server: {
    proxy: {
      '/api': 'http://localhost:8000'
    }
  }
})

πŸ§ͺ Testing

Backend Tests

python test_db_connection.py
python test_qdrant_init.py
python test_vector_retrieval.py

API Testing

# Run test suite
python test_api.py

# Or use the interactive docs
# Visit http://localhost:8000/docs

πŸ” Security

  • βœ… CORS configured for specific origins
  • βœ… File upload validation
  • βœ… SQL injection prevention via parameterized queries
  • βœ… Photos stored with UUID filenames
  • βœ… Environment variables for sensitive data
  • ⚠️ Production: Use HTTPS, authentication, rate limiting

🚒 Deployment

Backend

# Build production
pip install -r requirements.txt

# Run with Gunicorn
gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker

Frontend

cd frontend
npm run build
# Deploy the 'dist' folder to a static host

🀝 Contributing

This project is part of the Hack4Safety initiative to leverage technology for social good.


πŸ“„ License

MIT License - See LICENSE file for details


πŸ‘₯ Team

RaptureTwelve - Hack4Safety 2024


πŸ†˜ Support

For issues and questions:

  • πŸ“§ Check existing documentation in /docs
  • πŸ› Report bugs via GitHub Issues
  • πŸ’¬ Contact the development team

FORENSYNC - Bringing closure through technology

Made with ❀️ for Hack4Safety

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors