Open satyajithj opened 5 years ago
The Computing the predictions step evaluates to
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-8-ba06eae97bcc> in <module> 1 # compute predictions ----> 2 predictions = coco_demo.run_on_opencv_image(image) 3 imshow(predictions) ~/src/maskrcnn-benchmark_fb/demo/predictor.py in run_on_opencv_image(self, image) 123 the BoxList via `prediction.fields()` 124 """ --> 125 predictions = self.compute_prediction(image) 126 top_predictions = self.select_top_predictions(predictions) 127 ~/src/maskrcnn-benchmark_fb/demo/predictor.py in compute_prediction(self, original_image) 156 # compute predictions 157 with torch.no_grad(): --> 158 predictions = self.model(image_list) 159 predictions = [o.to(self.cpu_device) for o in predictions] 160 ~/.local/lib/python3.5/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs) 537 result = self._slow_forward(*input, **kwargs) 538 else: --> 539 result = self.forward(*input, **kwargs) 540 for hook in self._forward_hooks.values(): 541 hook_result = hook(self, input, result) ~/src/maskrcnn-benchmark/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py in forward(self, images, targets) 53 proposals, proposal_losses = self.rpn(images, features, targets) 54 if self.roi_heads: ---> 55 x, result, detector_losses = self.roi_heads(features, proposals, targets) 56 else: 57 # RPN-only models don't have roi_heads ~/.local/lib/python3.5/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs) 537 result = self._slow_forward(*input, **kwargs) 538 else: --> 539 result = self.forward(*input, **kwargs) 540 for hook in self._forward_hooks.values(): 541 hook_result = hook(self, input, result) ~/src/maskrcnn-benchmark/maskrcnn_benchmark/modeling/roi_heads/roi_heads.py in forward(self, features, proposals, targets) 27 losses = {} 28 # TODO rename x to roi_box_features, if it doesn't increase memory consumption ---> 29 x, detections, loss_box = self.box(features, proposals, targets) 30 losses.update(loss_box) 31 if self.cfg.MODEL.MASK_ON: ~/.local/lib/python3.5/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs) 537 result = self._slow_forward(*input, **kwargs) 538 else: --> 539 result = self.forward(*input, **kwargs) 540 for hook in self._forward_hooks.values(): 541 hook_result = hook(self, input, result) ~/src/maskrcnn-benchmark/maskrcnn_benchmark/modeling/roi_heads/box_head/box_head.py in forward(self, features, proposals, targets) 53 54 if not self.training: ---> 55 result = self.post_processor((class_logits, box_regression), proposals) 56 return x, result, {} 57 ~/.local/lib/python3.5/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs) 537 result = self._slow_forward(*input, **kwargs) 538 else: --> 539 result = self.forward(*input, **kwargs) 540 for hook in self._forward_hooks.values(): 541 hook_result = hook(self, input, result) ~/src/maskrcnn-benchmark/maskrcnn_benchmark/modeling/roi_heads/box_head/inference.py in forward(self, x, boxes) 122 boxlist = boxlist.clip_to_image(remove_empty=False) 123 if not self.bbox_aug_enabled: # If bbox aug is enabled, we will do it later --> 124 boxlist = self.filter_results(boxlist, num_classes) 125 results.append(boxlist) 126 return results ~/src/maskrcnn-benchmark/maskrcnn_benchmark/modeling/roi_heads/box_head/inference.py in filter_results(self, boxlist, num_classes) 180 else: 181 keep = self.detections_to_keep(scores) --> 182 result = result[keep] 183 return result 184 ~/src/maskrcnn-benchmark/maskrcnn_benchmark/structures/bounding_box.py in __getitem__(self, item) 218 219 def __getitem__(self, item): --> 220 bbox = BoxList(self.bbox[item], self.size, self.mode) 221 for k, v in self.extra_fields.items(): 222 bbox.add_field(k, v[item]) ~/src/maskrcnn-benchmark/maskrcnn_benchmark/structures/bounding_box.py in __init__(self, bbox, image_size, mode) 24 if bbox.ndimension() != 2: 25 raise ValueError( ---> 26 "bbox should have 2 dimensions, got {}".format(bbox.ndimension()) 27 ) 28 if bbox.size(-1) != 4: ValueError: bbox should have 2 dimensions, got 3
Can you provide more details?
❓ Questions and Help
The Computing the predictions step evaluates to