Faster-rcnn.pytorch: torch.FatalError: invalid argument 2: out of range at /pytorch/aten/src/THC/generic/THCTensor.c:23

Created on 18 Sep 2018  Â·  10Comments  Â·  Source: jwyang/faster-rcnn.pytorch

Most helpful comment

Hi, can you fixed this problem? Thanks.
image

this is my solution

All 10 comments

how to resolve this problem?

@hongdayu it might because the rois exceed the input feature map. set a breakpoint to see when this happens.

Hi, can you fixed this problem? Thanks.

Hi, can you fixed this problem? Thanks.
image

this is my solution

Thank for your reply. this code lied in lib/model/fpn/fpn.py 131 and 147 ? I follow you, but another problem is occur:

Traceback (most recent call last):
File "trainval_net.py", line 324, in
data = data_iter.next()
File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 264, in __next__
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 264, in
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/wangshaoju/jwyang/fpn.pytorch/lib/roi_data_layer/roibatchLoader.py", line 150, in __getitem__
gt_boxes[:, 0] = gt_boxes[:, 0] - x_s
TypeError: sub() received an invalid combination of arguments - got (numpy.int64), but expected one of:

  • (Tensor other, float alpha)
  • (float other, float alpha)

Thanks!

Thank for your reply. this code lied in lib/model/fpn/fpn.py 131 and 147 ? I follow you, but another problem is occur:

Traceback (most recent call last):
File "trainval_net.py", line 324, in
data = data_iter.next()
File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 264, in next
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 264, in
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/wangshaoju/jwyang/fpn.pytorch/lib/roi_data_layer/roibatchLoader.py", line 150, in getitem
gt_boxes[:, 0] = gt_boxes[:, 0] - x_s
TypeError: sub() received an invalid combination of arguments - got (numpy.int64), but expected one of:

  • (Tensor other, float alpha)
  • (float other, float alpha)

Thanks!
the error
TypeError! The error occurred during the data loading phase.. the type of x_s is numpy.int64 , not tensor or float

Thank for your reply. this code lied in lib/model/fpn/fpn.py 131 and 147 ? I follow you, but another problem is occur:
Traceback (most recent call last):
File "trainval_net.py", line 324, in
data = data_iter.next()
File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 264, in next
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 264, in
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/wangshaoju/jwyang/fpn.pytorch/lib/roi_data_layer/roibatchLoader.py", line 150, in getitem
gt_boxes[:, 0] = gt_boxes[:, 0] - x_s
TypeError: sub() received an invalid combination of arguments - got (numpy.int64), but expected one of:

  • (Tensor other, float alpha)
  • (float other, float alpha)

Thanks!
the error
TypeError! The error occurred during the data loading phase.. the type of x_s is numpy.int64 , not tensor or float

Uploading image.png…

Thank for your reply. this code lied in lib/model/fpn/fpn.py 131 and 147 ? I follow you, but another problem is occur:
Traceback (most recent call last):
File "trainval_net.py", line 324, in
data = data_iter.next()
File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 264, in next
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 264, in
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/wangshaoju/jwyang/fpn.pytorch/lib/roi_data_layer/roibatchLoader.py", line 150, in getitem
gt_boxes[:, 0] = gt_boxes[:, 0] - x_s
TypeError: sub() received an invalid combination of arguments - got (numpy.int64), but expected one of:

  • (Tensor other, float alpha)
  • (float other, float alpha)

Thanks!
the error
TypeError! The error occurred during the data loading phase.. the type of x_s is numpy.int64 , not tensor or float

Thank for your reply. this code lied in lib/model/fpn/fpn.py 131 and 147 ? I follow you, but another problem is occur:
Traceback (most recent call last):
File "trainval_net.py", line 324, in
data = data_iter.next()
File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 264, in next
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 264, in
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/wangshaoju/jwyang/fpn.pytorch/lib/roi_data_layer/roibatchLoader.py", line 150, in getitem
gt_boxes[:, 0] = gt_boxes[:, 0] - x_s
TypeError: sub() received an invalid combination of arguments - got (numpy.int64), but expected one of:

  • (Tensor other, float alpha)
  • (float other, float alpha)

Thanks!
the error
TypeError! The error occurred during the data loading phase.. the type of x_s is numpy.int64 , not tensor or float

float(x_s)

Hi @hongdayu @liveway6, did you solve this issue? If so, can you please elaborate on the solution?

@hongdayu @jwyang @liveway6 @Karthik-Suresh93 @severian I changed the code :idx_l = (roi_level == l).nonzero().view(-1) , but the error still exit. Could you tell me how to fix it. Help!!!

@hongdayu @jwyang @liveway6 @Karthik-Suresh93 @severian I changed the code :idx_l = (roi_level == l).nonzero().view(-1) , but the error still exit. Could you tell me how to fix it. Help!!!

i have used your method and it works

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wanghan0501 picture wanghan0501  Â·  4Comments

HaiminZhang picture HaiminZhang  Â·  3Comments

twangnh picture twangnh  Â·  5Comments

Feiyu-Zhang picture Feiyu-Zhang  Â·  5Comments

MathewXiren picture MathewXiren  Â·  5Comments