ultralytics / yolov5

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

Architecture Understanding #990

Closed JiaLim98 closed 3 years ago

JiaLim98 commented 3 years ago

❔Question

Hi @glenn-jocher,

May I know the meaning of each of these parameters of the backbone and head inside the .yaml file? Also there are three integers in front of "Concat", what is the meaning of these values? image

Many thanks, JiaLim98

seekFire commented 3 years ago

@JiaLim98 I think you may find the answer by reading the code in models/yolo.py

lucasjinreal commented 3 years ago

@JiaLim98 https://github.com/jinfagang/nb this lib provide a more intuitive way to build yolov5 model architecture, you can read about it:

image

glenn-jocher commented 3 years ago

@JiaLim98 the YOLOv5 model yamls are very simple. The columns are just as shown in the comments:

JiaLim98 commented 3 years ago

@glenn-jocher @jinfagang @seekFire Thank you all for the help. I will leave this thread open for a while, I may have further questions or anyone who needs the understanding of the architecture can use this thread as well. Cheers!

JiaLim98 commented 3 years ago

Hi @glenn-jocher,

Previously I have succesfully changed the .yaml file and completed the training. However, now that I want to test the weights, I get the following error: WhatsApp Image 2020-10-07 at 12 42 54 PM It seems like test.py is not using the modified .yaml file I used for training. Are there any parts of the code need to be changed when one wants to modify the architecture besides the .yaml file?

Cheers, JiaLim98

glenn-jocher commented 3 years ago

@JiaLim98 model yaml files are only used to construct a model initially before training starts. test.py and detect.py do not require any model.yaml. The model.pt file is fully self contained, nothing else is required.

This is one of the major advancements we implemented when moving from YOLOv3.

JiaLim98 commented 3 years ago

@glenn-jocher In that case, can you let me know are there any other causes to this problem? Training completed perfectly, but there's problem with the feature processing during testing.

glenn-jocher commented 3 years ago

@JiaLim98 if your model trains then it will test and detect normally as well. It's possible changes you've made to the repo are the cause of the error.

It looks like your code may also be a bit out of date, you might want to simply reclone the repo and try your new yaml again.

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

PraveenMNaik commented 2 years ago

How to edit the backbone field in "*.yaml" file, and how to include other architecture into backbone into the file named yolov5l.yaml' ....for example: by default the backbone architecture for yolov5 is "densenet", if i want to include some other architecture, how to include... pls help

PraveenMNaik commented 2 years ago

Sir, how to write configuration file for yolov5... yolov5 doens't have configuration file ... but instead has .yaml file....pls help

PraveenMNaik commented 2 years ago

what is the output of the package use... ayaml file?

glenn-jocher commented 2 years ago

@PraveenMNaik models are defined in model yamls, i.e.: https://github.com/ultralytics/yolov5/blob/303f3785ae0fe8e8fff1eedebe25ec516a1baab1/models/yolov5s.yaml#L3-L48

PraveenMNaik commented 2 years ago

Sir,

  1. how to write custom models, you have any tutorials ?
  2. currently yolo used 'CSP darknet' as backbone, if i want to use efficientnet or mobile net, how to include in the backbone or in yaml file,,, or somewhere else....bcz earlier it used to be defined in .cfg file,
glenn-jocher commented 2 years ago

@PraveenMNaik models are defined in model yamls, i.e.: https://github.com/ultralytics/yolov5/blob/303f3785ae0fe8e8fff1eedebe25ec516a1baab1/models/yolov5s.yaml#L3-L48

You can customize a model yaml to any architecture you'd like and use any new modules you'd like by defining them in models/common.py

PraveenMNaik commented 2 years ago

@glenn-jocher , Sir where is the module defined for "Conv", [[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2 [-1, 1, Conv, [128, 3, 2]], # 1-P2/4 .... how to understand this... why neck is not defined.... how does connection from Backbone to head happens in this module....

PraveenMNaik commented 2 years ago

@glenn-jocher sir does, --evolve used for tuning hyperparameter....if so... why dont we use said method first ...based on the result update the hyperparameter file and then go for training.. is it better approach

glenn-jocher commented 2 years ago

@PraveenMNaik models are in models/common.py: https://github.com/ultralytics/yolov5/blob/34df5032a7d2e83fe3d16770a03bd129b115d184/models/common.py#L38-L51

PraveenMNaik commented 2 years ago

@PraveenMNaik models are in models/common.py:

https://github.com/ultralytics/yolov5/blob/34df5032a7d2e83fe3d16770a03bd129b115d184/models/common.py#L38-L51

Sir, where is the definition for nn.SiLu (activation function)

glenn-jocher commented 2 years ago

https://pytorch.org/docs/stable/generated/torch.nn.SiLU.html

AdnanMunir294 commented 10 months ago

Hi. I have a question. if I want to modify the Yolov5 architecture, then I have to change only the Yolov5l.yaml file or do I also have to change any coding stuff? Please respond thanks

glenn-jocher commented 10 months ago

@AdnanMunir294 hi there,

To modify the YOLOv5 architecture, you will need to make changes to both the yolov5l.yaml file and the code implementation. The yolov5l.yaml file defines the architecture configuration, including the backbone and head structure, while the code implementation in the YOLOv5 repository (models/...py files) handles the actual execution of the architecture.

Therefore, to effectively modify the architecture, you will need to ensure that both the configuration in the yaml file and the corresponding code implementation are updated accordingly.

Feel free to reach out if you have any further questions or need additional assistance.

Thanks!