Skip to content

Commit

Permalink
Add non-zero da check_anchor_order() condition (ultralytics#7066)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Mar 20, 2022
1 parent 072d513 commit f8c4f61
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/autoanchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def check_anchor_order(m):
a = m.anchors.prod(-1).mean(-1).view(-1) # mean anchor area per output layer
da = a[-1] - a[0] # delta a
ds = m.stride[-1] - m.stride[0] # delta s
if da.sign() != ds.sign(): # same order
if da and (da.sign() != ds.sign()): # same order
LOGGER.info(f'{PREFIX}Reversing anchor order')
m.anchors[:] = m.anchors.flip(0)

Expand Down

0 comments on commit f8c4f61

Please sign in to comment.