📧 Project Description
This project implements a real-time pet detection, tracking, and notification system using the YOLOv8 deep learning model. Designed for monitoring cats and dogs, the system detects pets crossing a designated virtual boundary line in a video stream, counts their entries and exits, and sends automated email alerts with attached snapshots for verification.
By combining object detection, tracking, and event-triggered notifications, this system is ideal for pet owners who want to monitor indoor/outdoor movements of their pets or set up automated surveillance in specific areas.
🎯 Core Objectives
-
Detect and track pets in real time using a YOLOv8 model trained on cats and dogs.
-
Monitor directional movement (IN/OUT) across a virtual horizontal boundary.
-
Prevent duplicate counts using persistent object IDs and frame-based checks.
-
Automatically notify users via email with attached event snapshots.
-
Provide clear visual feedback with bounding boxes, labels, counts, and detection line.
✨ Key Features
-
✅ Real-Time Pet Detection: Identifies cats 🐱 and dogs 🐶 with bounding boxes and labels.
-
📏 Smart Line Crossing Detection: Counts pets only when crossing a defined horizontal line.
-
🔁 Direction-Aware Counting: Differentiates between entering (IN) and exiting (OUT).
-
🧠 Unique ID Tracking: Prevents double-counting by persisting track IDs.
-
🎨 On-Screen Overlay: Displays counts, bounding boxes, and a dashed detection line.
-
📩 Email Alerts: Sends event details with attached images when pets cross the line.
-
💾 Video Output: Saves the annotated video for later review.
🛠️ Technologies Used
| Component | Details |
|---|---|
| Language | Python 3.x |
| Model | YOLOv8 (best.pt – custom-trained on cats & dogs) |
| Libraries | ultralytics, OpenCV, NumPy, Typer, smtplib (for email) |
| Tracking | YOLOv8’s built-in .track() with ID persistence |
📌 Use Cases
-
🐾 Home Pet Monitoring: Track when cats or dogs go in/out of the house.
-
🚪 Doorway Monitoring: Detect pet entries/exits through specific access points.
-
📷 Automated Surveillance: Monitor fenced yards or designated zones.
-
🏠 Smart Home Integration: Trigger alarms, lights, or IoT devices when pets move.
🔮 Possible Enhancements
-
📈 Cloud Logging: Store event history in CSV files or cloud dashboards.
-
🔔 Custom Alerts: Send notifications via SMS, WhatsApp, or IoT platforms.
-
🧍 Multi-Class Support: Extend to other objects (people, cars, etc.).
-
🌐 Live Streaming: Remote access to video feed and alerts.
-
🖥️ GUI Dashboard: Build a user interface for easier control and monitoring.
✅ Conclusion
This Pet Detection & Smart Alert System offers a robust solution for monitoring pet movements in real time. By integrating YOLOv8 detection, tracking, and automated email alerts, it ensures both security and convenience for pet owners. Beyond pets, this framework can be adapted for people flow monitoring, retail analytics, and security surveillance — making it a versatile AI-powered monitoring solution.



Reviews
There are no reviews yet.