Open fairytalell opened 4 years ago
我使用detectron2运行了heatmap.py,但是遇到了一下问题。
[{'instances': Instances(num_instances=0, image_height=1024, image_width=1024, fields=[pred_boxes: Boxes(tensor([], size=(0, 4), grad_fn=)), scores: tensor([], grad_fn=), pred_classes: tensor([], dtype=torch.int64), indices: tensor([], dtype=torch.int64)])}] Traceback (most recent call last): File "/home/dxy/ll/obj_competition/detectron2框架/heatmap.py", line 160, in mask, box, class_id = grad_cam(inputs) # cam mask File "/home/dxy/ll/obj_competition/detectron2框架/grad_cam.py", line 52, in call score = output[0]['instances'].scores[index] IndexError: index 0 is out of bounds for dimension 0 with size 0
通过debug,发现是grad_cam.py中output = self.net.inference([inputs]) 的输出为空 ,准确的说是roi 为空。请问有哪位遇到了同样的问题?
@fairytalell 感谢您的反馈,麻烦发一个测试的图像和命令
To me it looks like there was no instance detected and hence the empty indices and scores. Would suggest to try with some other image
邮件已收到!
我使用detectron2运行了heatmap.py,但是遇到了一下问题。
[{'instances': Instances(num_instances=0, image_height=1024, image_width=1024, fields=[pred_boxes: Boxes(tensor([], size=(0, 4), grad_fn=)), scores: tensor([], grad_fn=), pred_classes: tensor([], dtype=torch.int64), indices: tensor([], dtype=torch.int64)])}]
Traceback (most recent call last):
File "/home/dxy/ll/obj_competition/detectron2框架/heatmap.py", line 160, in
mask, box, class_id = grad_cam(inputs) # cam mask
File "/home/dxy/ll/obj_competition/detectron2框架/grad_cam.py", line 52, in call
score = output[0]['instances'].scores[index]
IndexError: index 0 is out of bounds for dimension 0 with size 0
通过debug,发现是grad_cam.py中output = self.net.inference([inputs]) 的输出为空 ,准确的说是roi 为空。请问有哪位遇到了同样的问题?