diff --git a/ultralytics/nn/modules/transformer.py b/ultralytics/nn/modules/transformer.py index 89a7d91..b3304cc 100644 --- a/ultralytics/nn/modules/transformer.py +++ b/ultralytics/nn/modules/transformer.py @@ -77,7 +77,7 @@ class AIFI(TransformerEncoderLayer): pos_embed = self.build_2d_sincos_position_embedding(w, h, c) # flatten [B, C, H, W] to [B, HxW, C] x = super().forward(x.flatten(2).permute(0, 2, 1), pos=pos_embed.to(device=x.device, dtype=x.dtype)) - return x.permute((0, 2, 1)).view([-1, c, h, w]) + return x.permute(0, 2, 1).view([-1, c, h, w]).contiguous() @staticmethod def build_2d_sincos_position_embedding(w, h, embed_dim=256, temperature=10000.): diff --git a/ultralytics/vit/utils/ops.py b/ultralytics/vit/utils/ops.py index 6585987..e8978a5 100644 --- a/ultralytics/vit/utils/ops.py +++ b/ultralytics/vit/utils/ops.py @@ -31,9 +31,6 @@ class HungarianMatcher(nn.Module): _cost_mask(bs, num_gts, masks=None, gt_mask=None): Computes the mask cost and dice cost if masks are predicted. """ - class HungarianMatcher(nn.Module): - ... - def __init__(self, cost_gain=None, use_fl=True, with_mask=False, num_sample_points=12544, alpha=0.25, gamma=2.0): super().__init__() if cost_gain is None: