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

best.pt not saved when it is from the last epoch #542

Closed
AlexWang1900 opened this issue Jul 28, 2020 · 3 comments
Closed

best.pt not saved when it is from the last epoch #542

AlexWang1900 opened this issue Jul 28, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@AlexWang1900
Copy link
Contributor

Before submitting a bug report, please be aware that your issue must be reproducible with all of the following, otherwise it is non-actionable, and we can not help you:

If this is a custom dataset/training question you must include your train*.jpg, test*.jpg and results.png figures, or we can not help you. You can generate these with utils.plot_results().

🐛 Bug

in train.py line: 390
```
if (best_fitness == fi) and not final_epoch: ###
torch.save(ckpt, best)
del ckpt

when the last epoch happens to have a best fitness,  it wouldn't save a best.pt,
the code outside the train.py cannot judge which .pt  is the best.  


## To Reproduce (REQUIRED)

train one epoch from an interrupted traning's  last.pt , or the best result happens to be in the last epoch.

Output:
"couldn't find best.pt" or load a wrong best.pt. (should be last.pt in this situation)

## Expected behavior
A clear and concise description of what you expected to happen.
when training compeletes, one can load best.pt as it is the best result.


## Environment
If applicable, add screenshots to help explain your problem.

 - OS: [e.g. Ubuntu]
 - GPU [e.g. 2080 Ti]


## Additional context
Add any other context about the problem here.
@AlexWang1900 AlexWang1900 added the bug Something isn't working label Jul 28, 2020
@AlexWang1900 AlexWang1900 changed the title best.pt not save when it is from the last epoch best.pt not saved when it is from the last epoch Jul 28, 2020
@glenn-jocher
Copy link
Member

@AlexWang1900 yes, good point! I do believe you've found a bug. Would you like to submit a PR or should I include this in the next push?

@glenn-jocher glenn-jocher added the TODO High priority items label Jul 28, 2020
@AlexWang1900
Copy link
Contributor Author

AlexWang1900 commented Jul 29, 2020 via email

AlexWang1900 added a commit to AlexWang1900/yolov5 that referenced this issue Jul 29, 2020
glenn-jocher added a commit that referenced this issue Jul 29, 2020
* fix #541 #542

* Update train.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
glenn-jocher added a commit that referenced this issue Jul 31, 2020
* fix #541 #542

* Update train.py

* Add Frelu

* Update activations.py

PEP8 and format updates for commonality with models.common.Conv()

* Update activations.py

Update case

* Update activations.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher
Copy link
Member

Issue resolved, removing TODO.

@glenn-jocher glenn-jocher removed the TODO High priority items label Aug 5, 2020
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this issue May 12, 2021
* fix ultralytics#541 ultralytics#542

* Update train.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this issue May 12, 2021
* fix ultralytics#541 ultralytics#542

* Update train.py

* Add Frelu

* Update activations.py

PEP8 and format updates for commonality with models.common.Conv()

* Update activations.py

Update case

* Update activations.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this issue Aug 26, 2022
* fix ultralytics#541 ultralytics#542

* Update train.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this issue Aug 26, 2022
* fix ultralytics#541 ultralytics#542

* Update train.py

* Add Frelu

* Update activations.py

PEP8 and format updates for commonality with models.common.Conv()

* Update activations.py

Update case

* Update activations.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
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

No branches or pull requests

2 participants