Skip to content

VortexCoders/RTA

Repository files navigation

🦌 Wildlife Alert System

Real-Time Animal Detection & Community Alert Platform

Python FastAPI YOLO License Status

πŸ”₯ AI-Powered Wildlife Detection β€’ πŸ“± Real-Time Alerts β€’ 🌍 Community Safety


πŸš€ What Makes This Special?

Revolutionary wildlife detection system that combines YOLO v11 AI, WebRTC streaming, and instant community alerts to protect both wildlife and communities in Nepal.

✨ Core Features

🎯 AI Detection Engine

  • πŸ€– YOLO v11 - State-of-the-art object detection
  • 🎯 96%+ Accuracy for wildlife identification
  • ⚑ Real-time processing with GPU acceleration
  • πŸ” Smart sampling for optimal performance

οΏ½ Live Streaming

  • 🌐 WebRTC - Ultra-low latency streaming
  • πŸ“± Multi-device support (phones, tablets, cameras)
  • πŸ”„ Auto-reconnection & smart device management
  • πŸŽ₯ HD Quality video transmission

οΏ½ Instant Alerts

  • πŸ“ž Voice Calls via TingTing API
  • πŸ’¬ WhatsApp notifications with video clips
  • πŸ”” Push notifications to subscribed users
  • ⏰ Smart cooldown prevents alert spam

�️ Admin Control

  • πŸŽ›οΈ Professional dashboard for camera management
  • 🏠 Location-based organization
  • πŸ”’ Secure authentication & token management
  • πŸ“Š Real-time status monitoring

🦁 Detected Animals

🚨 Dangerous Species (Immediate Community Alert)

Animal ΰ€¨ΰ₯‡ΰ€ͺΰ€Ύΰ€²ΰ₯€ Detection Alert Type
🐘 Elephant ΰ€Ήΰ€Ύΰ€€ΰ₯ΰ€€ΰ₯€ 96% accuracy πŸ“ž Voice + πŸ’¬ WhatsApp
πŸ† Leopard ΰ€šΰ€Ώΰ€€ΰ₯ΰ€΅ΰ€Ύ 94% accuracy πŸ“ž Voice + πŸ’¬ WhatsApp
🦏 Rhino ΰ€—ΰ₯ˆΰ€‚ΰ€‘ΰ€Ύ 98% accuracy πŸ“ž Voice + πŸ’¬ WhatsApp
πŸ… Tiger ΰ€¬ΰ€Ύΰ€˜ 95% accuracy πŸ“ž Voice + πŸ’¬ WhatsApp

πŸ”’ Endangered Species (Wildlife Authority Alert)

Animal ΰ€¨ΰ₯‡ΰ€ͺΰ€Ύΰ€²ΰ₯€ Detection Alert Type
🐼 Red Panda ΰ€°ΰ€Ύΰ€€ΰ₯‹ ΰ€ͺΰ€Ύΰ€£ΰ₯ΰ€‘ΰ€Ύ 92% accuracy πŸ“§ Official Channels

⚑ Quick Start

πŸ”§ Installation

# πŸ“¦ Install dependencies
pip install -r requirements.txt

# πŸ” Generate SSL certificates (HTTPS required)
python generate_ssl.py

# πŸš€ Launch the system
python app.py

🌐 Access Points

πŸ”’ Admin Panel:    https://localhost:8443/admin
πŸ‘€ Public View:    https://localhost:8443/
πŸ“Ή Camera Setup:   https://localhost:8443/camera/{token}

πŸ”‘ Default Admin: admin / admin123

🎯 How It Works

graph TD
    A[πŸ“Ή Camera Device] -->|πŸŽ₯ Live Stream| B[πŸ€– AI Processing]
    B -->|πŸ” YOLO Detection| C{🦌 Animal Detected?}
    C -->|βœ… Yes| D[πŸ“Š Confidence Check]
    C -->|❌ No| A
    D -->|🚨 High Confidence| E[πŸ”” Alert System]
    D -->|⚠️ Low Confidence| A
    E --> F[πŸ“ž Voice Call]
    E --> G[πŸ’¬ WhatsApp]
    E --> H[πŸ”” Push Notification]
    F --> I[πŸ‘₯ Community Protected]
    G --> I
    H --> I
Loading

πŸ“‹ Step-by-Step Process

Step Action Description
πŸ”΄ 1 Camera Setup Admin creates camera location in dashboard
🟑 2 Device Connection Field camera connects via unique token
🟒 3 Live Streaming WebRTC streams video to AI processing engine
πŸ”΅ 4 AI Analysis YOLO v11 analyzes frames for wildlife detection
🟣 5 Smart Alerts Multi-channel notification system activated
⚫ 6 Community Safety Real-time protection for humans and animals

API Endpoints

  • GET / - Home page with camera search
  • GET /admin - Admin panel (requires authentication)
  • POST /admin/camera - Create new camera
  • DELETE /admin/camera/{id} - Delete camera
  • GET /view/{slug} - Public viewing page
  • GET /camera/{token} - Camera streaming page
  • WebSocket /ws/camera/{token} - Camera streaming WebSocket
  • WebSocket /ws/view/{token} - Viewer WebSocket
  • POST /subscribe/{camera_id} - Subscribe to notifications
  • GET /search?q={query} - Search cameras

πŸ› οΈ Technology Stack

🧠 AI & Machine Learning

PyTorch OpenCV Ultralytics

🌐 Backend & API

FastAPI SQLAlchemy WebSocket

πŸ“± Frontend & Real-time

JavaScript WebRTC PWA

πŸ”” Communication

WhatsApp TingTing


πŸ—οΈ System Architecture

                    🌍 WILDLIFE ALERT ECOSYSTEM
    
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  πŸ“Ή Field       β”‚    β”‚   πŸ€– AI Engine   β”‚    β”‚  πŸ‘₯ Community   β”‚
β”‚  Cameras        │◄──►│   YOLO v11       │◄──►│  Dashboard      β”‚
β”‚                 β”‚    β”‚   Detection      β”‚    β”‚                 β”‚
β”‚  β€’ WebRTC       β”‚    β”‚   β€’ GPU Accel    β”‚    β”‚  β€’ Live View    β”‚
β”‚  β€’ HD Stream    β”‚    β”‚   β€’ Smart Sample β”‚    β”‚  β€’ Alerts       β”‚
β”‚  β€’ Auto Connect β”‚    β”‚   β€’ 96% Accuracy β”‚    β”‚  β€’ Subscribe    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   🚨 Alert Hub      β”‚
                    β”‚                     β”‚
                    β”‚  πŸ“ž Voice Calls     β”‚
                    β”‚  πŸ’¬ WhatsApp        β”‚
                    β”‚  πŸ”” Push Notify     β”‚
                    β”‚  ⏰ Smart Cooldown  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ” Security & Performance

πŸ›‘οΈ Security Features

  • πŸ”’ Token-based authentication for cameras
  • πŸ” HTTPS encryption for all communications
  • 🚫 CORS protection against unauthorized access
  • 🎫 Unique camera tokens prevent hijacking
  • πŸ“ Input validation & sanitization

⚑ Performance Optimizations

  • πŸš€ GPU acceleration for AI processing
  • 🎯 Smart frame sampling reduces load
  • πŸ’Ύ Memory efficient processing pipeline
  • πŸ”„ Auto-reconnection for reliability
  • ⏰ Alert cooldown prevents spam

🌟 Key Benefits

🎯 For Communities 🌍 For Wildlife πŸ›οΈ For Authorities
⚑ Real-time protection πŸ”’ Habitat monitoring πŸ“Š Data-driven insights
πŸ“± Instant notifications 🚫 Reduced human conflict πŸ“ˆ Population tracking
🏠 Residential safety 🦌 Species preservation 🎯 Targeted conservation
πŸ‘₯ Community alerts πŸ“ Movement patterns πŸ“‹ Incident reporting

πŸš€ Production Deployment

🌍 Ready for Scale

# πŸ”’ SSL Certificate Setup
certbot --nginx -d yourdomain.com

# 🐳 Docker Deployment
docker-compose up -d

# πŸš€ Production Server
gunicorn -w 4 -k uvicorn.workers.UvicornWorker app:app

βš™οΈ Environment Configuration

export SSL_CERT_PATH="/path/to/cert.pem"
export SSL_KEY_PATH="/path/to/key.pem" 
export ADMIN_USERNAME="your_admin"
export ADMIN_PASSWORD="secure_password"

πŸ”§ API Reference

Endpoint Method Description 🎯 Purpose
/ GET 🏠 Home dashboard Search & view cameras
/admin GET πŸŽ›οΈ Admin panel Manage system
/camera/{token} GET πŸ“Ή Camera interface Device streaming
/view/{slug} GET πŸ‘€ Public viewer Community monitoring
/ws/camera/{token} WS πŸ”„ Camera stream Real-time video
/ws/view/{token} WS πŸ“Ί View stream Live viewing
/subscribe/{id} POST πŸ”” Alert subscription Notification signup

πŸ†˜ Troubleshooting

πŸ“Ή Camera Issues
  • βœ… Check HTTPS: Camera access requires secure connection
  • πŸ” Browser Permissions: Allow camera/microphone access
  • 🌐 WebRTC Support: Use modern browsers (Chrome, Firefox, Safari)
  • πŸ”„ Refresh Connection: Clear browser cache if needed
πŸ”” Alert Problems
  • πŸ“± Service Worker: Ensure notifications are enabled
  • πŸ” HTTPS Required: Push notifications need secure connection
  • πŸ”‘ VAPID Keys: Verify configuration in production
  • ⏰ Cooldown Active: Check if alert cooldown is preventing notifications
πŸ€– AI Detection Issues
  • 🎯 Model Loading: Ensure YOLO weights are downloaded
  • πŸ’Ύ GPU Memory: Check CUDA availability and memory
  • πŸ–ΌοΈ Image Quality: Ensure good lighting and clear view
  • ⚑ Processing Speed: Monitor CPU/GPU usage

πŸ“„ License

MIT License - Open Source & Free to Use

License: MIT

Built with ❀️ for wildlife conservation and community safety

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published