kalviny / MSDNet-PyTorch

MSDNet
MIT License
188 stars 47 forks source link

请问为什么在运行的时候为什么会报 AttributeError: module 'models' has no attribute 'resnet' 这个错误? #16

Open kating37 opened 3 years ago

kating37 commented 3 years ago

D:\software\ana\envs\env1\python.exe C:/Users/Administrator/Desktop/黄高/MSDNet-PyTorch-master/main.py Traceback (most recent call last): File "C:/Users/Administrator/Desktop/黄高/MSDNet-PyTorch-master/main.py", line 352, in main() File "C:/Users/Administrator/Desktop/黄高/MSDNet-PyTorch-master/main.py", line 62, in main model = getattr(models, args.arch)(args) AttributeError: module 'models' has no attribute 'resnet'

Process finished with exit code 1

kirthifame commented 3 years ago

'models' is defined only for 'msdnet' doesn't have 'resnet'.

zhengchaobing commented 3 years ago

'models' is defined only for 'msdnet' doesn't have 'resnet'.

请问你跑通了没啊?

zhengchaobing commented 3 years ago

Traceback (most recent call last): File "/netdisk_home/zcb/PycharmProjects/A_Paper_Ghost/Compare_codes/MSDNet-PyTorch-master/main.py", line 351, in main() File "/netdisk_home/zcb/PycharmProjects/A_Paper_Ghost/Compare_codes/MSDNet-PyTorch-master/main.py", line 94, in main state_dict = torch.load(args.evaluate_from)['state_dict'] IndexError: too many indices for tensor of dimension 1

Process finished with exit code 1

Ciligu commented 3 years ago

将args中的arch中的resnet换成这个网络msdnet就可以了

arch_group.add_argument('--arch', '-a', metavar='ARCH',default= 'msdnet', type=str, choices=model_names, help='model architecture: ' + ' | '.join(model_names) + ' (default: msdnet)')