Skip to content

Using Yolov5 to train and deploy your custom models, aims to Object detection. In this respository, data preprocessing and preparing datasets is done automatically, and dataset format conversion (pascal voc => yolo) scripts are provided.

Notifications You must be signed in to change notification settings

icexiaoyou/Yolov5-Object-Detection

Repository files navigation

中文教程:
[BLOG] https://www.steamforfun.cn/?p=413
[CSDN] http://t.csdn.cn/8ZSka

@[TOC](Yolov5 Object Detection)

1. Description

Object Detaction by pytorch, yolov5 and opencv. This project uses yolov5 to train a custom model. The project has the following functions.

1.1. Yolov5 Offline Full Folder

Thanks to my idol ultralytics, yolov5 makes AI more easier. This project is based on yolov5, here is Yolov5 officail github webside. https://github.com/ultralytics/yolov5 After download this repository, yolov5.pt have been download in 'yolov5' so you could use five different pre-tained model to generate a custom model offline.

1.2. WorkSpace Introduction

The directory also includes two parts, which this project calls the workspace.

The first part consists of three folders, named datasets, voc_dataset and yolo_dataset.
datasets: the final storage location of the custom dataset
voc_dataset: the storage location of pascal voc dataset
yolo_dataset: the storage location of yolo dataset [temporary]

The second part consists of four scrpit, named test_installation.py, preprocess.py, voc_to_yolo.py and data_split.py. Full comments are in every python script.

2. Preparation

2.1. Install Visual Studio Community 2022

Install the item named "C++ for Desktop Development".

2.2. Install Anaconda

// Run Anaconda Prompt, coding...
conda create -n pytorch python>3.8
activate tensorflow
pip install pytorch
pip install labelImg
pip install opencv-python
pip install pillow
pip install shutil
pip install xml
pip install yaml
pip install json
pip install glob

3. Usage

  1. [Optional] Test the installation of yolov5 environment, please run "test_installation.py".
  2. [Optional] Put images in folder named "voc_dataset", subfolders named "classes_index".
  3. Run "preprocess.py" to rename and resize the images.
  4. Run labelImg to annotate all the images.
  5. [Optional] Run "voc_to_yolo.py", transform your dataset from pascal voc format to yolo format.
  6. Run "data_split.py" to split yolo_dataset, generate train, valid and test dataset. In addition, you could enter "Y/N" to Confirm whether to generate final dataset and move to 'datasets'.
  7. Follow yolov5 officail guidence to train and deploy your custom model.

4. FlowChart

在这里插入图片描述

About

Using Yolov5 to train and deploy your custom models, aims to Object detection. In this respository, data preprocessing and preparing datasets is done automatically, and dataset format conversion (pascal voc => yolo) scripts are provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages