-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Hi,
I think I encountered an error when I try to change the predefined unet to my own that does binary segmentation. From what I can gather, during train_ae, the class is compared with itself as the prediction. Since the input image (X) is RGB it expects 3 channel output (prediction) as well. If I try to change the unet to a two class output, I get an error here:
_loss1 = criterion(prediction, X) File "/media/App/anaconda3/envs/NN/lib/python3.9/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/media/App/anaconda3/envs/NN/lib/python3.9/site-packages/torch/nn/modules/loss.py", line 528, in forward return F.mse_loss(input, target, reduction=self.reduction) File "/media/App/anaconda3/envs/NN/lib/python3.9/site-packages/torch/nn/functional.py", line 2928, in mse_loss expanded_input, expanded_target = torch.broadcast_tensors(input, target) File "/media/App/anaconda3/envs/NN/lib/python3.9/site-packages/torch/functional.py", line 74, in broadcast_tensors return VF.broadcast_tensors(tensors) # type: ignore RuntimeError: The size of tensor a (2) must match the size of tensor b (3) at non-singleton dimension 1
Is there a better way to plug in a custom unet where n_classes != 3?
Thanks
Darshat