This repository contains the code, trained model weights, dataset, and results for detecting various Indian traffic signs using the YOLOv8 object detection model provided by Ultralytics.
The primary goal of this project is to train an accurate object detection model capable of identifying and localizing various traffic signs commonly found on Indian roads from images or video streams.
-
Source: The dataset used is "Indian-Traffic-Signboards--5" obtained from Roboflow.
-
Format: YOLOv8 PyTorch TXT
-
Classes: 56 classes.
-
Contents: The
datasets2/folder contains the training, validation, and test splits along with thedata.yamlconfiguration file.
- Architecture: YOLOv8 (specifically
yolov8s.ptwas used as the base pre-trained model). - Training: The model was trained for 50 epochs on the provided dataset.
- Weights: The best-performing trained weights are located at
runs/detect/train2/weights/best.pt.
- Python (e.g., 3.10+)
- PyTorch
- Ultralytics YOLOv8 (version
8.0.196or similar used for training, potentially newer for inference/validation shown in logs) - Roboflow (for dataset sourcing/management)
- Google Colab (used for training and experimentation)
- NumPy, OpenCV-Python (as dependencies)
-
Clone the repository:
git clone https://github.com/[ns-0437]/[Traffic-Signal-Detection].git cd [Traffic-Signal-Detection] -
Set up environment (Recommended: Virtual Environment):
python -m venv venv # Activate the environment (Linux/macOS) source venv/bin/activate # Activate the environment (Windows) # venv\Scripts\activate
-
Install dependencies:
- Install PyTorch matching your system/CUDA version from the official PyTorch website.
- Install Ultralytics and other requirements:
pip install ultralytics==8.0.196 # Or the version you need/used pip install -r requirements.txt # Optional: Create a requirements.txt if needed
- (Alternatively, if running in Google Colab, necessary installations are likely handled within the notebook itself).
(Code examples assume you are running Python scripts or cells within a notebook where the ultralytics library is imported and the model is potentially loaded.)
The model was trained using a command similar to this (likely within a Python script or notebook):
from ultralytics import YOLO
# Load a pre-trained model (e.g., yolov8s.pt)
model = YOLO('yolov8s.pt')
# Train the model on the custom dataset
results = model.train(data='datasets2/Indian-Traffic-Signboards--5/data.yaml',
epochs=50,
imgsz=640,
# Add other relevant parameters used, e.g., batch, device etc.
)