glenn-jocher commited on
Commit
178c109
1 Parent(s): 9e75cbf

Add non-zero `da` `check_anchor_order()` condition (#7066)

Browse files
Files changed (1) hide show
  1. utils/autoanchor.py +1 -1
utils/autoanchor.py CHANGED
@@ -20,7 +20,7 @@ def check_anchor_order(m):
20
  a = m.anchors.prod(-1).mean(-1).view(-1) # mean anchor area per output layer
21
  da = a[-1] - a[0] # delta a
22
  ds = m.stride[-1] - m.stride[0] # delta s
23
- if da.sign() != ds.sign(): # same order
24
  LOGGER.info(f'{PREFIX}Reversing anchor order')
25
  m.anchors[:] = m.anchors.flip(0)
26
 
 
20
  a = m.anchors.prod(-1).mean(-1).view(-1) # mean anchor area per output layer
21
  da = a[-1] - a[0] # delta a
22
  ds = m.stride[-1] - m.stride[0] # delta s
23
+ if da and (da.sign() != ds.sign()): # same order
24
  LOGGER.info(f'{PREFIX}Reversing anchor order')
25
  m.anchors[:] = m.anchors.flip(0)
26