The primary objective of this project is to develop a Weapon Detection System that can accurately identify whether an image contains a weapon or not. The system utilizes a Convolutional Neural Network (CNN) model for classification and is deployed using a Flask web application, providing an easy-to-use interface for end-users to upload images and receive detection results in real-time.
- ✅ Detects presence or absence of weapons in uploaded images
- 🧠 CNN-based custom model for high accuracy
- 💻 Flask-powered lightweight web application
- 📤 Image upload interface
- ⚡ Real-time prediction
- 📊 Clean and organized codebase for easy understanding
- 🧪 Easily extendable for video surveillance integration
- Model Type: Convolutional Neural Network (CNN)
- Input Shape: Preprocessed image (e.g., 128x128 or 224x224 pixels)
- Layers:
- Convolutional Layers
- Max Pooling Layers
- Flatten Layer
- Dense Layers
- Dropout Layer
- Output Layer with Softmax/Sigmoid Activation
- Output Classes: Weapon, No Weapon
- Loss Function: Binary Crossentropy
- Optimizer: Adam
- Metrics: Accuracy, Precision, Recall
- Gathered a dataset of images containing weapons and non-weapons.
- Preprocessed images: resizing, normalization, and augmentation.
- Split into training, testing and validation sets.
- Built and trained the CNN using TensorFlow/Keras.
- Evaluated performance using accuracy, precision, and recall.
- Saved the trained model using
model.save('weapon_detector.h5').
- Created a Flask application to serve the model.
- Users can upload an image via a simple UI.
- The server loads the saved model, processes the image, and returns prediction results.
- HTML form with file input for image upload.
- Display area to show image and classification result.
- Error handling for invalid files or upload issues.
git clone https://github.com/Jerry-britto/Weapon-Detection.git
cd Weapon-Detection/apppip install -r requirements.txtpython app.pyOpen your browser and go to: http://127.0.0.1:5000
- Open the web interface.
- Upload an image.
- Click the "Detect" button.
- Get prediction result: “Weapon Detected” or “No Weapon Detected”.
- Surveillance and security monitoring systems
- Crime prevention tools
- Restricted area monitoring (schools, airports, etc.)
- Law enforcement decision-support systems
- Integrate with live video feed for real-time detection
- Add bounding box localization for weapon in the image
- Implement confidence score display
- Deploy to cloud (AWS/GCP/Azure)
- Mobile app integration using APIs