the network can train for some batches. But it occurs the error at line 76 of im = im[:,:,::-1] int the file of minibatch. The error is as follows:
IndexError: too many indices for array
Do you know why?@jwyang
@qinghua2016, in my case partially reverting this commit for minibatch.py only solved the problem. I've left blob.py intact because of partial revert under this commit.
For some of the images in my dataset imread (from scipy.misc) failed to load the image properly thus the empty image array and IndexError at runtime. This was not the case for PASCAL VOC on which I've did sanity check at first, probably the reason why it didn't surface earlier.
Yes, it it because the function of imread, I change it to cv2.imread.
i have the same issue, did you reslove it?
Hi@qinghua2016
I tried to connect to the webcam and perform real-time detection, which can be detected in real time and the frame rate is about 7~8fps. After a while, the following error will occur:
[h264 @ 0x305adc0] negative number of zero coeffs at 24 66
[h264 @ 0x305adc0] error while decoding MB 24 66
.........
Traceback (most recent call last):
聽聽 File "demo1.py", line 300, in
聽聽聽聽 Im = im_in[:,:,::-1]
IndexError: too many indices for array
I also tried changing imread to cv2.imread, but it didn't work. Can you give me some suggestions? Very grateful
openCV reads in a different format than SciPy's imread..
Also be careful you are not seeing the alpha channel, for .png files I had to drop the alpha channel before training.. unsure about the demo.
https://github.com/jwyang/faster-rcnn.pytorch/blob/pytorch-1.0/README.md#compilation
I also meet this problem, and the network can train for some batches:
[session 1][epoch 1][iter 0/6010] loss: 4.3751, lr: 1.00e-03
fg/bg=(19/237), time cost: 0.568970
rpn_cls: 0.7304, rpn_box: 0.1666, rcnn_cls: 3.2561, rcnn_box 0.2220
[session 1][epoch 1][iter 10/6010] loss: nan, lr: 1.00e-03
fg/bg=(256/0), time cost: 5.401626
rpn_cls: nan, rpn_box: nan, rcnn_cls: nan, rcnn_box nan
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
[session 1][epoch 1][iter 20/6010] loss: nan, lr: 1.00e-03
fg/bg=(0/256), time cost: 5.431592
rpn_cls: nan, rpn_box: nan, rcnn_cls: nan, rcnn_box nan
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
Warning: NaN or Inf found in input tensor.
[session 1][epoch 1][iter 30/6010] loss: nan, lr: 1.00e-03
fg/bg=(256/0), time cost: 5.347545
rpn_cls: nan, rpn_box: nan, rcnn_cls: nan, rcnn_box nan
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/xx/Research/faster-rcnn.pytorch-master/lib/roi_data_layer/roibatchLoader.py", line 67, in __getitem__
blobs = get_minibatch(minibatch_db, self._num_classes)
File "/home/xx/Research/faster-rcnn.pytorch-master/lib/roi_data_layer/minibatch.py", line 30, in get_minibatch
im_blob, im_scales = _get_image_blob(roidb, random_scale_inds)
File "/home/xx/Research/faster-rcnn.pytorch-master/lib/roi_data_layer/minibatch.py", line 73, in _get_image_blob
im = im[:,:,::-1]
IndexError: too many indices for array
Yes, it it because the function of imread, I change it to cv2.imread.
I take this method it can work ,but meet other problem, the train result as follow:
WARNING:root:NaN or Inf found in input tensor.
WARNING:root:NaN or Inf found in input tensor.
WARNING:root:NaN or Inf found in input tensor.
WARNING:root:NaN or Inf found in input tensor.
WARNING:root:NaN or Inf found in input tensor.
WARNING:root:NaN or Inf found in input tensor.
[session 1][epoch 1][iter 900/5290] loss: nan, lr: 1.00e-03
fg/bg=(128/0), time cost: 20.427851
rpn_cls: nan, rpn_box: nan, rcnn_cls: 2.3916, rcnn_box 0.0000
how to deal with this problem? please give me help,thank you very much
Most helpful comment
@qinghua2016, in my case partially reverting this commit for minibatch.py only solved the problem. I've left blob.py intact because of partial revert under this commit.
For some of the images in my dataset imread (from scipy.misc) failed to load the image properly thus the empty image array and IndexError at runtime. This was not the case for PASCAL VOC on which I've did sanity check at first, probably the reason why it didn't surface earlier.