From f619f55a80581dbb8a36dc87a66217d32b997ad3 Mon Sep 17 00:00:00 2001 From: Laughing-q <1185102784@qq.com> Date: Thu, 12 Sep 2024 16:41:55 +0800 Subject: [PATCH] Update head.py --- ultralytics/nn/modules/head.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ultralytics/nn/modules/head.py b/ultralytics/nn/modules/head.py index be0a8698f..52dffddc1 100644 --- a/ultralytics/nn/modules/head.py +++ b/ultralytics/nn/modules/head.py @@ -89,13 +89,7 @@ class Detect(nn.Module): # Inference path shape = x[0].shape # BCHW x_cat = torch.cat([xi.view(shape[0], self.no, -1) for xi in x], 2) - if self.export and self.format == "mct": - self.anchors, self.strides = ( - x.transpose(0, 1) - for x in make_anchors(getattr(self, "feats_size", torch.Tensor([80, 40, 20])), self.stride, 0.5) - ) - self.anchors, self.strides = self.anchors.to(x[0].device), self.strides.to(x[0].device) - elif self.dynamic or self.shape != shape: + if self.format != "mct" and (self.dynamic or self.shape != shape): self.anchors, self.strides = (x.transpose(0, 1) for x in make_anchors(x, self.stride, 0.5)) self.shape = shape