yolov7 icon indicating copy to clipboard operation
yolov7 copied to clipboard

Fix evolve bug

Open LukeAI opened this issue 1 year ago • 2 comments

This fixes a bug which happens if you run with --evolve

After the first iteration, (because then evolve.txt can be found)

Traceback (most recent call last):
  File "train.py", line 689, in <module>
    v = (g * (npr.random(ng) < mp) * npr.randn(ng) * npr.random() * s + 1).clip(0.3, 3.0)
ValueError: operands could not be broadcast together with shapes (30,) (31,)

This happens because on line 684 https://github.com/WongKinYiu/yolov7/blob/44d8ab41780e24eba563b6794371f29db0902271/train.py#L684

the hyp dictionary is iterated over, which contains 31 items (every key in meta plus 'loss_ota') but the loop then goes on to reference v which has a length of 30, the length of meta. This fix stops this misreference by iterating over meta directly. This does mean that the value loss_ota will not be evolved.

An alternative fix would be to add loss_ota with suitable lower/upper bounds to meta. I'd be happy to implement this with appropriate suggestions for loss_ota?

LukeAI avatar Aug 31 '22 10:08 LukeAI

Yes, maybe it makes sense to add loss_ota to the end of meta.

AlexeyAB avatar Sep 12 '22 14:09 AlexeyAB

Yes, maybe it makes sense to add loss_ota to the end of meta.

What would be appropriate mutation scale 0-1, lower_limit, upper_limit values for loss_ota ?

LukeAI avatar Sep 12 '22 14:09 LukeAI