Open xuyu0010 opened 6 years ago
Do you use COCO or a custom dataset? Is the error still present if you use COCO together with the provided pretrained mask rcnn model converted from keras?
Hi, I am using COCO dataset. I haven't tried using the pretrained weight, I would try later to find out if the error still present. Thanks!
I used pretrained weights and I have received the same error.
I have used Mask RCNN module for many images and it worked nicely. However, I received the following error recently and I have no clue how to solve it. Could someone please help me? I have used the code from the github repo.
Traceback (most recent call last): File "/home/omkar/pycharm-community-2017.3.4/helpers/pydev/pydev_run_in_console.py", line 53, in run_file pydev_imports.execfile(file, globals, locals) # execute the script File "/home/omkar/pycharm-community-2017.3.4/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/omkar/PycharmProjects/mask_rcnn/demo.py", line 149, in result = model.detect([image]) File "/home/omkar/PycharmProjects/mask_rcnn/model.py", line 1599, in detect detections, mrcnn_mask = self.predict([molded_images, image_metas], mode='inference') File "/home/omkar/PycharmProjects/mask_rcnn/model.py", line 1674, in predict detections = detection_layer(self.config, rpn_rois, mrcnn_class, mrcnn_bbox, image_metas) File "/home/omkar/PycharmProjects/mask_rcnn/model.py", line 842, in detection_layer detections = refine_detections(rois, mrcnn_class, mrcnn_bbox, window, config) File "/home/omkar/PycharmProjects/mask_rcnn/model.py", line 787, in refine_detections keep = torch.nonzero(keep_bool)[:,0] File "/home/omkar/anaconda3/envs/mask_rcnn/lib/python3.6/site-packages/torch/autograd/variable.py", line 78, in getitem return Index.apply(self, key) File "/home/omkar/anaconda3/envs/mask_rcnn/lib/python3.6/site-packages/torch/autograd/_functions/tensor.py", line 89, in forward result = i.index(ctx.index) IndexError: trying to index 2 dimensions of a 0 dimensional tensor
Thanking you in anticipation. Regards, Omkar.
While the workaround mentioned by @merced may be sufficient for some cases, one should better handle the case where no detections are made.
Hi, I have trained the model using the code and have stored the model in mask_rcnn_coco.pth. However when I try to run: python demo.py I am not able to run the demo script and the error is shown: Traceback (most recent call last): File "demo.py", line 75, in
results = model.detect([image])
File "/phd/pytorch-mask-rcnn/model.py", line 1598, in detect
detections, mrcnn_mask = self.predict([molded_images, image_metas], mode='inference')
File "/phd/pytorch-mask-rcnn/model.py", line 1673, in predict
detections = detection_layer(self.config, rpn_rois, mrcnn_class, mrcnn_bbox, image_metas)
File "/phd/pytorch-mask-rcnn/model.py", line 841, in detection_layer
detections = refine_detections(rois, mrcnn_class, mrcnn_bbox, window, config)
File "/phd/pytorch-mask-rcnn/model.py", line 786, in refine_detections
keep = torch.nonzero(keep_bool)[:,0]
File "/home/xyc/anaconda3/envs/map-seg-py35/lib/python3.5/site-packages/torch/autograd/variable.py", line 78, in getitem
return Index.apply(self, key)
File "/home/xyc/anaconda3/envs/map-seg-py35/lib/python3.5/site-packages/torch/autograd/_functions/tensor.py", line 89, in forward
result = i.index(ctx.index)
IndexError: trying to index 2 dimensions of a 0 dimensional tensor
Wondering if you can replicate this problem? I am running on Titan XP. The training seems all right. Thanks!