Fix check_anchor_order() in pixel-space not grid-space (#7060)
* Update `check_anchor_order()` Use mean area per output layer for added stability. * Check in pixel-space not grid-space fix
This commit is contained in:
1 parent
529fbc1814
commit
f327eee614
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ PREFIX = colorstr('AutoAnchor: ')
|
||||
|
||||
def check_anchor_order(m):
|
||||
# Check anchor order against stride order for YOLOv5 Detect() module m, and correct if necessary
|
||||
a = m.anchors.prod(-1).view(-1) # anchor area
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user