This notebook explains custom training of YOLOv5 model for object detection in colab using the data from Google Drive. I am using "Traffic Signs Dataset" from kaggle which is already available in yolo format.
https://www.kaggle.com/valentynsichkar/traffic-signs-dataset-in-yolo-format This is ready to use Traffic Signs Dataset in YOLO format for Detection tasks. It can be used for training as well as for testing. Dataset consists of images in *.jpg format and *.txt files next to every image that have the same names as images files have. These *.txt files include annotations of bounding boxes of Traffic Sings in the YOLO format:
[Class Number] [center in x] [center in y] [Width] [Height]
For example, file 00001.txt includes three bounding boxes (each in a new line) that describe three Traffic Signs in 00001.jpg image:
2 0.7378676470588236 0.5125 0.030147058823529412 0.055
2 0.3044117647058823 0.65375 0.041176470588235294 0.0725
3 0.736764705882353 0.453125 0.04264705882352941 0.06875
Traffic signs in this Dataset are grouped into four categories:
- speed limit
- yield
- mandatory
- other
I have used Yolov5s for custome training with traffic sign data. I did training in Google colab by reading data from Google drive.
The notebook explains the below steps:
- Setting Up Google Colab
- Cloning The YOLOv5 repository
- Mounting Google Drive
- Create traffic_sign_data.yaml (dataset config file)
- Training Custom Traffic Sign Detector Model
- Evaluate Custom YOLOv5 Detector Performance
- Run Inference With Custom YOLOv5 Object Detector Trained Weights
After trainig Yolov5 on this dataset below are the some prediction results:
Original image from validation set:
Inference results on the above image using Yolov5 custome trained model:
Inference results on the video using Yolov5 custome trained model: