Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window_partition Runtime Error #112

Open
sibi-venti opened this issue May 15, 2024 · 0 comments
Open

Window_partition Runtime Error #112

sibi-venti opened this issue May 15, 2024 · 0 comments

Comments

@sibi-venti
Copy link

my input image
750x750 -> grayscale image 0 to 255
window size 10
error

SwinTransformerSys expand initial----depths:[2, 2, 2, 2];depths_decoder:[1, 2, 2, 2];drop_path_rate:0.2;num_classes:20
/home/sibi/.local/lib/python3.10/site-packages/torch/functional.py:512: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3587.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
window_ torch.Size([1, 187, 187, 1])
Traceback (most recent call last):
  File "/home/sibi/dev/Swin-Unet/train.py", line 95, in <module>
    net = ViT_seg(config, img_size=args.img_size, num_classes=args.num_classes).cuda()
  File "/home/sibi/dev/Swin-Unet/networks/vision_transformer.py", line 30, in __init__
    self.swin_unet = SwinTransformerSys(img_size=config.DATA.IMG_SIZE,
  File "/home/sibi/dev/Swin-Unet/networks/swin_transformer_unet_skip_expand_decoder_sys.py", line 627, in __init__
    layer = BasicLayer(dim=int(embed_dim * 2 ** i_layer),
  File "/home/sibi/dev/Swin-Unet/networks/swin_transformer_unet_skip_expand_decoder_sys.py", line 415, in __init__
    self.blocks = nn.ModuleList([
  File "/home/sibi/dev/Swin-Unet/networks/swin_transformer_unet_skip_expand_decoder_sys.py", line 416, in <listcomp>
    SwinTransformerBlock(dim=dim, input_resolution=input_resolution,
  File "/home/sibi/dev/Swin-Unet/networks/swin_transformer_unet_skip_expand_decoder_sys.py", line 219, in __init__
    mask_windows = window_partition(img_mask, self.window_size)  # nW, window_size, window_size, 1
  File "/home/sibi/dev/Swin-Unet/networks/swin_transformer_unet_skip_expand_decoder_sys.py", line 38, in window_partition
    x = x.view(B, H // window_size, window_size, W // window_size, window_size, C)
RuntimeError: shape '[1, 18, 10, 18, 10, 1]' is invalid for input of size 34969

what is the relation between the image size and window size?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant