Coder Social home page Coder Social logo

yolov5_on_colab's Introduction

yolov5_on_Colab

Instructions for running Yolov5 on a dataset on Google Colab.

Step 1- Only if you need to convert from VOC XML to yolo format

Go to desired directory and type:

git clone https://github.com/i3drobotics/Convert-VOC-to-YOLO.git

Load images and the VOC XML to the images folder.

Open "convert_voc_to_yolo.py" and change the classes in line 9 to those you are using.

Running the "convert_voc_to_yolo.py" script will produce a folder in the "images" directory with a folder called "yolo" consisting of files in the yolo format.

Step 2- Open the Colab notebook

Go to https://colab.research.google.com/drive/1Ihs30PoTJJSfVXH7hup0Jd9eOIvv0xfz?usp=sharing

This will open the Colab notebook template. Save a copy of the notebook in your google drive and rename.

Step 3- Mount your Google drive, set up the environment and clone the YOLOv5 repository

Run the first three cells to allow for the mounting of the Google drive, setting up the environment and cloning the YOLOv5 repository

Step 4- Download config files

Run the fourth cell to download the clothing.yaml file and the yolov5x.yaml config files. Download the “clothing.yaml” file from the “yolov5/data/” folder

Step 5- Edit config files

Edit yaml file Change the “train” and “val” paths to desired names. Change “names” to your desired classes. An example yaml file for tools should look like: alt text

Save the yaml file with the desired name and upload it back to “data” folder on colabs.

Download the model config file you wish to use from the models directory. The following shows an example of “yolov5x.yaml” file. Edit "nc" in line 2 to correlate with the number of classes in the first config file. Upload this file back to the models directory on Google Colab.

Step 6- Upload images

Create two directories- one called "images" and one called "labels". Create two directories called "train" and "val" in both the "images" and "labels" directories. Place the training and validation images and training and validation labels in the corresponding directories.

Upload these to the ml_yolo folder. Once this is completed, the folder structure should look like the following: alt text

Step 7- Train the model

run the “Run the training” cell. It is reccommended that this is initially run for 30 epochs to ensure that everything is working correctly. This should increase to 1000's for a more accurate model.

Step 8- Detect

Once the taining is finished, move the best_yolo weights model from the "run/exp...../ weights" folder to the "weights" folder and rename the file "yolov5x_tools.pt" Upload images to the yolov5/inference/images folder. run the "Run detection" cell. The output will display the detected objects. THe images with detection will also be displayed in the yolov5/inference/output folder

yolov5_on_colab's People

Contributors

bcrutchleyi3dr avatar

Stargazers

Jorge Fuentes avatar

Watchers

James Cloos avatar Jorge Fuentes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.