From 178c1095768a81edefc4c4ae87984ab1962e0906 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 20 Mar 2022 18:37:27 +0100 Subject: [PATCH] Add non-zero `da` `check_anchor_order()` condition (#7066) --- utils/autoanchor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/autoanchor.py b/utils/autoanchor.py index 7eb46af91195..882712d45a38 100644 --- a/utils/autoanchor.py +++ b/utils/autoanchor.py @@ -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)