jwyang / faster-rcnn.pytorch

A faster pytorch implementation of faster r-cnn
MIT License
7.66k stars 2.33k forks source link

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

Open 0xTechSavvy opened 6 years ago

0xTechSavvy commented 6 years ago

image

0xTechSavvy commented 6 years ago

how to resolve this problem?

jwyang commented 6 years ago

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

liveway6 commented 5 years ago

Hi, can you fixed this problem? Thanks.

0xTechSavvy commented 5 years ago

Hi, can you fixed this problem? Thanks. image

this is my solution

liveway6 commented 5 years ago

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:

Thanks!

0xTechSavvy commented 5 years ago

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

0xTechSavvy commented 5 years ago

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)

Karthik-Suresh93 commented 5 years ago

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

E-Dreamer-LQ commented 5 years ago

@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!!!

Marcus208 commented 5 years ago

@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