Giter Site home page Giter Site logo

Comments (7)

bigmb avatar bigmb commented on August 15, 2024

Thank you.
Can you let me know where you are facing this issue? ( in model or preprocessing )

from unet-segmentation-pytorch-nest-of-unets.

zhou-rui1 avatar zhou-rui1 commented on August 15, 2024

Thanks a lot! It is in model , when the label color is (0,255), and the out_ch=3

 File "pytorch_run.py", line 302, in <module>
    s_label = data_transform(im_label)
  File "/usr/local/lib/python3.6/dist-packages/torchvision/transforms/transforms.py", line 67, in __call__
    img = t(img)
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/torchvision/transforms/transforms.py", line 226, in forward
    return F.normalize(tensor, self.mean, self.std, self.inplace)
  File "/usr/local/lib/python3.6/dist-packages/torchvision/transforms/functional.py", line 284, in normalize
    tensor.sub_(mean).div_(std)
RuntimeError: output with shape [1, 96, 96] doesn't match the broadcast shape [3, 96, 96]

from unet-segmentation-pytorch-nest-of-unets.

bigmb avatar bigmb commented on August 15, 2024

Can you look at this issue?
#37
Also, change the out_ch=1 (that's the output channel you will be getting as an output.)

from unet-segmentation-pytorch-nest-of-unets.

zhou-rui1 avatar zhou-rui1 commented on August 15, 2024

So appreciated for your guidance, but the case a little different. Now I have the following set:
torchvision.transforms.Normalize((0.5,), (0.5,))
im_tb = Image.open(test_image).convert('RGB')
def __init__(self, in_ch=3, out_ch=1):
But it still get this :
File "pytorch_run.py", line 265, in <module> lossT = calc_loss(y_pred, y) # Dice_loss Used File "/content/Unet-Segmentation-Nest-of-Unets/losses.py", line 32, in calc_loss bce = F.binary_cross_entropy_with_logits(prediction, target) File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 2580, in binary_cross_entropy_with_logits raise ValueError("Target size ({}) must be the same as input size ({})".format(target.size(), input.size())) ValueError: Target size (torch.Size([4, 2, 96, 96])) must be the same as input size (torch.Size([4, 1, 96, 96]))
How can I make both of them work?
With regards

from unet-segmentation-pytorch-nest-of-unets.

bigmb avatar bigmb commented on August 15, 2024

Currently, I am seeing only one issue that you are facing with the loss function.
Can you check the size of the input to the y_pred and y?

I think the shape of the data is getting mismatched somewhere due to preproccesing.

from unet-segmentation-pytorch-nest-of-unets.

zhou-rui1 avatar zhou-rui1 commented on August 15, 2024

Thanks a lot, that problem solved, but why got this with 3 channels input?
[Errno 99] Cannot assign requested address Given groups=1, weight of size [64, 3, 3, 3], expected input[3, 1, 128, 128] to have 3 channels, but got 1 channels instead Error occurs, No graph saved Traceback (most recent call last): File "pytorch_run.py", line 176, in <module> writer1.add_graph(model_test, model_test(torch.randn(3, 3, 128, 128, requires_grad=True)))
and seems that the tensorboardX can not work well?
With regards,

from unet-segmentation-pytorch-nest-of-unets.

bigmb avatar bigmb commented on August 15, 2024

If you are planing to use tensorboardx it's going to be difficult.
Currently tensorboardx doesnt support skip connections. If it's a simple network it works.
I havnt checked if the current version is upgraded for the same. I will have a look at that next weekend.
Is the main code working for you?

from unet-segmentation-pytorch-nest-of-unets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.