warmspringwinds / pytorch-segmentation-detection

Image Segmentation and Object Detection in Pytorch
MIT License
746 stars 170 forks source link

Error when trying to run resnet_34_8s_test #20

Closed ikoc closed 5 years ago

ikoc commented 5 years ago

It says

TypeError Traceback (most recent call last)

in () 34 img = Variable(img.cuda()) 35 ---> 36 fcn = resnet_dilated.Resnet34_8s(num_classes=19) 37 fcn.load_state_dict(torch.load('/home/sawyer/workspace/segmentation/resnet_34_8s_cityscapes_best.pth')) 38 fcn.cuda() /home/sawyer/workspace/segmentation/pytorch-segmentation-detection/pytorch_segmentation_detection/models/resnet_dilated.pyc in __init__(self, num_classes) 293 pretrained=True, 294 output_stride=8, --> 295 remove_avg_pool_layer=True) 296 297 # Randomly initialize the 1x1 Conv scoring layer /home/sawyer/workspace/segmentation/pytorch-segmentation-detection/vision/torchvision/models/resnet.pyc in resnet34(pretrained, **kwargs) 172 pretrained (bool): If True, returns a model pre-trained on ImageNet 173 """ --> 174 model = ResNet(BasicBlock, [3, 4, 6, 3], **kwargs) 175 if pretrained: 176 model.load_state_dict(model_zoo.load_url(model_urls['resnet34'])) TypeError: __init__() got an unexpected keyword argument 'fully_conv' In both python2.7-3.5 torch version 1.0.1
ikoc commented 5 years ago

I have cloned vision directly but it got wrong files i dont know why. I have copied resnet.py from here : https://github.com/warmspringwinds/vision/blob/eb6c13d3972662c55e752ce7a376ab26a1546fb5/torchvision/models/resnet.py and problem finished.