Closed tavomx45 closed 1 year ago
👋 Hello @tavomx45, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.
If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.
For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com.
Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on MacOS, Windows, and Ubuntu every 24 hours and on every commit.
@tavomx45 you can set one using the argparser here: https://github.com/ultralytics/yolov5/blob/f72f0fec980b35d7f9575d15b326f529b5a9ac0d/train.py#L456
Options are here, and you can add any additional ones not shown: https://github.com/ultralytics/yolov5/blob/f72f0fec980b35d7f9575d15b326f529b5a9ac0d/utils/torch_utils.py#L331-L341
@glenn-jocher thanks for your help 😀
👋 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 ⭐!
@tavomx45 you're welcome! Happy to help. If you have any more questions, feel free to ask. 😊 Keep up the great work!
There seems to be a slight change now,no such passage:parser.add_argument('--optimizer', type=str, choices=['SGD', 'Adam', 'AdamW'], default='SGD', help='optimizer') ,Is the default optimizer SGD?How to change it to Adam or AdamW
Hello! Yes, the default optimizer is still SGD. To change it to Adam or AdamW, you can modify the train.py
file. Specifically, add or update the optimizer argument in the parser
like this:
parser.add_argument('--optimizer', type=str, choices=['SGD', 'Adam', 'AdamW'], default='SGD', help='optimizer')
When running your training command, specify the optimizer by adding --optimizer Adam
or --optimizer AdamW
to use a different one. 😊
Thank you for your answer,I am using YOLOv5-6.0,It seems that only YOLOv5-6.1 and above versions have this passage:parser.add_argument('--optimizer', type=str, choices=['SGD', 'Adam', 'AdamW'], default='SGD', help='optimizer'),In yolov5-6.0's train.py, there are only this passage:parser.add_argument('--adam', action='store_true', help='use torch.optim.Adam() optimizer'). But I don't know how to change the optimizer in this situation, so I changed the version.
Great decision on upgrading to a newer version! For YOLOv5 version 6.0, if you wanted to switch to the Adam optimizer, you would typically add the --adam
flag to your training command like so:
python train.py --adam
This flag sets the optimizer to Adam instead of the default SGD. However, since you've already upgraded, using the --optimizer
argument as you now have is indeed the cleaner way to switch between different optimizers. Happy training! 😊 If you need further assistance, just let me know!
Search before asking
Question
How can I configure a different optimizer?
Additional
No response