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

Evolve missing dfl hyperparameter in train_dual.py and train.py #149

Open
mkrupczak3 opened this issue Mar 3, 2024 · 5 comments
Open

Evolve missing dfl hyperparameter in train_dual.py and train.py #149

mkrupczak3 opened this issue Mar 3, 2024 · 5 comments

Comments

@mkrupczak3
Copy link

Running training with the --evolve flag, the system outputs the following error:

Traceback (most recent call last):
  File "/hpcuser/yolov9/train_dual.py", line 644, in <module>
    main(opt)
  File "/hpcuser/yolov9/train_dual.py", line 604, in main
    g = np.array([meta[k][0] for k in hyp.keys()])  # gains 0-1
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/hpcuser/yolov9/train_dual.py", line 604, in <listcomp>
    g = np.array([meta[k][0] for k in hyp.keys()])  # gains 0-1
                  ~~~~^^^
KeyError: 'dfl'

The root cause is that the dfl hyperparameter is absent in the evolve section of train.py and train_dual.py.

In the file hyp.scratch-high.yaml the dfl hyperparameter appears just after obj_pw:

dfl: 1.5 # dfl loss gain

However, in both train_dual.py and train.py this hyperparameter is missing under the keys for evolve:

'iou_t': (0, 0.1, 0.7), # IoU training threshold

yolov9/train.py

Line 546 in 3f27231

'iou_t': (0, 0.1, 0.7), # IoU training threshold

mkrupczak3 added a commit to mkrupczak3/yolov9 that referenced this issue Mar 3, 2024
@WongKinYiu
Copy link
Owner

Currently YOLOv9 does not support evolve, you may need do some modification.

For example, modify loss gain to adaptive with hyp.
https://github.com/WongKinYiu/yolov9/blob/main/utils/loss_tal_dual.py#L247-L249

@KoniHD
Copy link

KoniHD commented Jul 6, 2024

Any updates if --evolve works now?
Because for me I can run one generation and after that the script crashes with pretty much the same error.

@mkrupczak3
Copy link
Author

I was able to get evolve to run with the changes in #150, though with what the author stated I'm not sure if it produced truly optimal results.

@KoniHD
Copy link

KoniHD commented Jul 6, 2024

Thank you! I just saw it sorry.
Just curious. I am a newbie to the object detection topic. What do the 3 numbers in

'dfl': (1, 1.0, 1.75), # dfl loss gain

refer to?

@mkrupczak3
Copy link
Author

See here:

yolov9/train.py

Line 532 in 5b1ea9a

# Hyperparameter evolution metadata (mutation scale 0-1, lower_limit, upper_limit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants