Simple steps | Training Custom Datasets using YOLOv5| Fast & Easy

Опубликовано: 11 Февраль 2026
на канале: ViScode
866
20

This video describes simple steps to train custom datasets using the YOLOv5 model. The step by step process is explained below.

1. Prepare dataset:
In this video an Air view dataset is downloaded from roboflow. The dataset contains train, validation and test sets. Each set contains images and corresponding labels which can be downloaded in yolov5 format from the link below.

2. YOLOv5 model:
Download the yolov5 repo from the github repository. The download link is given below.

https://github.com/ultralytics/yolov5

YOLOv5 repo consists of different files and folders. Before starting, you can install all required packages using requirements.txt file which is available in the same repo.

3. Custom data file creation:
Create a custom data yaml file. In this video, the "custom_data.yaml" file is created. This yaml file is basically path details of train, test and validation images. Save this file into the data folder under the yolov5 repo.

4. Pretrained model:
Download yolov5 pretrained model, i.e., yolov5s.pt. Further you can check other pretrained models and download it from GitHub repo.

5. Training:
For custom dataset training, the train.py file is used . Open an anaconda command prompt and enter the path of yolov5 repo. To start training use the command line below.

"python train.py -- img "mention" --data custom_data.yaml -- batch-size "mention" --epochs " mention" --weights yolov5s.pt --device 0 ( in case you have cude GPU enabled else "cpu") --cache"

The training results will be stored into yolov5 repo under the folder "run". You can view the results in terms of confusion matics, PR Curves, Data distribution details, mAP, precision and recall of each class etc. The trained model will save in the path "run/train/exp/weights/best.pt"

6. Inference:
For the Inference test, you can use data from the test folder or open source data of the same trained classes. For Inference, a detect.py file is used which is available in the same yolov5 repo. To run the inference use the line below in the command prompt.
" python detect.py --weights run/train/exp/weights/best.pt --source " path of test images"

The inference results will be saved in the "run/detect/" folder.


Thank you for watching this video.

Please subscribe to this channel for AI/Computer Vision related codes in simple steps.



#objectdetection #yolov5 #yolo #python #pytorch #ml #ai #deeplearning #machinelearning #imageprocessing #computervision #visionsystem #nvidia #simplesteps #miniprojects #training #custom