SuperYOLO
SuperYOLO copied to clipboard
执行测试指令torch报错AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
执行python3 test.py --weight ./weights/small_EDSR_MF_fold1.pt --input_mode RGB+IR+MF打印报错如下: Namespace(augment=False, batch_size=1, conf_thres=0.001, data='data/SRvedai.yaml', device='1', exist_ok=False, img_size=512, input_mode='RGB+IR+MF', iou_thres=0.6, name='exp', project='runs/test', save_conf=False, save_hybrid=False, save_json=False, save_txt=False, single_cls=False, task='val', verbose=False, weights=['./weights/small_EDSR_MF_fold1.pt']) YOLOv5 🚀 2024-3-13 torch 1.13.0+cu116 CUDA:1 (NVIDIA GeForce RTX 2080 Ti, 11011.5MB)
Fusing layers... Model Summary: 291 layers, 7725841 parameters, 0 gradients, GFLOPS SRyolo_MF.yaml image size: 512 gs value: 32 val: Scanning 'project/SuperYOLO/dataset/VEDAI/labels.cache' for images and labels... 121 found, 0 missing, 2 empty, 0 corrupted: 100%|█████████| 121/121 [00:00<?, ?it/s] Class Images Labels P R [email protected] [email protected]:.95: 0%| | 0/121 [00:00<?, ?it/s] Traceback (most recent call last): File "test.py", line 155, in test out, train_out = model(img,ir,input_mode=input_mode) #zjq inference and training outputs File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, **kwargs) File "project/SuperYOLO/models/SRyolo.py", line 196, in forward y,features = self.forward_once(steam,'yolo', profile) #zjq File "project/SuperYOLO/models/SRyolo.py", line 232, in forward_once x = m(x) # run File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/upsampling.py", line 157, in forward recompute_scale_factor=self.recompute_scale_factor) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1265, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor' 请问这是否为环境的原因还是代码问题,按照您提供的依赖txt文件,应该是可以满足torch版本要求的
请问您这个问题解决了吗,我也报相同的错误
这个百度就有解答 https://blog.csdn.net/weixin_43401024/article/details/124428432 可尝试!