This repository contains a collection of scripts for training, converting, and running YOLO object detection models. It includes utilities for creating leaf color datasets (Green, Yellow, Brown), running real-time webcam/video detection, exporting to ONNX, and a full-featured Streamlit web application.
Ensure you have the required dependencies installed:
pip install ultralytics opencv-python numpy streamlit onnxruntimeTo train the YOLO model on your dataset, use the following command:
yolo detect train data=dataset/data.yaml model=yolov8n.pt epochs=100 imgsz=640 device=0A fast, cached web interface for testing YOLO models on webcams, videos, and images.
streamlit run streamlit_app.pyRun YOLO object detection on a video file or webcam stream.
# Run on webcam (default)
python yolo_video.py --model yolo11n.pt --source 0 --conf 0.8
# Run on a video file
python yolo_video.py --model yolo11n.pt --source test_video.mp4 --conf 0.5Captures frames and processes them concurrently using ThreadPoolExecutor for ONNX models.
python yolo_onx.pyCombines YOLO ONNX detection with a Kalman Filter-based SORT algorithm to track objects (like persons) across video frames.
python yoloon.pyExports a trained PyTorch model (.pt) to ONNX format.
python convert_onxx.pyConvert your image datasets into YOLO format.
Color-Based Segmentation (cv_yolo_convert.py)
Filters leaves by HSV ranges (Green, Yellow, Brown) and generates bounding box annotations.
python cv_yolo_convert.py --image_folder dataset/images/train --output_folder dataset/labels/train --showFull-Image Bounding Boxes (convert_to_yolo.py)
Treats entire images as single bounding boxes for classification-style YOLO training.
python convert_to_yolo.py --base_folder dataset/images/train --output_folder dataset/labels/train