Abe404 / RootPainter3D

RootPainter3D: Interactive-machine-learning enables rapid and accurate contouring for radiotherapy
GNU General Public License v3.0
19 stars 10 forks source link

Trainer fails because of dtype mismatch in call to cnn function #1

Closed orting closed 2 years ago

orting commented 2 years ago

Trainer fails because of dtype mismatch in call to cnn function. Log output below. Input data is uint16.

found instruction segment_-8639686351424129568 execute_instruction segment segmented input shape (235, 235, 235) segment image, input shape = (235, 235, 235) Exception parsing instruction Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should be the same Traceback (most recent call last): File "/trainer/trainer.py", line 154, in execute_instruction getattr(self, name)(config) File "/trainer/trainer.py", line 509, in segment overwrite=overwrite) File "/trainer/trainer.py", line 592, in segment_file out_d, classes, bounded) File "/trainer/model_utils.py", line 147, in ensemble_segment_3d pred_maps = segment_3d(cnn, image, batch_size, in_patch_shape, out_patch_shape) File "/trainer/model_utils.py", line 244, in segment_3d outputs = cnn(tiles_for_gpu).detach().cpu() File "/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, kwargs) File "/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 166, in forward return self.module(*inputs[0], *kwargs[0]) File "/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(input, kwargs) File "/trainer/unet3d.py", line 129, in forward out1 = self.conv_in(x) File "/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, *kwargs) File "/python3.6/site-packages/torch/nn/modules/container.py", line 141, in forward input = module(input) File "/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(input, **kwargs) File "/python3.6/site-packages/torch/nn/modules/conv.py", line 590, in forward return self._conv_forward(input, self.weight, self.bias) File "/python3.6/site-packages/torch/nn/modules/conv.py", line 586, in _conv_forward input, weight, bias, self.stride, self.padding, self.dilation, self.groups RuntimeError: Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should be the same

Abe404 commented 2 years ago

Thanks Silas,

As you are using the dev_mc branch I have pushed a new commit to that branch that should hopefully fix the issue.

See https://github.com/Abe404/RootPainter3D/commit/4c4f1b71ae111b3dd6aa625d112bc05b7dde9b4d

If you pull the branch again you should get this update.

Plesae let me know how it goes.

Kind regards, Abraham

Abe404 commented 2 years ago

Closing this issue. Silas confirmed via email that it works now :)