ShichengMiao16 / MADet

Mutual-Assistance Learning for Object Detection
Apache License 2.0
19 stars 2 forks source link

ConvModule' object has no attribute 'weight', #1

Open Alexwong-1024 opened 11 months ago

Alexwong-1024 commented 11 months ago

Please tell me, I use the be command python tools/train.py configs/madet/madet_r101_fpn_1x_coco.py for training, but an error like this occurs, nexpected key in source state_dict: fc.weight, fc.bias

Traceback (most recent call last): File "tools/train.py", line 185, in main() File "tools/train.py", line 158, in main model = build_detector( File "/root/autodl-tmp/MADet/mmdet/models/builder.py", line 67, in build_detector return build(cfg, DETECTORS, dict(train_cfg=train_cfg, test_cfg=test_cfg)) File "/root/autodl-tmp/MADet/mmdet/models/builder.py", line 32, in build return build_from_cfg(cfg, registry, default_args) File "/root/miniconda3/lib/python3.8/site-packages/mmcv/utils/registry.py", line 171, in build_from_cfg return obj_cls(**args) File "/root/autodl-tmp/MADet/mmdet/models/detectors/madet.py", line 18, in init super(MADet, self).init(backbone, neck, bbox_head, train_cfg, File "/root/autodl-tmp/MADet/mmdet/models/detectors/single_stage.py", line 33, in init self.init_weights(pretrained=pretrained) File "/root/autodl-tmp/MADet/mmdet/models/detectors/single_stage.py", line 50, in init_weights self.bbox_head.init_weights() File "/root/autodl-tmp/MADet/mmdet/models/dense_heads/madet_head.py", line 177, in init_weights normal_init(self.dcn, std=0.01) File "/root/miniconda3/lib/python3.8/site-packages/mmcv/cnn/utils/weight_init.py", line 24, in normalinit nn.init.normal(module.weight, mean, std) File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 771, in getattr raise ModuleAttributeError("'{}' object has no attribute '{}'".format( torch.nn.modules.module.ModuleAttributeError: 'ConvModule' object has no attribute 'weight', looking forward to your reply.

ShichengMiao16 commented 11 months ago

Please check that the versions of your installed packages are consistent with those in the INSTALL instruction file. ---- Replied Message ---- | From | @.> | | Date | 11/06/2023 20:41 | | To | ShichengMiao16/MADet @.> | | Cc | Subscribed @.***> | | Subject | [ShichengMiao16/MADet] ConvModule' object has no attribute 'weight', (Issue #1) |

Please tell me, I use the be command python tools/train.py configs/madet/madet_r101_fpn_1x_coco.py for training, but an error like this occurs, nexpected key in source state_dict: fc.weight, fc.bias

Traceback (most recent call last): File "tools/train.py", line 185, in main() File "tools/train.py", line 158, in main model = build_detector( File "/root/autodl-tmp/MADet/mmdet/models/builder.py", line 67, in build_detector return build(cfg, DETECTORS, dict(train_cfg=train_cfg, test_cfg=test_cfg)) File "/root/autodl-tmp/MADet/mmdet/models/builder.py", line 32, in build return build_from_cfg(cfg, registry, default_args) File "/root/miniconda3/lib/python3.8/site-packages/mmcv/utils/registry.py", line 171, in build_from_cfg return obj_cls(**args) File "/root/autodl-tmp/MADet/mmdet/models/detectors/madet.py", line 18, in init super(MADet, self).init(backbone, neck, bbox_head, train_cfg, File "/root/autodl-tmp/MADet/mmdet/models/detectors/single_stage.py", line 33, in init self.init_weights(pretrained=pretrained) File "/root/autodl-tmp/MADet/mmdet/models/detectors/single_stage.py", line 50, in init_weights self.bbox_head.init_weights() File "/root/autodl-tmp/MADet/mmdet/models/dense_heads/madet_head.py", line 177, in init_weights normal_init(self.dcn, std=0.01) File "/root/miniconda3/lib/python3.8/site-packages/mmcv/cnn/utils/weight_init.py", line 24, in normalinit nn.init.normal(module.weight, mean, std) File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 771, in getattr raise ModuleAttributeError("'{}' object has no attribute '{}'".format( torch.nn.modules.module.ModuleAttributeError: 'ConvModule' object has no attribute 'weight', looking forward to your reply.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Alexwong-1024 commented 11 months ago

Thanks for the quick reply, I'll give it a try.

zhihuizhang628 commented 10 months ago

Thanks for the quick reply, I'll give it a try.

Hello, I encountered the same problem as you. How did you solve it? Can you provide specific methods or commands?

abcde-bit commented 2 months ago

Thanks for the quick reply, I'll give it a try.

Hello, I encountered the same problem as you. How did you solve it? Can you provide specific methods or commands?

Hello,brother.I also encountered the same problem as you. Is it a problem with CUDA and Pytorch versions? Did you install CUDA9.2 and pytorch 1.3.1.