This project implements a simple shape detection system using YOLOv8, Python, and OpenCV.
The model is trained to detect three geometric shapes: circle, square, and triangle, and can perform real-time detection using a webcam.
A synthetic dataset was created using generate_shape_dataset.py.
The script draws random shapes on plain backgrounds and generates YOLO-formatted labels automatically.
A data.yaml file specifies:
- Training and validation image paths
- Number of classes
- Class names
The YOLOv8-nano model (yolov8n.pt) was trained using train_shape_model.py.
Training outputs (metrics, graphs, and weights) are stored in runs/detect/.
Using the trained weights (best.pt), detect_shapes_live.py performs live shape detection through a webcam.
generate_shape_dataset.py # Synthetic dataset generator train_shape_model.py # YOLOv8 training script detect_shapes_live.py # Real-time detection script data.yaml # Dataset configuration results.png # Training metrics and graphs dataset/ # Generated dataset (train/val)
- Python
- YOLOv8 (Ultralytics)
- OpenCV
- NumPy
👉## Demo Video 👉 Click to Watch the Demo