zhoubenjia / MotionRGBD-PAMI

MIT License
19 stars 2 forks source link

初始化或恢复模型的状态时发生了尺寸不匹配问题 #9

Closed fygfff closed 3 months ago

fygfff commented 3 months ago

Traceback (most recent call last): File "G:\yanjiu\lunwen1\DUO\daima\MotionRGBD-PAMI-main\train_fusion.py", line 713, in main(args) File "G:\yanjiu\lunwen1\DUO\daima\MotionRGBD-PAMI-main\train_fusion.py", line 349, in main captuer = FeatureCapter(args, num_classes=args.num_classes) File "G:\yanjiu\lunwen1\DUO\daima\MotionRGBD-PAMI-main\lib\model\fusion_Net.py", line 374, in init self.strat_epoch_r, best_acc = load_checkpoint(self.Modalit_rgb, rgb_checkpoint) File "G:\yanjiu\lunwen1\DUO\daima\MotionRGBD-PAMI-main\utils\utils.py", line 119, in load_checkpoint model.load_state_dict(checkpoint['model']) File "E:\anaconda\envs\mrgbd\lib\site-packages\torch\nn\modules\module.py", line 1497, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for DSN: size mismatch for SMS_layers.1.q.weight: copying a param with shape torch.Size([512, 32]) from checkpoint, the shape in current model is torch.Size([256, 16]). size mismatch for SMS_layers.1.k.weight: copying a param with shape torch.Size([512, 32]) from checkpoint, the shape in current model is torch.Size([256, 16]). size mismatch for SMS_layers.1.TM_project.0.weight: copying a param with shape torch.Size([64, 32]) from checkpoint, the shape in current model is torch.Size([32, 16]). size mismatch for SMS_layers.1.TM_project.2.weight: copying a param with shape torch.Size([32, 64]) from checkpoint, the shape in current model is torch.Size([16, 32]). size mismatch for SMS_layers.1.TM_project.3.weight: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for SMS_layers.1.TM_project.3.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for SMS_layers.1.linear.weight: copying a param with shape torch.Size([512, 32]) from checkpoint, the shape in current model is torch.Size([512, 16]). size mismatch for SMS_layers.3.q.weight: copying a param with shape torch.Size([512, 32]) from checkpoint, the shape in current model is torch.Size([256, 16]). size mismatch for SMS_layers.3.k.weight: copying a param with shape torch.Size([512, 32]) from checkpoint, the shape in current model is torch.Size([256, 16]). size mismatch for SMS_layers.3.TM_project.0.weight: copying a param with shape torch.Size([64, 32]) from checkpoint, the shape in current model is torch.Size([32, 16]). size mismatch for SMS_layers.3.TM_project.2.weight: copying a param with shape torch.Size([32, 64]) from checkpoint, the shape in current model is torch.Size([16, 32]). size mismatch for SMS_layers.3.TM_project.3.weight: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for SMS_layers.3.TM_project.3.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for SMS_layers.3.linear.weight: copying a param with shape torch.Size([512, 32]) from checkpoint, the shape in current model is torch.Size([512, 16]). size mismatch for SMS_layers.6.q.weight: copying a param with shape torch.Size([512, 32]) from checkpoint, the shape in current model is torch.Size([256, 16]). size mismatch for SMS_layers.6.k.weight: copying a param with shape torch.Size([512, 32]) from checkpoint, the shape in current model is torch.Size([256, 16]). size mismatch for SMS_layers.6.TM_project.0.weight: copying a param with shape torch.Size([64, 32]) from checkpoint, the shape in current model is torch.Size([32, 16]). size mismatch for SMS_layers.6.TM_project.2.weight: copying a param with shape torch.Size([32, 64]) from checkpoint, the shape in current model is torch.Size([16, 32]). size mismatch for SMS_layers.6.TM_project.3.weight: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for SMS_layers.6.TM_project.3.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for SMS_layers.6.linear.weight: copying a param with shape torch.Size([512, 32]) from checkpoint, the shape in current model is torch.Size([512, 16]). size mismatch for dtn.cls_tokens.0.pos_embedding: copying a param with shape torch.Size([1, 17, 512]) from checkpoint, the shape in current model is torch.Size([1, 9, 512]). size mismatch for dtn.cls_tokens.1.pos_embedding: copying a param with shape torch.Size([1, 33, 512]) from checkpoint, the shape in current model is torch.Size([1, 17, 512]). size mismatch for dtn.cls_tokens.2.pos_embedding: copying a param with shape torch.Size([1, 49, 512]) from checkpoint, the shape in current model is torch.Size([1, 25, 512]). size mismatch for dtn.multi_scale_transformers.0.0.b1b.conv3d.weight: copying a param with shape torch.Size([224, 112, 4, 1, 1]) from checkpoint, the shape in current model is torch.Size([224, 112, 2, 1, 1]). size mismatch for dtn.multi_scale_transformers.0.0.b2b.conv3d.weight: copying a param with shape torch.Size([64, 24, 4, 1, 1]) from checkpoint, the shape in current model is torch.Size([64, 24, 2, 1, 1]). size mismatch for dtn.multi_scale_transformers.1.0.b1b.conv3d.weight: copying a param with shape torch.Size([224, 112, 5, 1, 1]) from checkpoint, the shape in current model is torch.Size([224, 112, 4, 1, 1]). size mismatch for dtn.multi_scale_transformers.1.0.b2b.conv3d.weight: copying a param with shape torch.Size([64, 24, 5, 1, 1]) from checkpoint, the shape in current model is torch.Size([64, 24, 4, 1, 1]). size mismatch for dtn.multi_scale_transformers.2.0.b1b.conv3d.weight: copying a param with shape torch.Size([224, 112, 6, 1, 1]) from checkpoint, the shape in current model is torch.Size([224, 112, 4, 1, 1]). size mismatch for dtn.multi_scale_transformers.2.0.b2b.conv3d.weight: copying a param with shape torch.Size([64, 24, 6, 1, 1]) from checkpoint, the shape in current model is torch.Size([64, 24, 4, 1, 1]).