pytorch-faster-rcnn icon indicating copy to clipboard operation
pytorch-faster-rcnn copied to clipboard

RuntimeError: shape '[516096, -1]' is invalid for input of size 2095104

Open deepaksinghcv opened this issue 4 years ago • 3 comments

I modified the data_root_dir in train_config.py and also placed the data as mentioned in the README.md I face this error:

/home/dksingh/anaconda3/envs/mmdet220/lib/python3.7/site-packages/torch/nn/functional.py:3000: UserWarning: The default behavior for interpolate/upsample with float scale
_factor changed in 1.6.0 to align with other frameworks/libraries, and uses scale_factor directly, instead of relying on the computed output size. If you wish to keep the
 old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. 
  warnings.warn("The default behavior for interpolate/upsample with float scale_factor changed "
Traceback (most recent call last):
  File "train.py", line 132, in <module>
    main()
  File "train.py", line 84, in main
    print_freq=50, warmup=False)
  File "/home/dksingh/codes/clones/pytorch-faster-rcnn/utils/train_utils.py", line 373, in train_one_epoch
    loss_dict = model(images, targets)
  File "/home/dksingh/anaconda3/envs/mmdet220/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/dksingh/codes/clones/pytorch-faster-rcnn/utils/faster_rcnn_utils.py", line 85, in forward
    proposals, proposal_losses = self.rpn(images, features, targets)
  File "/home/dksingh/anaconda3/envs/mmdet220/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/dksingh/codes/clones/pytorch-faster-rcnn/utils/rpn_utils.py", line 290, in forward
    proposals = self.box_coder.decode(pred_bbox_deltas.detach(), anchors)
  File "/home/dksingh/codes/clones/pytorch-faster-rcnn/utils/det_utils.py", line 182, in decode
    rel_codes.reshape(box_sum, -1), concat_boxes
RuntimeError: shape '[516096, -1]' is invalid for input of size 2095104

deepaksinghcv avatar Feb 08 '21 11:02 deepaksinghcv

This occurs when i used resnet50_fpn as the backbone

deepaksinghcv avatar Feb 08 '21 13:02 deepaksinghcv

I changed anchor_size from [64, 128, 256] to [32, 64, 128, 256, 512] in train_config.py

djkim3 avatar Mar 05 '21 04:03 djkim3