Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bar Detection and Conveyor Movement Monitoring

This project uses YOLOv8 to detect metal bars on a conveyor belt and monitor if the conveyor has stopped moving. It provides visual alerts when the conveyor is halted.

Features

  • Real-time metal bar detection using YOLOv8
  • Conveyor belt movement monitoring
  • Visual alerts for conveyor stoppages
  • Works with both video files and live camera feeds

Project Structure

├── model/
│   └── best.pt        # YOLOv8 trained model
├── assets/
│   └── conv.mp4       # Sample video for testing
├── main.py            # Main application file
├── requirements.txt   # Python dependencies
├── .gitignore         # Git ignore file
└── README.md          # Project documentation

Requirements

  • Python 3.8+
  • OpenCV
  • Ultralytics YOLOv8
  • NumPy

Setup

Virtual Environment Setup

  1. Create a virtual environment:
# Windows
python -m venv venv

# Linux/macOS
python3 -m venv venv
  1. Activate the virtual environment:
# Windows
venv\Scripts\activate

# Linux/macOS
source venv/bin/activate
  1. Install the required packages:
pip install -r requirements.txt

Usage

  1. Run the application:
python main.py
  1. Configuration Options:

The following settings can be modified in main.py:

Parameter Description
model_path Path to your YOLOv8 model
video_path Path to video file or camera index
output_path Path to save the output video
stop_threshold Number of frames to determine if conveyor is stopped
movement_tolerance Pixel tolerance for movement detection
  1. For live camera detection:
    • Uncomment the line # video_path = 0 in the configuration section

How It Works

  1. Object Detection: The system uses a pre-trained YOLOv8 model to detect metal bars in each frame.

  2. Movement Tracking: For each detected bar, the system tracks its centroid position across frames.

  3. Stop Detection: The system calculates the average movement of all tracked objects between consecutive frames:

    • If movement falls below the movement_tolerance threshold, a counter is incremented
    • When the counter exceeds the stop_threshold, the conveyor is considered stopped
  4. Visual Alerts:

    • Detected bars are highlighted with yellow rectangles
    • "OK" (green) indicates the conveyor is running normally
    • "Conveyor Halted" (red) warning appears when the system detects a stoppage

About

This project uses YOLOv8 to detect metal bars on a conveyor belt and monitor if the conveyor has stopped moving. It provides visual alerts when the conveyor is halted.

Topics

Resources

Stars

Watchers

Forks

Used by

Contributors

Languages