TRAFFIC SIGNS RECOGNITION USING THE YOLO ALGORITHM

306497416

How to implement the identification of traffic signs From labeling to training using Google Colaboratory and Yolov5

FIRST STEP: GATHERING DATASET

in the first step, I downloaded the information I needed, to create my dataset from photos of the following address. https://www.mapillary.com/dataset/trafficsign

I used the labelimg tool to label my photos

SECOND STEP: USING LABELIMG

To use labelimg, we must first install it, which is easily done with the following command (windows cmd ) : pip install labelimg After installing the labelimg we must open it, but there is one thing that can make using labelimg much easier. classifying your files before opening labelimg for example, in this project, we have 10 classes, so at first, we create a text file and write our classes in it like this:

  • Sign_No_Stopping
  • Sign_Stop
  • Sign_No_parking
  • Sign_No_Entry
  • Sign_Bend_To_Right
  • Sign_crossing
  • Sign_Give_way
  • Sign_Turn_left
  • Sign_bump
  • Sign_No_Overtaking

You can downoad my labeled dataset using the link below

https://drive.google.com/file/d/1iQwsS8R8Me4TyuvDYpcPrpJ12yxNwyVi/view?usp=sharing

Now we can open labelimg using this command: Labelimg <images directory> <classes.txt directory>

there are two things that we must consider while using labelimg first, make sure you've selected the YOLO and the second, to save txt file after labeling image

After labeling all our files we should split them into three root folders: Train, val (valid), test And in each folder, we must separate labels (text files) and images After reviewing nearly 7,000 random images, I collected about 1,000 labeled images for use in my train, valid, and test. when data collection is done, we must zip all three files and upload them to Google Drive to be able to reach them using Google Colaboratory.

THIRD STEP: GOOGLE COLABORATORY

In the Google Colab environment, we need to do the following actions
image

The command will install the dependencies

After installing the dependencies we must install GPU use image

After doing the above steps, a folder named yolov5 should be created in the files section image

To examine what kind of GPU has been allocated for us, we can use the following command image

Now we must mount our Google Drive account to Google colab image

To access our images file we should unzip it in colab using !unzip command

Do not forget to create the yaml file as well To create this file, we can create a YAML file in our system using Notepad and then change its format to .yaml The file must contain the number of classes, class names, and the address of the val and train folder

Yaml requirements are listed in ipynb files

The most important part is here training with following code we start the training image

after 7 hours of training, I faced this error

image

so I switched to another account and did the rest of the training there As I had saved the checkpoints I resumed the training from where it had stopped with the following command

image

when training is done we can see the Tensorboard using the following command image

image

Output:

image image image image

output.mp4

Welcome_To_Colaboratory (0) = Googlecolab environment code before gpu limit expires Welcome_To_Colaboratory = Googlecolab environment code after changing account exp = Output test files

TODO

  • Gather DataSet
  • #739 Install labelimg
  • Label your images
  • Upload your DataSet to Google Drive
  • Mount your Google drive account with your Google colab account
  • Unzip your files
  • Train...

Thanks for your attention