Skip to content

ajithvcoder/Custom_Objectdetection_Yolov5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YoloV5 Custom Object training

Colab notebook - here

it is also available here

Steps for training

Data preparation

  • You can refer customim.zip file for data preparation
  • Download 30 images of two classes - 15 images for car and 15 images for flight
  • You can go to this site https://www.makesense.ai/ and upload all images
  • Now you can give the label names and then start annotation
  • click Actions-->Export annotations
  1. In colab notbook do the setup
  2. Upload data(customim.zip)(avaliable in this repo)/ custom data to colab and place it in "datasets" folder. Make like below tree structure
# Tree structure
datasets 
        ---->customim
                        --->images
                                  -->train
                                          -->001.jpg
                                          -->002.jpg
                                          ...
                        --->labels
                                  -->train
                                          -->001.txt
                                          -->002.txt
                                          ...
  1. Modify coco128.yaml file like below with path of custom dataset , number of classes and class names

coco128.yaml


# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: ../datasets/customim  # dataset root dir
train: images/train  # train images (relative to 'path') 128 images
val: images/train  # val images (relative to 'path') 128 images
test:  # test images (optional)

# Classes
nc: 2  # number of classes
names: [ 'car','flight' ]  # class names


  1. you can run the cell to train for 200 epochs
  2. Upload the test images or your own test images to colab
  3. Now you can provide the path of weights and test images to detect.py
!python detect.py --weights runs/train/exp5/weights/last.pt --img 640 --conf 0.25 --source test/

Results

img1 img1 img1 img1

About

Contains code to train custom images on Yolov5

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published