A professional, enterprise-grade web application that uses YOLO (You Only Look Once) deep learning model to detect weapons in thermal images. Features modern UI/UX, real-time alerts, user authentication, and advanced analytics.
- Modern login/signup with beautiful animations
- Password strength validation with visual feedback
- Session management and secure authentication
- User roles and permissions
- Responsive design that works on all devices
- Smooth animations and micro-interactions
- Professional gradient backgrounds with floating elements
- Glass-morphism effects and modern typography
- Interactive dashboard with real-time updates
- Real-time weapon detection alerts with visual notifications
- Sound alerts with different tones for threat levels
- Pop-up notifications that auto-dismiss
- Alert acknowledgment and management system
- Critical threat detection with immediate notifications
- Real-time statistics and trend indicators
- Detection history with detailed results
- User analytics and performance metrics
- Interactive charts and data visualization
- Export capabilities for reports
- YOLO model integration with multiple loading methods
- Drag-and-drop image upload with preview
- Confidence scoring and detailed analysis
- Database logging of all detections
- Batch processing capabilities
- 🔥 Thermal Image Processing: Optimized for thermal imaging data
- 🎯 Real-time Detection: Fast weapon detection using YOLO model
- 📱 Responsive Web Interface: Modern, mobile-friendly UI
- 🖼️ Image Preview: Upload and preview images before detection
- 📊 Detailed Results: Confidence scores and bounding box visualization
- 🚀 Easy Integration: Simple Flask backend with REST API
SIH_FINAL/
├── app.py # Flask backend application
├── improved_weapon_detection_10_epochs.pt # Your trained YOLO model
├── requirements.txt # Python dependencies
├── README.md # This file
├── templates/
│ └── index.html # Main web interface
└── static/
├── style.css # CSS styling
└── script.js # JavaScript functionality
- Python 3.8 or higher
- pip (Python package installer)
- Your trained YOLO model file
Download this project to your local machine.
# Navigate to the project directory
cd SIH_FINAL
# Install required packages
pip install -r requirements.txtEnsure your improved_weapon_detection_10_epochs.pt file is in the project root directory.
# Run the Flask application
python app.pyThe application will start on http://localhost:5000
- Open your browser and navigate to
http://localhost:5000 - Upload an image by:
- Clicking the upload area and selecting a file
- Dragging and dropping an image onto the upload area
- Preview the image to ensure it's correct
- Click "Detect Weapons" to run the analysis
- View results with bounding boxes and confidence scores
Upload an image for weapon detection.
Request:
- Method: POST
- Content-Type: multipart/form-data
- Body: image file
Response:
{
"success": true,
"detections": [
{
"class": "weapon",
"confidence": 0.85,
"bbox": [100, 150, 200, 250]
}
],
"annotated_image": "base64_encoded_image",
"total_detections": 1
}Check application and model status.
Response:
{
"status": "healthy",
"model_loaded": true
}The application automatically loads your YOLO model on startup. If you need to modify model settings, edit the load_model() function in app.py.
- Maximum file size: 16MB
- Supported formats: JPG, PNG, GIF, BMP, TIFF
For better performance with large images:
- Resize images before upload
- Use GPU acceleration (if available)
- Adjust batch size in model configuration
-
Model Loading Error
- Ensure the model file exists and is valid
- Check Python and PyTorch versions compatibility
- Verify model file path in
app.py
-
Memory Issues
- Reduce image size before upload
- Close other applications to free memory
- Consider using a machine with more RAM
-
Detection Not Working
- Check if the model is properly trained
- Verify input image format and quality
- Ensure the model classes match your training data
Run the application in debug mode for detailed error messages:
python app.pyDebug mode is enabled by default in the provided code.
To add new weapon types or modify detection classes:
- Retrain your YOLO model with new classes
- Update the class names in the
postprocess_results()function - Modify the confidence threshold if needed
- Colors: Edit
static/style.cssto change the color scheme - Layout: Modify
templates/index.htmlfor different layouts - Functionality: Update
static/script.jsfor new features
- Model Loading: Modify
load_model()function - Preprocessing: Update
preprocess_image()function - Postprocessing: Change
postprocess_results()function
-
Image Optimization:
- Use appropriate image sizes (800x600 recommended)
- Compress images before upload
- Use standard formats (JPG, PNG)
-
Model Optimization:
- Use GPU acceleration if available
- Consider model quantization for faster inference
- Implement batch processing for multiple images
-
Server Optimization:
- Use a production WSGI server (Gunicorn, uWSGI)
- Implement caching for frequently accessed images
- Add load balancing for high traffic
- File Upload Security: The application validates file types and sizes
- Input Validation: All inputs are sanitized before processing
- Error Handling: Sensitive information is not exposed in error messages
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is for educational and research purposes. Please ensure compliance with local laws and regulations regarding weapon detection systems.
For issues and questions:
- Check the troubleshooting section
- Review the error logs in the console
- Ensure all dependencies are correctly installed
- Verify your model file is compatible
- Real-time video processing
- Batch image processing
- Advanced filtering options
- Export results to various formats
- User authentication and management
- Database integration for result storage
- Mobile app version
- API rate limiting and monitoring
Note: This system is designed for security and surveillance purposes. Always ensure compliance with local laws and regulations when deploying weapon detection systems.