Open TianBaoGe opened 2 years ago
RuntimeError: Error(s) in loading state_dict for CT: size mismatch for det_head.loc_loss.coord: copying a param with shape torch.Size([541696, 2]) from checkpoint, the shape in current model is torch.Size([409600, 2]).
when I use the release checkpoint file, I meet this issue, is there something wrong with your loss code?
Epoch: [1 | 600] /home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/functional.py:3325: UserWarning: nn.functional.upsample is deprecated. Use nn.functional.interpolate instead. warnings.warn("nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.") /home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/functional.py:3451: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details. warnings.warn( torch.Size([409600]) Traceback (most recent call last): File "train.py", line 218, in main(args) File "train.py", line 198, in main train(train_loader, model, optimizer, epoch, start_iter, cfg) File "train.py", line 57, in train outputs = model(data) File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 165, in forward return self.module(inputs[0], kwargs[0]) File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/data/linailiang/CentripetalText-main/models/ct.py", line 99, in forward det_loss = self.det_head.loss(det_out, gt_kernels, training_masks, gt_instances, gt_kernel_instances, training_mask_distances, gt_distances) File "/data/linailiang/CentripetalText-main/models/head/ct_head.py", line 218, in loss loss_loc, iou_text = self.loc_loss(distances, gt_instances, gt_kernel_instances, training_mask_distances, gt_distances, reduce=False) File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, **kwargs) File "/data/linailiang/CentripetalText-main/models/loss/smooth_l1_loss.py", line 48, in forward self.select_single(distances[i, :, :, :], gt_instances[i, :, :], File "/data/linailiang/CentripetalText-main/models/loss/smooth_l1_loss.py", line 38, in select_single selected_mask = selected_mask.contiguous().view(1, -1, distance.shape[-1]).long() RuntimeError: shape '[1, -1, 736]' is invalid for input of size 409600
Is anything wrong about the configuration of MSRA? The code works well on CTW and Total-Text
Is this problem solved? I also encountered this problem
Epoch: [1 | 600] /home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/functional.py:3325: UserWarning: nn.functional.upsample is deprecated. Use nn.functional.interpolate instead. warnings.warn("nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.") /home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/functional.py:3451: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details. warnings.warn( torch.Size([409600]) Traceback (most recent call last): File "train.py", line 218, in main(args) File "train.py", line 198, in main train(train_loader, model, optimizer, epoch, start_iter, cfg) File "train.py", line 57, in train outputs = model(data) File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 165, in forward return self.module(inputs[0], kwargs[0]) File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/data/linailiang/CentripetalText-main/models/ct.py", line 99, in forward det_loss = self.det_head.loss(det_out, gt_kernels, training_masks, gt_instances, gt_kernel_instances, training_mask_distances, gt_distances) File "/data/linailiang/CentripetalText-main/models/head/ct_head.py", line 218, in loss loss_loc, iou_text = self.loc_loss(distances, gt_instances, gt_kernel_instances, training_mask_distances, gt_distances, reduce=False) File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, **kwargs) File "/data/linailiang/CentripetalText-main/models/loss/smooth_l1_loss.py", line 48, in forward self.select_single(distances[i, :, :, :], gt_instances[i, :, :], File "/data/linailiang/CentripetalText-main/models/loss/smooth_l1_loss.py", line 38, in select_single selected_mask = selected_mask.contiguous().view(1, -1, distance.shape[-1]).long() RuntimeError: shape '[1, -1, 736]' is invalid for input of size 409600 Is anything wrong about the configuration of MSRA? The code works well on CTW and Total-Text
Is this problem solved? I also encountered this problem
我也遇到了这个问题,请问您解决了么
Epoch: [1 | 600] /home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/functional.py:3325: UserWarning: nn.functional.upsample is deprecated. Use nn.functional.interpolate instead. warnings.warn("nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.") /home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/functional.py:3451: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details. warnings.warn( torch.Size([409600]) Traceback (most recent call last): File "train.py", line 218, in
main(args)
File "train.py", line 198, in main
train(train_loader, model, optimizer, epoch, start_iter, cfg)
File "train.py", line 57, in train
outputs = model(data)
File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, *kwargs)
File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 165, in forward
return self.module(inputs[0], kwargs[0])
File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, *kwargs)
File "/data/linailiang/CentripetalText-main/models/ct.py", line 99, in forward
det_loss = self.det_head.loss(det_out, gt_kernels, training_masks, gt_instances, gt_kernel_instances, training_mask_distances, gt_distances)
File "/data/linailiang/CentripetalText-main/models/head/ct_head.py", line 218, in loss
loss_loc, iou_text = self.loc_loss(distances, gt_instances, gt_kernel_instances, training_mask_distances, gt_distances, reduce=False)
File "/home/ubuntu/anaconda3/envs/tb/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(input, **kwargs)
File "/data/linailiang/CentripetalText-main/models/loss/smooth_l1_loss.py", line 48, in forward
self.select_single(distances[i, :, :, :], gt_instances[i, :, :],
File "/data/linailiang/CentripetalText-main/models/loss/smooth_l1_loss.py", line 38, in select_single
selected_mask = selected_mask.contiguous().view(1, -1, distance.shape[-1]).long()
RuntimeError: shape '[1, -1, 736]' is invalid for input of size 409600
Is anything wrong about the configuration of MSRA? The code works well on CTW and Total-Text