Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about YOLOv5l6! #4189

Closed
zcswdt opened this issue Jul 28, 2021 · 10 comments
Closed

about YOLOv5l6! #4189

zcswdt opened this issue Jul 28, 2021 · 10 comments
Labels
question Further information is requested Stale

Comments

@zcswdt
Copy link

zcswdt commented Jul 28, 2021

❔Question

How does YOLOv5l6 train? What is the difference between it and Yolov5l?

Additional context

@zcswdt zcswdt added the question Further information is requested label Jul 28, 2021
@glenn-jocher
Copy link
Member

@zcswdt training P6 models is super easy:

python train.py --weights yolov5l6.pt

See release notes for details:

This release implements YOLOv5-P6 models and retrained YOLOv5-P5 models. All model sizes YOLOv5s/m/l/x are now available in both P5 and P6 architectures:

  • YOLOv5-P5 models (same architecture as v4.0 release): 3 output layers P3, P4, P5 at strides 8, 16, 32, trained at --img 640
python detect.py --weights yolov5s.pt  # P5 models
                           yolov5m.pt
                           yolov5l.pt
                           yolov5x.pt
  • YOLOv5-P6 models: 4 output layers P3, P4, P5, P6 at strides 8, 16, 32, 64 trained at --img 1280
python detect.py --weights yolov5s6.pt  # P6 models
                           yolov5m6.pt
                           yolov5l6.pt
                           yolov5x6.pt

Example usage:

# Command Line
python detect.py --weights yolov5m.pt --img 640  # P5 model at 640
python detect.py --weights yolov5m6.pt --img 640  # P6 model at 640
python detect.py --weights yolov5m6.pt --img 1280  # P6 model at 1280
# PyTorch Hub
model = torch.hub.load('ultralytics/yolov5', 'yolov5m6')  #  P6 model
results = model(imgs, size=1280)  # inference at 1280

@github-actions
Copy link
Contributor

github-actions bot commented Aug 28, 2021

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!

@MyraBaba
Copy link

MyraBaba commented May 1, 2022

@glenn-jocher Hi

is there any pretrained yolo5l6 , yolo5m6 models that we can download?

@glenn-jocher
Copy link
Member

glenn-jocher commented May 1, 2022

@MyraBaba 👋 Hello! Thanks for asking about downloading weights. All official YOLOv5 🚀 pretrained models including P6 models are available to download directly under the latest release in the 'Assets' section, i.e.:
https://github.com/ultralytics/yolov5/releases/tag/v6.1

Screen Shot 2022-05-01 at 11 48 44 AM

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

@MyraBaba
Copy link

MyraBaba commented May 1, 2022

@glenn-jocher wow its good news .

Is it straightforward to convert these to onnx ? Dowe need a special treament? any script

Best

@glenn-jocher
Copy link
Member

glenn-jocher commented May 1, 2022

@MyraBaba see Export tutorial for details:

YOLOv5 Tutorials

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

@farahathaya
Copy link

@zcswdt training P6 models is super easy:

python train.py --weights yolov5l6.pt

See release notes for details:

This release implements YOLOv5-P6 models and retrained YOLOv5-P5 models. All model sizes YOLOv5s/m/l/x are now available in both P5 and P6 architectures:

  • YOLOv5-P5 models (same architecture as v4.0 release): 3 output layers P3, P4, P5 at strides 8, 16, 32, trained at --img 640
python detect.py --weights yolov5s.pt  # P5 models
                           yolov5m.pt
                           yolov5l.pt
                           yolov5x.pt
  • YOLOv5-P6 models: 4 output layers P3, P4, P5, P6 at strides 8, 16, 32, 64 trained at --img 1280
python detect.py --weights yolov5s6.pt  # P6 models
                           yolov5m6.pt
                           yolov5l6.pt
                           yolov5x6.pt

Example usage:

# Command Line
python detect.py --weights yolov5m.pt --img 640  # P5 model at 640
python detect.py --weights yolov5m6.pt --img 640  # P6 model at 640
python detect.py --weights yolov5m6.pt --img 1280  # P6 model at 1280
# PyTorch Hub
model = torch.hub.load('ultralytics/yolov5', 'yolov5m6')  #  P6 model
results = model(imgs, size=1280)  # inference at 1280

@zcswdt training P6 models is super easy:

python train.py --weights yolov5l6.pt

See release notes for details:

This release implements YOLOv5-P6 models and retrained YOLOv5-P5 models. All model sizes YOLOv5s/m/l/x are now available in both P5 and P6 architectures:

  • YOLOv5-P5 models (same architecture as v4.0 release): 3 output layers P3, P4, P5 at strides 8, 16, 32, trained at --img 640
python detect.py --weights yolov5s.pt  # P5 models
                           yolov5m.pt
                           yolov5l.pt
                           yolov5x.pt
  • YOLOv5-P6 models: 4 output layers P3, P4, P5, P6 at strides 8, 16, 32, 64 trained at --img 1280
python detect.py --weights yolov5s6.pt  # P6 models
                           yolov5m6.pt
                           yolov5l6.pt
                           yolov5x6.pt

Example usage:

# Command Line
python detect.py --weights yolov5m.pt --img 640  # P5 model at 640
python detect.py --weights yolov5m6.pt --img 640  # P6 model at 640
python detect.py --weights yolov5m6.pt --img 1280  # P6 model at 1280
# PyTorch Hub
model = torch.hub.load('ultralytics/yolov5', 'yolov5m6')  #  P6 model
results = model(imgs, size=1280)  # inference at 1280

excuse me to ask, doesn't it just use the pretrained yolov5l6.pt, but not the cfg model yolov5l6.yaml? Because for example if we want to use yolov5x model then we write --cfg models/yolov5x.yaml, but in yolov5 github there isn't yolov5l6.yaml, only exist yolov5n.yaml, yolov5m.yaml, yolov5n.yaml, yolov5s.yaml, and yolov5x.yaml.

So, i'm also confused how to train yolov5l6 model (yolov5l6.yaml)? Thank you

@glenn-jocher
Copy link
Member

@farahathaya 👋 Yes, you are correct! The cfg file is specific to a model architecture and defines the network structure, whereas the .pt file represents the learned weights for a particular model instance.

The config files for P5 and P6 models, including yolov5l6.yaml, are accessible within the following directory:

yolov5/configs/

By default, the yolov5l6.pt file should use yolov5l6.yaml for loading the model structure.

Training the yolov5l6 model is easy with the --weights flag, as you mentioned, and specifying either yolov5l6.yaml or another custom yaml file as needed. Here's an example command for training using the yolov5l6.yaml config file:

python train.py --cfg ./yolov5/configs/yolov5l6.yaml --data /path/to/data.yaml --weights yolov5l6.pt --batch-size 24 --device 0

Good luck! Let us know if you have any other questions.

@rochellemadulara
Copy link

rochellemadulara commented Apr 10, 2024

Hello sir @glenn-jocher ,

I'm currently attempting to train my custom datasets in YOLOv5 using the pre-trained weights yolov5l6.pt with images of resolution 1280, and an epoch setting of 100. However, I'm encountering significant challenges due to the weight of the model, making it very resource-intensive to train. While training on my laptop, the time required is excessively long, and it often runs out of CUDA memory, even with my Nvidia GeForce RTX 3070 GPU. I'm unsure about the estimated duration it will take to train on my laptop. I've also attempted to train it using Google Colab, but the 100 compute units provided are insufficient. Being a student, I'm constrained financially and unable to purchase additional compute units. Additionally, Google Colab sometimes disconnects during runtime, complicating the training process.

Could you kindly suggest any alternatives or solutions that could help me train my model using the desired weights? Are there any free virtual machine options available that are easy to set up and can accommodate this task? I'm highly motivated to complete this training as my graduation is rapidly approaching. Your guidance and assistance would be greatly appreciated. Thank you.

@glenn-jocher
Copy link
Member

@rochellemadulara hello there! 😊

Training a model as large as yolov5l6 on high-resolution images indeed requires considerable computational resources. Considering your constraints, here are a few suggestions that might help:

  1. Reduce Batch Size: Lower the batch size to reduce memory usage. This may impact training speed but can help avoid CUDA out of memory errors. Try using the --batch-size flag with a smaller value.

    python train.py --weights yolov5l6.pt --data yourdata.yaml --img 1280 --batch-size 8
  2. Use a Smaller Model: Consider training a smaller variant of YOLOv5, such as yolov5s or yolov5m, which require less computational power.

  3. Adjust Image Size: Training with a smaller image size can significantly reduce memory and computational requirements. You can adjust it using the --img flag.

    python train.py --weights yolov5l6.pt --data yourdata.yaml --img 640 --batch-size 16
  4. Explore Other Cloud Services: Some cloud providers like AWS, Azure, and GCP offer free credits to students that you can use to access more powerful GPUs.

  5. Checkpointing: Use the --resume flag to resume training if it gets interrupted. This way, you won’t lose your progress if Colab disconnects.

  6. Optimize Colab Usage: In Google Colab, make sure to use it during less peak hours (early mornings or late nights) as it might reduce the chance of disconnection.

Remember, even with a smaller model or lower image resolution, you can still achieve good results - it's all about finding the right balance for your available resources. Good luck with your training, and I hope you'll find these suggestions helpful! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

5 participants