LeeJunHyun / Image_Segmentation

Pytorch implementation of U-Net, R2U-Net, Attention U-Net, and Attention R2U-Net.
2.66k stars 594 forks source link

some queries #76

Closed soans1994 closed 1 year ago

soans1994 commented 3 years ago

hello author,

i have some queries regarding your work.

  1. did you use pretrained weights?
  2. input image size is 224x224? how did you select this sorry for noob questions. thank you

edit: i just realized you use binary ground truth. how to change for rgb lables. edit: i chnged the output channles to 3, but i still get errors

why choose batch size 1? for batch size 1 i get error as follows:

File "/home/rahul/.local/lib/python3.8/site-packages/torch/nn/functional.py", line 2069, in binary_cross_entropy raise ValueError("Target and input must have the same number of elements. target nelement ({}) " ValueError: Target and input must have the same number of elements. target nelement (147456) != input nelement (49152)

and for higher batch size i get error,

File "/home/rahul/.local/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py", line 55, in default_collate return torch.stack(batch, 0, out=out) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 192 and 336 in dimension 2 at /pytorch/aten/src/TH/generic/THTensor.cpp:612

thank you

Lloyd-Pottiger commented 2 years ago

For input image size is 224x224?, you can check this https://news.ycombinator.com/item?id=12509852, The output channel number is usually 1 in order to get better performance The batch size can change as you like, but the loss the author select is torch.nn.BCELoss(), so you should make there are only two areas of your target. Hope this may help you!