ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.84k stars 16.37k forks source link

Better understanding of each parameter #6507

Closed Juanjojr9 closed 2 years ago

Juanjojr9 commented 2 years ago

Search before asking

Question

Hello.

I tried to look for information about different parameters that can be used in train.py, val.py and detect.py, but I could not find information on some. I have tested activating each parameter, but I can't understand what they are for. Is there an article explaining what each is for?

I would like to understand each of them as well as possible and make the most of them. I am very interested in this topic

I do not know what these parameters are used for, i.e. what their functions are, nor do I know when I should use them. Also I have other questions about some of them

In the train.py file:

In the val.py file:

In the detect.py file:

I hope you can help me to solve this doubt.

Thank you very much for your help.

JJ

Additional

No response

glenn-jocher commented 2 years ago

@Juanjojr9 we are working on improved documentation, but for the time being you can see the help field in each argument for details. If you have doubts about arguments, always use the default value. https://github.com/ultralytics/yolov5/blob/4c409332667477560200958b513b958bb8fdef71/train.py#L453-L496

For --evolve see Hyperparameter Evolution tutorial below:

YOLOv5 Tutorials

Good luck 🍀 and let us know if you have any other questions!

Juanjojr9 commented 2 years ago

Hello @glenn-jocher, First of all, I would like to thank you for your response.

Currently, I'm doing my final project for graduation using YOLOv5. That's why I'm so interested in learning as much as I can, and in case I am asked by my tutor, to be able to answer in a coherent manner. I have read the help field in each argument, but it is not very detailed.

This is why I would like to know what each parameter does in a short form and I can defend myself

Any help is good.

JJ

glenn-jocher commented 2 years ago

@Juanjojr9 thanks for your feedback! We will try to improve the documentation going forward to explain arguments in greater detail. For now the help section is all that is available, and as I said before if you are unsure of an argument then there is no reason to modify it.

glenn-jocher commented 2 years ago

@Juanjojr9 also I've added our tips for best training here which explain a few concepts.

Most of the time good results can be obtained with no changes to the models or training settings, provided your dataset is sufficiently large and well labelled. If at first you don't get good results, there are steps you might be able to take to improve, but we always recommend users first train with all default settings before considering any changes. This helps establish a performance baseline and spot areas for improvement.

If you have questions about your training results we recommend you provide the maximum amount of information possible if you expect a helpful response, including results plots (train losses, val losses, P, R, mAP), PR curve, confusion matrix, training mosaics, test results and dataset statistics images such as labels.png. All of these are located in your project/name directory, typically yolov5/runs/train/exp.

We've put together a full guide for users looking to get the best results on their YOLOv5 trainings below.

Dataset

COCO Analysis

Model Selection

Larger models like YOLOv5x and YOLOv5x6 will produce better results in nearly all cases, but have more parameters, require more CUDA memory to train, and are slower to run. For mobile deployments we recommend YOLOv5s/m, for cloud deployments we recommend YOLOv5l/x. See our README table for a full comparison of all models.

YOLOv5 Models

Training Settings

Before modifying anything, first train with default settings to establish a performance baseline. A full list of train.py settings can be found in the train.py argparser.

Further Reading

If you'd like to know more a good place to start is Karpathy's 'Recipe for Training Neural Networks', which has great ideas for training that apply broadly across all ML domains: http://karpathy.github.io/2019/04/25/recipe/

Good luck 🍀 and let us know if you have any other questions!

Tautvydas-byte commented 2 years ago

Hello, could you explain what is translate: 0.1 # image translation (+/- fraction) and perspective: 0.0 # image perspective (+/- fraction), range 0-0.001. Does image translate means something what is written in this article Image-to-Image Translation: Methods and Applications https://arxiv.org/pdf/2101.08629.pdf and image perspective is something like https://www.geeksforgeeks.org/perspective-transformation-python-opencv/ ?

glenn-jocher commented 2 years ago

@Tautvydas-byte translation left-right or up-down

Reynolddoss commented 1 year ago

@glenn-jocher How would you suggest the retraining in the below case? I have trained a model with 30 classes but I had the training data for just 25 classes. Now I have the training data for 5 classes that were not included before. How can I retrain for this using the previously trained model? without using the previous data

bit-scientist commented 1 year ago

@Reynolddoss you must have your previous dataset whether you add or subtract from the first used dataset. You are dealing with the weights, they are updated in each iteration using gradient decent, so if you don't have a dataset of which you are planning to detect objects from, then there is no object in the first place.