You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the command python train.py --model danet --resume models/DANet101.pth.tar --dataset citys --backbone resnet101 --base-size 2080 --crop-size 1890 --batch-size 4
I tried running the command above to train the model myself. However, I encountered the following error.
Traceback (most recent call last):
File "train.py", line 280, in
trainer = Trainer(args)
File "train.py", line 161, in init
model = get_segmentation_model(args.model, dataset=args.dataset,
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/sseg/init.py", line 24, in get_segmentation_model
return modelsname.lower()
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/sseg/encnet.py", line 140, in get_encnet
model = EncNet(datasets[dataset.lower()].NUM_CLASS, backbone=backbone, root=root, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/sseg/encnet.py", line 23, in init
super(EncNet, self).init(nclass, backbone, aux, se_loss,
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/sseg/base.py", line 69, in init
self.pretrained = get_backbone(backbone, pretrained=True, dilated=dilated,
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/sseg/base.py", line 51, in get_backbone
net = modelsname
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/backbone/resnet.py", line 349, in resnet50
model.load_state_dict(torch.load(
File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1406, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for ResNet:
size mismatch for bn1.weight: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for bn1.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for bn1.running_mean: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for bn1.running_var: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for layer1.0.conv1.weight: copying a param with shape torch.Size([64, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([64, 128, 1, 1]).
size mismatch for layer1.0.downsample.0.weight: copying a param with shape torch.Size([256, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 128, 1, 1]).
Do you know how to fix the error? I used the Cityscapes dataset.
The text was updated successfully, but these errors were encountered:
I used the command python train.py --model danet --resume models/DANet101.pth.tar --dataset citys --backbone resnet101 --base-size 2080 --crop-size 1890 --batch-size 4
I tried running the command above to train the model myself. However, I encountered the following error.
Traceback (most recent call last):
File "train.py", line 280, in
trainer = Trainer(args)
File "train.py", line 161, in init
model = get_segmentation_model(args.model, dataset=args.dataset,
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/sseg/init.py", line 24, in get_segmentation_model
return modelsname.lower()
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/sseg/encnet.py", line 140, in get_encnet
model = EncNet(datasets[dataset.lower()].NUM_CLASS, backbone=backbone, root=root, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/sseg/encnet.py", line 23, in init
super(EncNet, self).init(nclass, backbone, aux, se_loss,
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/sseg/base.py", line 69, in init
self.pretrained = get_backbone(backbone, pretrained=True, dilated=dilated,
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/sseg/base.py", line 51, in get_backbone
net = modelsname
File "/opt/conda/lib/python3.8/site-packages/torch_encoding-1.2.2b20241007-py3.8.egg/encoding/models/backbone/resnet.py", line 349, in resnet50
model.load_state_dict(torch.load(
File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1406, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for ResNet:
size mismatch for bn1.weight: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for bn1.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for bn1.running_mean: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for bn1.running_var: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for layer1.0.conv1.weight: copying a param with shape torch.Size([64, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([64, 128, 1, 1]).
size mismatch for layer1.0.downsample.0.weight: copying a param with shape torch.Size([256, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 128, 1, 1]).
Do you know how to fix the error? I used the Cityscapes dataset.
The text was updated successfully, but these errors were encountered: