wkentaro / pytorch-fcn

PyTorch Implementation of Fully Convolutional Networks. (Training code to reproduce the original result is available.)
MIT License
1.74k stars 480 forks source link

ValueError: Unexpected module: FCN8sAtOnce #123

Open chentao2016 opened 5 years ago

chentao2016 commented 5 years ago

Thanks for your great code. I can reach 64% with FCN8sAtOnce. However, when I try to use the FCN8sAtOnce model for my task(only part of the code related to the use the FCN8sAtOnce), I get the ValueError: Unexpected module: FCN8sAtOnce.
I realize I could add 'FCN8sAtOnce' to the 'modules_skipped' in function get_parameters to avoid the ValueError. But it seems like the network fail to train because the loss does not change. Could you give me some advice about the ValueError: Unexpected module: FCN8sAtOnce and the solution?

wkentaro commented 5 years ago

First of all, the ValueError is strange, since FCN8sAtOnce is a subclass of FCN8s. https://github.com/wkentaro/pytorch-fcn/blob/56e9249aeb2da098f9c202911569a7d562053887/torchfcn/models/fcn8s.py#L172

So below is True

>>> import torchfcn
>>> isinstance(torchfcn.models.FCN8sAtOnce(), torchfcn.models.FCN8s)
True

Can you check more carefully why you have this error in your environment? I tested Python3.7 and Python2.7, and both worked.

chentao2016 commented 5 years ago

Thank you for your answer, the problem solved when I add FCN8S to the 'modules_skipped' . And is there any difference if I just git clone your project and use the torchfcn directory in the project rather than use ‘pip install torchfcn’. Because it is too complex to follow all the instruction while I just want to use the FCN8sAtOnce model.

hylovezhang commented 4 years ago

I have questions of training, can you help me? @chentao2016