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

TypeError: must be real number, not str with evolve #566

Closed
gizemtanriver opened this issue Jul 30, 2020 · 6 comments · Fixed by #6604
Closed

TypeError: must be real number, not str with evolve #566

gizemtanriver opened this issue Jul 30, 2020 · 6 comments · Fixed by #6604
Labels
bug Something isn't working

Comments

@gizemtanriver
Copy link

Hi, thanks for this amazing repo first of all!

I am working with the v2.0 release of the repo and so far I got quite promising results on my custom dataset. I tried to use --evolve today but I am getting a TypeError from the print_mutation function in utils.py at the end of the first run. It seems to be related to 'SGD' in hyp dictionary - which is a string. I see that the optimizer parameter was added to the dict in v2.0 so I guess this wasn't an issue in the previous release.

Input:

!python yolov5/train.py --img 512 --batch 16 --epochs 100 --yolov5/data/custom_data.yaml \
    --cfg yolov5/models/custom_yolov5s.yaml \
    --weights yolov5/weights/yolov5s.pt --cache --evolve

Output:

Traceback (most recent call last):
  File "yolov5/train.py", line 516, in <module>
    print_mutation(hyp, results, opt.bucket)
  File "/content/drive/.shortcut-targets-by-id/1hQ281-8ogL2dJzHbXZSWEYDIYei6RRbe/YOLOv5/yolov5/utils/utils.py", line 830, in print_mutation
    b = '%10.3g' * len(hyp) % tuple(hyp.values())  # hyperparam values
TypeError: must be real number, not str
@gizemtanriver gizemtanriver added the bug Something isn't working label Jul 30, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Jul 30, 2020

Hello @gizemtanriver, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

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 model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

  • Cloud-based AI systems operating on hundreds of HD video streams in realtime.
  • Edge AI integrated into custom iOS and Android apps for realtime 30 FPS video inference.
  • Custom data training, hyperparameter evolution, and model exportation to any destination.

For more information please visit https://www.ultralytics.com.

@glenn-jocher
Copy link
Member

@gizemtanriver hi, thank you for the bug report. Yes you are correct, --evolve is currently out of order due to recent PRs. It's on a long list of TODOs. I can not give you an ETA. In the meantime it's inoperable.

@glenn-jocher
Copy link
Member

@gizemtanriver this bug should be fixed now. Let me know if you find otherwise.

KMint1819 pushed a commit to KMint1819/yolov5 that referenced this issue May 12, 2021
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this issue May 12, 2021
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this issue May 12, 2021
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this issue May 12, 2021
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this issue May 12, 2021
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this issue May 12, 2021
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this issue May 12, 2021
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this issue May 12, 2021
@weizhou1001
Copy link

Hi, I'm on master branch with commit 9cf80b7. I'm still getting this error
10 epochs completed in 0.248 hours. Results saved to runs/evolve/exp Traceback (most recent call last): File "train.py", line 642, in <module> main(opt) File "train.py", line 622, in main print_mutation(results, hyp.copy(), save_dir, opt.bucket) File "/home/wzhou/src/yolov5/utils/general.py", line 804, in print_mutation f.write(s + ('%20.5g,' * n % vals).rstrip(',') + '\n') TypeError: must be real number, not list
Any ideas what would be the problem?

@glenn-jocher
Copy link
Member

glenn-jocher commented Feb 10, 2022

@weizhou1001 👋 hi, thanks for letting us know about this possible problem with YOLOv5 🚀. --evolve works correctly, I just tested now:

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

Screenshot 2022-02-10 at 13 17 13

We've created a few short guidelines below to help users provide what we need in order to get started investigating a possible problem.

How to create a Minimal, Reproducible Example

When asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:

  • Minimal – Use as little code as possible to produce the problem
  • Complete – Provide all parts someone else needs to reproduce the problem
  • Reproducible – Test the code you're about to provide to make sure it reproduces the problem

For Ultralytics to provide assistance your code should also be:

  • Current – Verify that your code is up-to-date with GitHub master, and if necessary git pull or git clone a new copy to ensure your problem has not already been solved in master.
  • Unmodified – Your problem must be reproducible using official YOLOv5 code without changes. Ultralytics does not provide support for custom code ⚠️.

If you believe your problem meets all the above criteria, please close this issue and raise a new one using the 🐛 Bug Report template with a minimum reproducible example to help us better understand and diagnose your problem.

Thank you! 😃

@glenn-jocher glenn-jocher linked a pull request Feb 10, 2022 that will close this issue
@glenn-jocher
Copy link
Member

@weizhou1001 good news 😃! A related evolution issue may now be fixed ✅ in PR #6604. This bug fixes hyp_evolve.yaml, which was showing the last generation result rather than the best generation.

To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this issue Aug 26, 2022
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this issue Aug 26, 2022
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this issue Aug 26, 2022
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this issue Aug 26, 2022
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this issue Aug 26, 2022
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this issue Aug 26, 2022
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this issue Aug 26, 2022
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this issue Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants