Find the demo link here
This project implements object detection and motion analysis using the YOLOv8 model. It processes video files, images, and webcam streams to identify and track objects. The detections are logged into a SQLite database for further analysis.
- YOLOv8-based Object Detection: Detects and tracks objects in videos, images, and real-time webcam streams.
- Motion Analysis: Analyzes object movement across frames.
- Database Logging: Logs detected objects with timestamps and context.
- Video and Webcam Processing: Supports both file-based and real-time detection.
- Entry Zone Logging: Detects and logs objects entering specific zones.
- Database querying: Uses flash-2.0 for qureying db in nlp
|-- main.py # Entry point for running video and webcam processing
|-- object_detection.py # Handles YOLOv8-based detection and tracking
|-- motion_detection.py # Motion analysis and logging
|-- log_query.py # Queries and retrieves logs from SQLite database
|-- entry_zone_logger.py # Logs objects entering a defined entry zone
|-- yolov8n-pose.pt # Pre-trained YOLOv8 model files
|-- detection_log.db # SQLite database storing detected objects
|-- detection_log.txt # Log file storing object detections
|-- .env # Environment variables configuration
Ensure you have Python 3.8+ installed and set up a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtInstall necessary Python libraries:
pip install ultralytics numpy opencv-python sqlite3 python-dotenv- Open main.py
- set value of mode to either of
image,videoorwebcam - if image or video provide the file path in 'path' variable
python main.pypython main.py- Create a
.envfile in the root directory and enter:
API_KEY=your_google_genai_api_keyTo view logged detections from the database, run:
python log_query.py- Loading the Model
- YOLOv8 model is loaded from the
models/directory.
- YOLOv8 model is loaded from the
- Processing Video/Webcam
- Reads frames from a video file or webcam.
- Runs YOLOv8 detection on each frame.
- Tracking Objects
- Assigns unique IDs to detected objects.
- Tracks object movement across frames.
- Motion Analysis
- Compares positions between frames.
- Identifies entry/exit events.
- Entry Zone Detection (In different folder/Independent flow but same logic 1-4)
- Monitors and logs objects entering defined zones.
- Stores entry data in
detection_log.db.
- Logging Detections
- Stores detected objects in
detection_log.db. - Logs detection events in
detection_log.txt.
- Stores detected objects in
This README provides a structured guide for setting up and running the project.