# Basic doubt regarding "training" of a YOLO model

So I have just recently started exploring machine learning, and for a project I was required to train the YOLO v5 model. I first tried it on the coco128 dataset:https://www.kaggle.com/ultralytics/coco128..

repository of the yolo v5: https://github.com/ultralytics/yolov5

I followed this tutorial: https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data step by step and managed to train the model succesfully, it is detecting objects as I intended it to do.

I wanted to have a very basic overview an what is basically happening when we are "training" the model.

The command used for training was:

python train.py --img 640 --batch 16 --epochs 5 --data coco128.yaml --weights yolov5s.pt


From what I understand, this tells the command line to run the file "train.py" (which uses argeparse library) with the following arguments: 640 (image size), 16 (batch size for batch gradient descent), 5 (no. of epochs), coco128.yaml (the config file), and yolov5s.pt (the weights file).

Doubts

• The tutorial mentions that the weights are pretrained. This is confusing me because I thought the entire objective of "training" a model is to find the correct weights for the parameters. If the weights are already supplied, what exactly is the training achieving? It has been fed a bunch of images along with the labels for the bounding boxes for that images. What does it do with these images and labels to become capable of predicting objects?
• The coco128.yaml mentions a path for the "validation" folder. What exactly is a "validation" folder used for?
• when you say image size, does 640 mean 640 pixels X 640 pixels? Or 640 images? Jun 7, 2021 at 11:39

About Pre-trained model : This is a very common practise (especially in image recognition) and here is how we use it.

We call this fine-tuning the model, it is basically using a complicated network that would be way too heavy to train because the dataset is not big enough, and just adjusting it so it performs our specialized task.

In your tutorial, the dataset Coco128 is made of 128 images, which is not enough for the training of a model as big as YOLOv5. So you use the pretrained weights and fine-tune it with your dataset. As far I as understand, the objective of the tutorial is to see how the model overfits these 128 images.

About validation, we usually splits datasets into 3 parts :

1. Training set : used to train the models. (~80% dataset)
2. Testing set : used to test the trained models, this part is the one used to estimate the accuracy of the model. (~15% dataset)
3. Validation set : used at the very end, to validate the fact that our model works correctly. (~5% dataset)

In many cases, Testing and validation datasets are the same (because validation dataset often is not necessary).

In your tutorial, what they call validation set is what I usually call the testing dataset, and it is the same as the training set, so bascially all your sets are the same. (it is very very very uncommon to do so, but since the goal of the tutorial is to see how we overfit this set, it makes sense here).