question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RCNN_roi_align ERROR when training

See original GitHub issue

when I train the FPN network on my own dataset for several steps, it goes into the following error. Traceback (most recent call last): File "trainval_net.py", line 335, in <module> roi_labels = FPN(im_data, im_info, gt_boxes, num_boxes) File "/home/xiaolin/xlzhang/anaconda2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 491, in __call__ result = self.forward(*input, **kwargs) File "/home/xiaolin/xlzhang/anaconda2/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py", line 112, in forward return self.module(*inputs[0], **kwargs[0]) File "/home/xiaolin/xlzhang/anaconda2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 491, in __call__ result = self.forward(*input, **kwargs) File "/data/xlzhang/fpn.pytorch/lib/model/fpn/fpn.py", line 236, in forward roi_pool_feat = self._PyramidRoI_Feat(mrcnn_feature_maps, rois, im_info) File "/data/xlzhang/fpn.pytorch/lib/model/fpn/fpn.py", line 134, in _PyramidRoI_Feat feat = self.RCNN_roi_align(feat_maps[i], rois[idx_l], scale) File "/home/xiaolin/xlzhang/anaconda2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 491, in __call__ result = self.forward(*input, **kwargs) File "/data/xlzhang/fpn.pytorch/lib/model/roi_align/modules/roi_align.py", line 28, in forward scale)(features, rois) File "/data/xlzhang/fpn.pytorch/lib/model/roi_align/functions/roi_align.py", line 27, in forward rois, output) File "/home/xiaolin/xlzhang/anaconda2/lib/python2.7/site-packages/torch/utils/ffi/__init__.py", line 197, in safe_call result = torch._C._safe_call(*args, **kwargs) torch.FatalError: invalid argument 2: out of range at /opt/conda/conda-bld/pytorch_1524577177097/work/aten/src/THC/generic/THCTensor.c:23 Can anyone help me with this?

Thank you!

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

6reactions
AshStuffcommented, Jul 23, 2018

That is because you have only one roi_level in idx_l , you can print idx_l and see. The idx_l should be a list but when there is only 1 roi_level for a given l then you will get this error. you can change the line https://github.com/jwyang/fpn.pytorch/blob/master/lib/model/fpn/fpn.py#L131 to

               idx_l = (roi_level == l).nonzero()
                if idx_l.shape[0] > 1:
                    idx_l = idx_l.squeeze()
                else:
                    idx_l = idx_l.view(-1)
0reactions
xiaomengyccommented, Nov 23, 2019

I have the same problem, I want to know how to solve it ,thanks@xiaomengyc

Have you tried the solution provided by @AshStuff ? It has been a while since the last time I ran this code. As I recall, downgrading PyTorch version would work. You can try it in an environment with Python2.7 and PyTorch0.4.

Good Luck!

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Error using roialign" when training a Mask R-CNN model
I am trying to train a maskrcnn model with trainMaskRCNN() , but get the following error after a number of iterations:
Read more >
error while compling ROI Align · Issue #127 - GitHub
Hi, I meet a similar error when compiling roi align. ... /home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:87:5: error: ...
Read more >
An Optimized Faster R-CNN Method Based on DRNet and RoI ...
Aiming at the deficiency of traditional building remote sensing detection, an improved Faster R-CNN (region-based Convolutional Neural Network) algorithm ...
Read more >
How to Use ROI Pool and ROI Align in Your Neural Networks ...
First, clone jwyang's faster-rcnn.pytorch repository. Then make sure to checkout the pytorch-1.0 branch. This is important! The compilation ...
Read more >
Object distortion after ROI Align in Mask R-CNN
So my question is: After ROI Align, is the #2 feature map transformed from rectangular shape to square shape? If so the feature...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found