pytorch-semantic-segmentation icon indicating copy to clipboard operation
pytorch-semantic-segmentation copied to clipboard

Train SegNet

Open muralabmahmuds opened this issue 7 years ago • 2 comments

Hi @zijundeng and everybody,

First of all, thank you for your codes. I am a very beginner in semantic segmentation area.

I want to run your codes using SegNet model, but I didn't find the "train.py" for SegNet. Then, I simply try to modify "train.py" from folder "train/cityscapes-psp_net" and change the net in line 42. from : net = PSPNet(num_classes=cityscapes.num_classes) to be : net = SegNet(num_classes=cityscapes.num_classes)

But, I found this error and still cannot solve the problem. RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 31 and 32 in dimension 2 at /opt/conda/conda-bld/pytorch_1525909934016/work/aten/src/THC/generic/THCTensorMath.cu:111

Please, kindly your suggestion. Thank you.

muralabmahmuds avatar Aug 21 '18 08:08 muralabmahmuds

It seems that two feature maps mismatch in the "height" dimension. You can use " torch.nn.functional.upsample" to make sure that the two feature maps are in the same spatial size. Best regards, Zijun

muralabmahmuds [email protected] 于2018年8月21日周二 下午4:44写道:

Hi @zijundeng https://github.com/zijundeng and everybody,

First of all, thank you for your codes. I am a very beginner in semantic segmentation area.

I want to run your codes using SegNet model, but I didn't find the "train.py" for SegNet. Then, I simply try to modify "train.py" from folder "train/cityscapes-psp_net" and change the net in line 42. from : net = PSPNet(num_classes=cityscapes.num_classes) to be : net = SegNet(num_classes=cityscapes.num_classes)

But, I found this error and still cannot solve the problem. RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 31 and 32 in dimension 2 at /opt/conda/conda-bld/pytorch_1525909934016/work/aten/src/THC/generic/THCTensorMath.cu:111

Please, kindly your suggestion. Thank you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zijundeng/pytorch-semantic-segmentation/issues/46, or mute the thread https://github.com/notifications/unsubscribe-auth/AWj5K8Fi4nacqTK9Wj750LIOYzKgfFOKks5uS8hegaJpZM4WFWSV .

zijundeng avatar Aug 21 '18 12:08 zijundeng

Dear @zijundeng Thank you for your kind reply. I am searching about "torch.nn.functional.upsample" but I still could not understand how to use it and where should I put it to solve my above problem. Would you give an example of how to follow your suggestion regarding "torch.nn.functional.upsample", please? Thank you very much!

muralabmahmuds avatar Aug 27 '18 04:08 muralabmahmuds