NETRA-AI_Video_Surveillance_Web_Application / docs /QUICK_START_BOUNDING_BOXES.md
itsluckysharma01's picture
Upload 39 files
cb3c674 verified

Quick Start: Bounding Boxes & Analysis Models

🎯 What's New

1. Green Bounding Boxes Around Persons

  • Visual: Green rectangles around each detected person
  • Label: "Person" + confidence score (e.g., "Person 0.95")
  • Real-time: Updates as persons move in frame

2. Advanced Analysis Models

  • Fight Detection: Identifies physical conflicts
  • Behavior Analysis: Analyzes suspicious activities
  • Models: Located in ai_models/analysis_models/

3. Enhanced Detection Tracking

  • Bounding Box Data: Stored in database
  • Coordinates: x1, y1, x2, y2 for each person
  • Confidence: Detection confidence per person

πŸš€ How to Use

Enable Bounding Box Detection

  1. Go to Live Camera page
  2. Click "πŸ€– Select Detection Models"
  3. Check:
    • βœ… Object Detection (for person detection)
    • βœ… Advanced Analysis (for fight/behavior analysis)
  4. Click "βš™οΈ Apply Selection"
  5. Click "▢️ Start Camera"
  6. Green boxes appear! πŸ“¦

View Bounding Box Data

  • Live Display: Green boxes on camera feed
  • Statistics: Person detection count updates in real-time
  • Database: All detections stored with coordinates

πŸ“Š Model Details

Model Description Location
YOLO Person/object detection object_detection/yolov8n.pt
Fight Detection Identifies fights analysis_models/fight_detection_model.h5
CustomCNN Behavior analysis analysis_models/CustomCNN*.h5

🎨 Visual Elements

Bounding Box Format

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Person 0.95                     β”‚  ← Label with confidence
β”‚                                 β”‚
β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚    β”‚                      β”‚    β”‚
β”‚    β”‚    [Person in]       β”‚    β”‚  ← Green box (detected person)
β”‚    β”‚                      β”‚    β”‚
β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Statistics Display

πŸ‘€ Person Detected: 5          ← Total persons detected
πŸ‘οΈ Person Present: βœ… Yes      ← Currently present

πŸ’Ύ Database Storage

Each detection includes:

  • person_count: How many people detected
  • confidence: Average confidence score
  • bounding_boxes: Coordinates for each person
  • timestamp: When detection occurred

πŸ”§ Configuration

Enable in Model Config

File: config/model_config.py

'analysis': {
    'candidates': [
        MODELS_DIR / "analysis_models" / "fight_detection_model.h5",
        MODELS_DIR / "analysis_models" / "CustomCNN150.h5",
    ],
    'description': 'Advanced Analysis Model (Fight/Behavior Detection)'
}

Load in App

File: app.py

from tensorflow import keras
analysis_model = keras.models.load_model(model_path)

πŸ“ Code Examples

Using Bounding Box Data

Frontend (JavaScript):

// Record person detection with bounding boxes
recordPersonDetection([
    {
        class: 'person',
        confidence: 0.95,
        bbox: [100, 50, 200, 300]
    }
]);

Backend (Python):

# Draw bounding boxes
video_processor._draw_person_bounding_boxes(frame, detections)

# Results include bbox data
for det in detections:
    if det['class'] == 'person':
        x1, y1, x2, y2 = det['bbox']
        confidence = det['confidence']

βœ… Verification Checklist

  • Models loaded successfully (check console)
  • "Advanced Analysis" appears in model selection
  • Bounding boxes visible on camera feed
  • Person detection count increasing
  • Database storing coordinates
  • Statistics updating in real-time

πŸ› Troubleshooting

Issue Solution
No bounding boxes Enable "Object Detection" model
Analysis model error Install TensorFlow: pip install tensorflow
Database not saving Check user is logged in
Slow performance Reduce frame resolution or skip frames

πŸ“š Full Documentation

See detailed documentation:

  • Full Guide: docs/BOUNDING_BOXES_AND_ANALYSIS_MODELS.md
  • Person Detection: docs/PERSON_DETECTION_FEATURE.md
  • Frontend: docs/FRONTEND_ENHANCEMENTS.md

Ready to detect! 🎯