The Active Alert System is a desktop application designed to detect various weapons using the YOLO (You Only Look Once) object detection model. Upon detection, it sends an emergency email with a screenshot of the detected object using the Gmail API. The application is designed to run on macOS, leveraging the power of Python, OpenCV, and machine learning models.
- Weapon Detection: Detects weapons such as grenades, guns, knives, pistols, handguns, and rifles using a trained YOLO model.
- Real-Time Monitoring: Continuously monitors the live camera feed and highlights detected weapons with bounding boxes.
- Emergency Email Notifications: Sends an emergency email with an attached screenshot whenever a weapon is detected.
- Screenshot and Thumbnail Management: Captures full-sized screenshots and creates thumbnails for quick viewing in the "Records" window.
- User-Friendly Interface: Offers a simple and intuitive UI with fullscreen capabilities.
- Python 3.7+
- pip (Python package manager)
-
Clone the repository:
git clone https://github.com/gurliv21/Active-Alert2.git cd active-alert-system
-
Install required dependencies:
pip install -r req.txt
-
Set up the environment variables:
- Create a
.env
file in the root directory. - Add your Gmail API key and Gmail user details in the following format:
API_KEY=your_gmail_api_key.json [email protected]
- Create a
-
Download the YOLO model:
- Ensure that
best.pt
(the trained YOLO model file) is placed in the root directory or specify the correct path in the code.
- Ensure that
-
Run the application:
python main.py
- Home: The default window displaying the main UI.
- Start Recording: Begins the real-time camera feed and weapon detection.
- Stop Recording: Stops the real-time monitoring and returns to the Home screen.
- Records: Displays thumbnails of detected weapons.
- About Us: Displays information about the application.
- Log out: Closes the application.
- Weapon Detection: The application uses the YOLO model to detect predefined classes of weapons. When a weapon is detected with a confidence level above 60%, it highlights the object in the video feed.
- Emergency Alert: A screenshot of the detected weapon is captured and sent as an attachment via email using the Gmail API.
- Thumbnails: For each detection, a smaller thumbnail is created and displayed in the "Records" window for quick review.
-
Python
-
OpenCV: For real-time video processing.
-
YOLO: For object detection.
-
Gmail API: For sending email notifications.
-
Tkinter: For the graphical user interface.