UNeXt-pytorch
UNeXt-pytorch copied to clipboard
deep_supervision
I want to use deep_supervision, but I find a error, should I how to deal with this error? What the function of the deep_supervision? Thank you!
I finished the training on BUSI without DS, but when I tried to train on BUSI dataset with DS and met the same question, have you solved it? @long123524
I finished the training on BUSI without DS, but when I tried to train on BUSI dataset with DS and met the same question, have you solved it? @long123524
Hey I got where the problem is, it happens because your "output"(torch.Size([1, 256, 256])) and "target"( torch.Size([8, 1, 256, 256])) is not dimmensional equal so your criterion function cannot calculate the right loss, all you need to do is changing the
for output in outputs:
loss += criterion(output, target)
into
for i in range(len(outputs)):
loss += criterion(outputs[i], target[i])
in both train function(119,120 line) and validate function(166, 167 line) of train.py; then the code with configure "--deep_supervision True" will run correctly.
I finished the training on BUSI without DS, but when I tried to train on BUSI dataset with DS and met the same question, have you solved it? @long123524
Hey I got where the problem is, it happens because your "output"(torch.Size([1, 256, 256])) and "target"( torch.Size([8, 1, 256, 256])) is not dimmensional equal so your criterion function cannot calculate the right loss, all you need to do is changing the
for output in outputs:
loss += criterion(output, target)
into
for i in range(len(outputs)):
loss += criterion(outputs[i], target[i])
in both train function(119,120 line) and validate function(166, 167 line) of train.py; then the code with configure "--deep_supervision True" will run correctly.
Found something wrong with code, I used same configures but got a very terrible IoU score on BUSI dataset with deep supervision than without, and I compared the code of UNeXt and UNet++, found that archs.py of UNeXt which defines the network architecture considers nothing about deep supervision(just one stage to output), while the losses.py and the part of train&vaildate function about deep supervision in train.py is totally the same as UNet++'s code. So I guess that the author did not consider using deep supervision in the network, but just modified the code framework against UNet++ without removing the deep supervision part.
Yes, deep supervision part was not used in UNeXt training.
I finished the training on BUSI without DS, but when I tried to train on BUSI dataset with DS and met the same question, have you solved it? @long123524
Hey I got where the problem is, it happens because your "output"(torch.Size([1, 256, 256])) and "target"( torch.Size([8, 1, 256, 256])) is not dimmensional equal so your criterion function cannot calculate the right loss, all you need to do is changing the
for output in outputs:
loss += criterion(output, target)
into
for i in range(len(outputs)):
loss += criterion(outputs[i], target[i])
in both train function(119,120 line) and validate function(166, 167 line) of train.py; then the code with configure "--deep_supervision True" will run correctly.
Good job