Skip to content

Commit f8c4f61

Browse files
authored
Add non-zero da check_anchor_order() condition (ultralytics#7066)
1 parent 072d513 commit f8c4f61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

utils/autoanchor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def check_anchor_order(m):
2020
a = m.anchors.prod(-1).mean(-1).view(-1) # mean anchor area per output layer
2121
da = a[-1] - a[0] # delta a
2222
ds = m.stride[-1] - m.stride[0] # delta s
23-
if da.sign() != ds.sign(): # same order
23+
if da and (da.sign() != ds.sign()): # same order
2424
LOGGER.info(f'{PREFIX}Reversing anchor order')
2525
m.anchors[:] = m.anchors.flip(0)
2626

0 commit comments

Comments
 (0)