gorkemcanates / Dual-Cross-Attention

Official Pytorch implementation of Dual Cross-Attention for Medical Image Segmentation
MIT License
102 stars 12 forks source link

DCA Block Error #7

Closed praful1993 closed 2 months ago

praful1993 commented 1 year ago

I attempted to generate the model summary of your Unet model with the "attention=True" setting, and I encountered the following error. Did you incorporate a DCA block in your network?

File "Dual-Cross-Attention.py", line 1120, in out = model(in1) File "/home/praful/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, *kwargs) File "Dual-Cross-Attention.py", line 1097, in forward x11, x22, x33, x44 = self.DCA([x1, x2, x3, x4]) File "/home/praful/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(input, **kwargs) File "Dual-Cross-Attention.py", line 884, in forward x_out = self.m_sum(x, raw) File "Dual-Cross-Attention.py", line 892, in m_sum return [xi + xj for xi, xj in zip(x, y)]
File "Dual-Cross-Attention.py", line 892, in return [xi + xj for xi, xj in zip(x, y)]
RuntimeError: The size of tensor a (512) must match the size of tensor b (64) at non-singleton dimension 2

praful1993 commented 1 year ago

Here my input image size is 3X64X512

gorkemcanates commented 1 year ago

DCA code is designed for square image sizes, you need to update the code such that it takes non-square inputs.

On Fri, Sep 1, 2023 at 5:37 AM Praful Hambarde @.***> wrote:

Here my input image size is 3X64X512

— Reply to this email directly, view it on GitHub https://github.com/gorkemcanates/Dual-Cross-Attention/issues/7#issuecomment-1702463973, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASFOJR6MKEZGQFOBF3TRPX3XYGUEJANCNFSM6AAAAAA4HJHXBE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Regards, Gorkem Can Ates

praful1993 commented 1 year ago

Could you give some idea for code modification for non square input??

chaixiaoyi2 commented 11 months ago

Hello,have you solved this problem?

gorkemcanates commented 4 months ago

You need to customize the output size in pool embedding to support non-square inputs.