From ea7e78cb1159e6a17821772c85c4c23ccc823b16 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 6 Nov 2020 19:17:50 +0100 Subject: [PATCH] Grid indices overflow bug fix (#1316) --- utils/general.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/general.py b/utils/general.py index 11a2cf4..32cf662 100755 --- a/utils/general.py +++ b/utils/general.py @@ -589,7 +589,7 @@ def build_targets(p, targets, model): # Append a = t[:, 6].long() # anchor indices - indices.append((b, a, gj.clamp_(0, gain[3]), gi.clamp_(0, gain[2]))) # image, anchor, grid indices + indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1))) # image, anchor, grid indices tbox.append(torch.cat((gxy - gij, gwh), 1)) # box anch.append(anchors[a]) # anchors tcls.append(c) # class