This application uses YOLOv5 for weapon detection and Haar Cascade for facial recognition, capturing webcam feeds to detect threats. It sends real-time email alerts and logs events with timestamps and locations to enhance public safety.
This project aims to enhance public safety by developing a real-time weapon detection and facial recognition system. Utilizing YOLOv5 for weapon detection and a Haar Cascade model for facial recognition, this application is designed to monitor webcam feeds, detect weapons and faces, and send real-time alerts. Alerts are also logged with timestamps and locations in a CSV file.
Clone the Repository
git clone https://github.com/yourusername/weapon-detection-facial-recognition.git
cd weapon-detection-facial-recognition
Set Up Environment
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
Install Dependencies
pip install -r requirements.txt
Download YOLOv5 and Haar Cascade Models
YOLOv5: Clone the YOLOv5 repository into your project directory:
git clone https://github.com/ultralytics/yolov5.git
Haar Cascade: Download the Haar Cascade XML file from the OpenCV repository or use the one provided in the models
directory.
Configure Email Alerts
Update the config.py
file with your Gmail credentials and other configuration details:
EMAIL_ADDRESS = 'your-email@gmail.com'
EMAIL_PASSWORD = 'your-password'
Run the Application
CSV FILE.py
Stop the Application
The application can be terminated manually or based on elapsed time.
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
Disclaimer: This project is for educational and research purposes only. Ensure to comply with all local laws and regulations related to surveillance and privacy.