Skip to content

PranshuSharma14/DHRISHTI

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ DRISHTI

Defense-Grade Early Warning Intelligence System

"Turning background noise into preventive defense insight."

Designed for border surveillance and high-security perimeters where threats emerge gradually.

Python Streamlit TRL Dataset License


๐ŸŽฏ The Problem

Traditional surveillance systems are REACTIVE:

  • They alert you AFTER something bad happens
  • Binary alerts: "NORMAL" or "ALARM"
  • High false positive rate causes alert fatigue
  • Misses gradual threats that evolve slowly

Real-world threats often emerge GRADUALLY:

  • Border infiltrations happen in stages
  • Insider threats develop over weeks
  • Equipment fails progressively
  • Crowd tension builds before incidents

๐Ÿ’ก Our Solution

DRISHTI detects threats BEFORE they become obvious.

Instead of asking "Is this instant abnormal?" (reactive), we ask:

"Is behavior gradually changing from what's normal?" (proactive)

Key Innovation: Drift Detection, Not Anomaly Detection


๐Ÿ—๏ธ System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         DRISHTI PIPELINE                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                     โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ ๐Ÿ“น VIDEO     โ”‚โ”€โ”€โ”€โ†’โ”‚ ๐Ÿ”ฌ FEATURE   โ”‚โ”€โ”€โ”€โ†’โ”‚ ๐Ÿง  LSTM-VAE          โ”‚  โ”‚
โ”‚  โ”‚  INGESTION   โ”‚    โ”‚  EXTRACTION  โ”‚    โ”‚  TEMPORAL LEARNING   โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚         โ”‚                    โ”‚                       โ”‚              โ”‚
โ”‚         โ”‚           24 Behavioral Features           โ”‚              โ”‚
โ”‚         โ”‚           โ€ข Motion Energy                  โ”‚              โ”‚
โ”‚         โ”‚           โ€ข Optical Flow                   โ”‚              โ”‚
โ”‚         โ”‚           โ€ข Scene Entropy                  โ”‚              โ”‚
โ”‚         โ”‚           โ€ข Direction Patterns             โ”‚              โ”‚
โ”‚         โ”‚                                            โ”‚              โ”‚
โ”‚         โ”‚                    โ†“                       โ†“              โ”‚
โ”‚         โ”‚         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”            โ”‚
โ”‚         โ”‚         โ”‚     ๐Ÿ“Š DRIFT INTELLIGENCE          โ”‚            โ”‚
โ”‚         โ”‚         โ”‚  โ€ข Threat Deviation Index (TDI)    โ”‚            โ”‚
โ”‚         โ”‚         โ”‚  โ€ข KL Divergence Analysis          โ”‚            โ”‚
โ”‚         โ”‚         โ”‚  โ€ข EWMA Smoothed Scoring           โ”‚            โ”‚
โ”‚         โ”‚         โ”‚  โ€ข Trend Detection (โ†‘ โ†’ โ†“)         โ”‚            โ”‚
โ”‚         โ”‚         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ”‚
โ”‚         โ”‚                         โ”‚                                 โ”‚
โ”‚         โ”‚                         โ†“                                 โ”‚
โ”‚         โ”‚         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”            โ”‚
โ”‚         โ”‚         โ”‚     ๐ŸŽฏ RISK ZONE CLASSIFIER        โ”‚            โ”‚
โ”‚         โ”‚         โ”‚  ๐ŸŸข NORMAL  โ†’ Standard monitoring  โ”‚            โ”‚
โ”‚         โ”‚         โ”‚  ๐ŸŸก WATCH   โ†’ Increase attention   โ”‚            โ”‚
โ”‚         โ”‚         โ”‚  ๐ŸŸ  WARNING โ†’ Alert response team  โ”‚            โ”‚
โ”‚         โ”‚         โ”‚  ๐Ÿ”ด CRITICALโ†’ Immediate action     โ”‚            โ”‚
โ”‚         โ”‚         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ”‚
โ”‚         โ”‚                         โ”‚                                 โ”‚
โ”‚         โ”‚                         โ†“                                 โ”‚
โ”‚         โ”‚         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”            โ”‚
โ”‚         โ”‚         โ”‚     ๐Ÿ–ฅ๏ธ INTELLIGENCE DASHBOARD      โ”‚            โ”‚
โ”‚         โ”‚         โ”‚  โ€ข Real-time TDI visualization     โ”‚            โ”‚
โ”‚         โ”‚         โ”‚  โ€ข Feature attribution (XAI)       โ”‚            โ”‚
โ”‚         โ”‚         โ”‚  โ€ข Human-in-the-loop feedback      โ”‚            โ”‚
โ”‚         โ”‚         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ”‚
โ”‚                                                                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โœจ Key Features

Feature Description
๐ŸŽ“ Unsupervised Learning Train only on normal behavior - no labeled anomalies needed
๐Ÿง  LSTM-VAE Architecture Pure NumPy implementation - temporal normality modeling
๏ฟฝ Ensemble Detection LSTM-VAE + Isolation Forest + One-Class SVM + LOF
๐Ÿ“Š Threat Deviation Index 0-100 scale for intuitive operator understanding
๐ŸŽฏ 4-Tier Risk Zones Graduated alerts reduce fatigue (Normal โ†’ Watch โ†’ Warning โ†’ Critical)
๐Ÿท๏ธ Anomaly Classification Categorize threats (Loitering, Intrusion, Crowd, etc.)
๐ŸŒŒ 3D Latent Visualization Visualize behavioral trajectories in latent space
๐Ÿ” Explainable AI (XAI) Shows WHICH features are causing drift
๐Ÿšจ Incident Logging Track, export, and analyze all alerts
๐Ÿ”ฎ TDI Forecasting Predict future threat levels
๐Ÿ‘ค Human-in-the-Loop Operators provide feedback for baseline adaptation
๐Ÿ“น Real Video Support Works with UCSD dataset and custom surveillance footage

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.10 or higher
  • Git

Installation

# 1. Clone the repository
git clone https://github.com/YourUsername/Noise_floor_project.git
cd Noise_floor_project

# 2. Create virtual environment
python -m venv .venv

# 3. Activate virtual environment
# Windows PowerShell:
.\.venv\Scripts\Activate.ps1
# Windows CMD:
.\.venv\Scripts\activate.bat
# Linux/Mac:
source .venv/bin/activate

# 4. Install dependencies
pip install -r requirements.txt

Running the Application

# Launch the main dashboard (RECOMMENDED)
streamlit run dashboard/app_main.py

The dashboard opens at http://localhost:8501


๐Ÿ–ฅ๏ธ Dashboard Guide

Dashboard Tabs

Tab Description
๐Ÿ“Š Intelligence Dashboard Main TDI display, risk zones, feature attribution, AI explanations
๐Ÿง  AI Ensemble Multi-model detection votes, 3D latent space, anomaly classification
๐Ÿ“น Camera Grid 6-camera surveillance view with live UCSD frames
๐Ÿšจ Incident Log Full history of all alerts with export capability
๐Ÿ“ˆ Analytics Session statistics, zone distribution, data export

Operating Modes

Mode Description Use Case
๐Ÿ“น UCSD Real Video Processes actual surveillance footage from UCSD dataset Production demo, validation
๐Ÿ”ฌ Synthetic Demo Uses generated data with controlled drift Quick testing, concept demo

Understanding the Display

Threat Deviation Index (TDI)

  • 0-25: ๐ŸŸข NORMAL - All good
  • 25-50: ๐ŸŸก WATCH - Something's slightly off
  • 50-75: ๐ŸŸ  WARNING - Confirmed drift, pay attention
  • 75-100: ๐Ÿ”ด CRITICAL - Take action immediately

Drift Trend

  • โ†‘ RISING - Threat is increasing
  • โ†’ STABLE - No significant change
  • โ†“ FALLING - Returning to normal

Anomaly Categories

  • ๐Ÿง Loitering - Prolonged stationary activity
  • โš ๏ธ Intrusion - Boundary crossing detected
  • ๐Ÿ‘ฅ Crowd Formation - Unusual gathering
  • ๐ŸŒ€ Erratic Movement - Abnormal motion patterns
  • ๐ŸŽฏ Coordinated Activity - Synchronized movement
  • โšก Speed Anomaly - Unusual velocity
  • โ†ฉ๏ธ Direction Anomaly - Unusual direction pattern

๐Ÿ“ Project Structure

Noise_floor_project/
โ”œโ”€โ”€ ๐Ÿ“‚ dashboard/
โ”‚   โ””โ”€โ”€ app_main.py            # Main dashboard (USE THIS)
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ src/
โ”‚   โ”œโ”€โ”€ lstm_vae.py            # LSTM-VAE temporal model
โ”‚   โ”œโ”€โ”€ drift_intelligence.py  # TDI computation engine
โ”‚   โ”œโ”€โ”€ ensemble_detector.py   # Multi-model ensemble
โ”‚   โ”œโ”€โ”€ advanced_ai.py         # Anomaly classification
โ”‚   โ”œโ”€โ”€ risk_zones.py          # 4-tier zone classifier
โ”‚   โ”œโ”€โ”€ behavioral_features.py # 24 feature definitions
โ”‚   โ”œโ”€โ”€ video_features.py      # Real video processing
โ”‚   โ”œโ”€โ”€ explainability.py      # XAI attribution
โ”‚   โ”œโ”€โ”€ incident_logger.py     # Incident tracking
โ”‚   โ”œโ”€โ”€ feedback_system.py     # Human-in-the-loop
โ”‚   โ””โ”€โ”€ utils.py               # Utility functions
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ data/
โ”‚   โ””โ”€โ”€ UCSD_Anomaly_Dataset.v1p2/
โ”‚       โ”œโ”€โ”€ UCSDped1/
โ”‚       โ”‚   โ”œโ”€โ”€ Train/         # Normal pedestrian videos
โ”‚       โ”‚   โ””โ”€โ”€ Test/          # Contains anomalies
โ”‚       โ””โ”€โ”€ UCSDped2/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ incident_logs/          # Logged incidents
โ”œโ”€โ”€ ๐Ÿ“‚ feedback_data/          # Operator feedback logs
โ”œโ”€โ”€ ๐Ÿ“‚ baseline_data/          # Frozen baseline snapshots
โ”‚
โ”œโ”€โ”€ config.py                  # Configuration settings
โ”œโ”€โ”€ main.py                    # CLI entry point
โ”œโ”€โ”€ requirements.txt           # Python dependencies
โ””โ”€โ”€ README.md                  # This file

๐Ÿ”ฌ How It Works

Phase 1: Learning Normal Behavior

UCSD Train Data (Normal pedestrians)
    โ†’ Optical Flow Extraction
    โ†’ 24 Behavioral Features
    โ†’ LSTM-VAE Training
    โ†’ Ensemble Detector Fitting
    โ†’ Baseline Established โœ“

Phase 2: Monitoring & Detection

UCSD Test Data (Contains bikes, carts, etc.)
    โ†’ Feature Extraction
    โ†’ LSTM-VAE Inference
    โ†’ Ensemble Voting (IF, SVM, LOF)
    โ†’ Compute TDI
    โ†’ Classify Risk Zone
    โ†’ Classify Anomaly Type
    โ†’ Log Incident
    โ†’ Generate Explanation

Phase 3: Operator Response

Dashboard displays:
    โ†’ Current TDI (e.g., 67)
    โ†’ Risk Zone (๐ŸŸ  WARNING)
    โ†’ Trend (โ†‘ RISING)
    โ†’ Top Features causing drift
    โ†’ AI explanation
    
Operator can:
    โ†’ Acknowledge alert
    โ†’ Mark as false positive
    โ†’ Request investigation
    โ†’ Update baseline (human-gated)

๐ŸŽ“ System Philosophy

"Defense systems manage CONFIDENCE, not panic."

"AI assists operators, it does NOT replace them."

"Baseline adaptation is human-gated."

These three principles guide every design decision:

  1. Graduated Risk Zones - Reduce alert fatigue with progressive warnings
  2. Explainable AI - Operators understand WHY alerts occur
  3. Human-in-the-Loop - Critical decisions remain with humans
  4. Baseline Protection - Prevents adversarial manipulation

๐Ÿ“Š Dataset Information

UCSD Anomaly Detection Dataset

Used as proxy for border surveillance footage.

Subset Train Test Anomalies
Ped1 34 clips 36 clips Bikes, skateboards, carts
Ped2 16 clips 12 clips Bikes, skateboards

How we use it:

  • Train folder โ†’ Learn NORMAL pedestrian behavior
  • Test folder โ†’ Detect DRIFT when anomalies appear (labels ignored - unsupervised)

๐Ÿ› ๏ธ Technical Specifications

Component Specification
ML Model LSTM-VAE (Pure NumPy, no TensorFlow/PyTorch)
Features 24 behavioral metrics from optical flow
Latent Dim 8-dimensional latent space
Sequence Length 10 frames temporal window
Smoothing EWMA with ฮฑ=0.15
Technology Readiness TRL-4 (Lab Validated)

๐Ÿ”ง Configuration

Edit config.py to customize:

# Data source
DATA_MODE = "real_video"  # "synthetic" | "real_video"

# UCSD Dataset
UCSD_SUBSET = "ped1"      # "ped1" or "ped2"

# Baseline protection
BASELINE_FREEZE_CONFIG = {
    'learning_window': 200,
    'freeze_after_learning': True,
    'adaptation_learning_rate': 0.01,
}

๐Ÿค Use Cases

Domain Application
Border Security Detect infiltration patterns at perimeter fences
Airport Security Monitor crowd behavior at checkpoints
Critical Infrastructure Surveillance of power plants, data centers
Military Installations Base perimeter monitoring
Corporate Security Campus and facility protection

๐Ÿ“ˆ Performance Metrics

Metric Description
Detection Delay Frames between actual drift start and system detection
False Positive Rate Alerts during confirmed normal periods
Peak TDI Maximum threat deviation observed
Zone Transitions History of risk zone changes

๐Ÿ› Troubleshooting

Common Issues

1. "Dataset not found"

# Ensure UCSD dataset is in correct location:
data/UCSD_Anomaly_Dataset.v1p2/UCSDped1/Train/

2. "Module not found"

# Make sure virtual environment is activated
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt

3. "Streamlit not starting"

pip install streamlit --upgrade
streamlit run dashboard/app_pro_v2.py

๐Ÿ‘ฅ Team

  • Project: DRISHTI - Defense Intelligence System

๐Ÿ›ก๏ธ DRISHTI - Because early warning saves lives. ๐Ÿ›ก๏ธ

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%