mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

Open Tianhao-Qi opened this issue 2 years ago • 7 comments

use cascade mask rcnn and add num_convs=2 to rpn_head, however, I get the following errors: image

Environment image

Tianhao-Qi avatar May 08 '22 08:05 Tianhao-Qi

Could you provide a config so that we can reproduce the error?

ZwwWayne avatar May 17 '22 14:05 ZwwWayne

Could you provide a config so that we can reproduce the error?

Hi, @ZwwWayne

I have same issue too, it can be fixed by changing this line to:

x = x + self.lateral_convs[i](feat)

liming-ai avatar May 23 '22 09:05 liming-ai

Could you provide a config so that we can reproduce the error?

The config file I used is configs/simple_copy_paste/mask_rcnn_r50_fpn_syncbn-all_rpn-2conv_ssj_scp_32x2_270k_coco.py.

Tianhao-Qi avatar May 23 '22 12:05 Tianhao-Qi

In my environment, the following fix resolves the error. https://github.com/open-mmlab/mmdetection/blob/ca11860f4f3c3ca2ce8340e2686eeaec05b29111/mmdet/models/dense_heads/rpn_head.py#L65

x = F.relu(x, inplace=False)
  • faster_rcnn_r50_fpn_1x_coco.py: no error
  • faster_rcnn_r50_fpn_1x_coco.py, --cfg-options "model.rpn_head.num_convs=2": error
  • faster_rcnn_r50_fpn_1x_coco.py, --cfg-options "model.rpn_head.num_convs=2", x = F.relu(x, inplace=False): no error

shinya7y avatar Jun 25 '22 21:06 shinya7y

Solov2 head returns the same problem for me. Has anyone fixed that yet?

AT1981 avatar Jun 29 '22 18:06 AT1981

Solov2 head returns the same problem for me. Has anyone fixed that yet?

Yeap, [here](https://github.com/open-mmlab/mmdetection/blob/ca11860f4f3c3ca2ce8340e2686eeaec05b29111/mmdet/models/dense_heads/solov2_head.py#:~:text=%2B%3D%20self.-,convs_all_levels,-%5Bi%5D( ) change to feature_add_all_level = feature_add_all_level + self.convs_all_levels[i](input_p)

mzillag avatar Jul 27 '22 11:07 mzillag

This issue is marked as stale because it has been marked as invalid or awaiting response for 7 days without any further response. It will be closed in 5 days if the stale label is not removed or if there is no further response.

github-actions[bot] avatar Sep 18 '22 11:09 github-actions[bot]

This issue is closed because it has been stale for 5 days. Please open a new issue if you have similar issues or you have any new updates now.

github-actions[bot] avatar Sep 23 '22 11:09 github-actions[bot]