nibtehaz / MultiResUNet

MultiResUNet : Rethinking the U-Net architecture for multimodal biomedical image segmentation
MIT License
432 stars 89 forks source link

Hello, in the pytorch file in MultiResUNet3D.py, I found some traces unique to the tensorflow version. For example, "padding = 'same'" in line 19. Is there a full pytorch version of the code? #29

Open lxy51 opened 6 months ago

lxy51 commented 6 months ago

Hello, in the pytorch file in MultiResUNet3D.py, I found some traces unique to the tensorflow version. For example, "padding = 'same'" in line 19. Is there a full pytorch version of the code?

nibtehaz commented 6 months ago

Hi @lxy51 , thank you for your interest in our project.

Thank you for bringing this to my attention. I think padding='same' is applicable for pytorch as you can see from the doc (https://pytorch.org/docs/stable/generated/torch.nn.Conv3d.html)

padding controls the amount of padding applied to the input. It can be either a string {‘valid’, ‘same’} or an int / a tuple of ints giving the amount of implicit padding applied on both sides.

Are you facing any issues with this? Please let me know what error you are facing and I would be happy to help.

lxy51 commented 6 months ago

Traceback (most recent call last): File "/root/data1/SeqRegNet8/train_one_shot.py", line 347, in main(args) File "/root/data1/SeqRegNet8/train_one_shot.py", line 73, in main simi_loss, smooth_loss, jdet_loss, cyclic_loss, total_loss = regnet.update(input_image) File "/root/data1/SeqRegNet8/model.py", line 114, in update return self.update_un_compose(input_image) File "/root/data1/SeqRegNet8/model.py", line 120, in update_un_compose res = self.forward(input_image) File "/root/data1/SeqRegNet8/model.py", line 36, in forward return self.forward_cdf(input_image, sample) File "/root/data1/SeqRegNet8/model.py", line 50, in forward_cdf scaled_disp_t2i = self.unet(scaled_image) File "/root/data1/lxy/envs/python37Se/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, kwargs) File "/root/data1/SeqRegNet8/MultiResUNet3D.py", line 165, in forward x_multires1 = self.multiresblock1(x1) File "/root/data1/lxy/envs/python37Se/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/root/data1/SeqRegNet8/MultiResUNet3D.py", line 50, in forward shrtct = self.shortcut(x) File "/root/data1/lxy/envs/python37Se/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "/root/data1/SeqRegNet8/MultiResUNet3D.py", line 15, in forward x = self.conv1(x) File "/root/data1/lxy/envs/python37Se/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/root/data1/lxy/envs/python37Se/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 521, in forward self.padding, self.dilation, self.groups) File "/root/data1/lxy/envs/python37Se/lib/python3.7/site-packages/apex/amp/wrap.py", line 28, in wrapper return orig_fn(new_args, **kwargs) TypeError: conv3d(): argument 'padding' (position 5) must be tuple of ints, not str

进程已结束,退出代码为 1

When I run it, it shows the above error.

lxy51 commented 6 months ago

First of all, thank you for your great creation. Because I am a novice in this field, I don't know much about these, I am really sorry. I am very interested in this research project. I wonder if I can add your contact information to facilitate communication with you. I come from China, and we mainly use wechat. May I ask what software do you usually use for daily communication? Or is it convenient to leave your email address for communication?