Open XUDINGYI312 opened 3 years ago
@XUDINGYI312 HI,how did you fix this problem?
@XdpAreKid change the
if getattr(self.heads, "mask_on", False): mock_ctx_managers += [mock_mask_rcnn_inference(tensor_mode, mask_head_mod,False)]
at F:\BMaskR-CNN\detectron2\export \caff2_patch.py or patcher.py
And can need to change the mask_head.py at F:\BMaskR-CNN\detectron2\modeling\roi_heads\mask_head.py
def mask_rcnn_inference(pred_mask_logits, pred_instances): cls_agnostic_mask = pred_mask_logits.size(1) == 1 if cls_agnostic_mask:
mask_probs_pred = pred_mask_logits.sigmoid()
else:
mask_probs_pred = pred_mask_logits.sigmoid()
mask_probs_pred = alias(mask_probs_pred, "mask_fcn_probs")
pred_instances[0].pred_masks = mask_probs_pred
the error is :
File "F:\BMaskR-CNN\projects\BMaskR-CNN\bmaskrcnn\mask_head.py", line 278, in forward mask_rcnn_inference(mask_logits, instances) File "f:\bmaskr-cnn\detectron2\modeling\roi_heads\mask_head.py", line 146, in mask_rcnn_inference mask_probs_pred = pred_mask_logits[indices, class_pred][:, None].sigmoid() IndexError: tensors used as indices must be long, byte or bool tensors
than change the mask_head.py ; def mask_rcnn_inference(pred_mask_logits, pred_instances): class_pred = cat([i.pred_classes for i in pred_instances]).type(torch.long)
the error is : return cm_exit(cm, *exc_details) File "D:\Anaconda3\envs\NBMASK\lib\contextlib.py", line 88, in exit next(self.gen) File "f:\bmaskr-cnn\detectron2\export\patcher.py", line 101, in mock_mask_rcnn_inference assert mocked_func.call_count > 0 AssertionError
I want to know how to change myself model to caffe2 model.