NoduleNet icon indicating copy to clipboard operation
NoduleNet copied to clipboard

a problrm in nodule_net.py

Open huangguoqing1111 opened this issue 2 years ago • 6 comments

self.mask_probs = data_parallel(self.mask_head, (torch.from_numpy(self.crop_boxes).cuda(), features))

File "D:\anaconda\envs\Stest\lib\site-packages\torch\nn\parallel\data_parallel.py", line 231, in data_parallel return module(*inputs[0], **module_kwargs[0]) File "D:\anaconda\envs\Stest\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl return forward_call(*input, **kwargs) File "D:\HGQ_DL\NoduleNet\net\nodule_net.py", line 238, in forward up1 = f_4[b, :, z_start / 4:z_end / 4, y_start / 4:y_end / 4, x_start / 4:x_end / 4].unsqueeze(0) TypeError: only integer tensors of a single element can be converted to an index

Hello, I want to ask when I run this net , I get a problrm about only integer tensors of a single element can be converted to an index in the nodule_net.py ? thank you for your answer

huangguoqing1111 avatar Nov 08 '22 06:11 huangguoqing1111

@tanghaotommy can you help me to solve this problem

huangguoqing1111 avatar Nov 08 '22 06:11 huangguoqing1111

I solve it , due to I use pytorc=1.13,so I need to change this code;up1 = f_4[b, :, z_start / 4:z_end / 4, y_start / 4:y_end / 4, x_start / 4:x_end / 4].unsqueeze(0)

huangguoqing1111 avatar Nov 09 '22 09:11 huangguoqing1111

@huangguoqing1111 hi! I am also facing the same problem. I am using pytorch 1.7.1. Could you please describe how you changed this code "up1 = f_4[b, :, z_start / 4:z_end / 4, y_start / 4:y_end / 4, x_start / 4:x_end / 4].unsqueeze(0)" to solve the error?

Tanwi995 avatar Nov 12 '22 06:11 Tanwi995

@Tanwi995 up1 = f_4[int(b), :, int(z_start / 4):int(z_end / 4), int(y_start / 4):int(y_end / 4), int(x_start / 4):int(x_end / 4)].unsqueeze(0) I change in this code

huangguoqing1111 avatar Nov 16 '22 06:11 huangguoqing1111

@huangguoqing1111 Thank you very much.

Tanwi995 avatar Nov 21 '22 04:11 Tanwi995

@Tanwi995 up1 = f_4[int(b), :, int(z_start / 4):int(z_end / 4), int(y_start / 4):int(y_end / 4), int(x_start / 4):int(x_end / 4)].unsqueeze(0) I change in this code

@huangguoqing1111 Thank you very much for your reply, I have some questions I would like to ask you about training, thank you. How can I contact you?

chovvvvvy avatar Mar 27 '23 09:03 chovvvvvy