diff --git a/ultralytics/utils/tal.py b/ultralytics/utils/tal.py index f41c32bfd..9fb502092 100644 --- a/ultralytics/utils/tal.py +++ b/ultralytics/utils/tal.py @@ -306,7 +306,7 @@ def make_anchors(feats, strides, grid_cell_offset=0.5): assert feats is not None dtype, device = feats[0].dtype, feats[0].device for i, stride in enumerate(strides): - h, w = feats[i].shape[2:] if isinstance(feats, list) else (int(feats[i]), int(feats[i])) + h, w = feats[i].shape[2:] if isinstance(feats, list) else (int(feats[i][0]), int(feats[i][1])) sx = torch.arange(end=w, device=device, dtype=dtype) + grid_cell_offset # shift x sy = torch.arange(end=h, device=device, dtype=dtype) + grid_cell_offset # shift y sy, sx = torch.meshgrid(sy, sx, indexing="ij") if TORCH_1_10 else torch.meshgrid(sy, sx)