j96w/DenseFusion

RuntimeError: the derivative for 'indices' is not implemented

Opened this issue · 0 comments

pytorch2onnx.py:299: UserWarning: Arguments like --mean, --std, --dataset would be parsed directly from config file and are deprecated and will be removed in future releases.
will be removed in future releases.')
/usr/local/lib/python3.7/dist-packages/mmdet/core/anchor/builder.py:17: UserWarning: build_anchor_generator would be deprecated soon, please use build_prior_generator
'build_anchor_generator would be deprecated soon, please use '
Use load_from_local loader
/usr/local/lib/python3.7/dist-packages/mmdet/core/anchor/anchor_generator.py:324: UserWarning: grid_anchors would be deprecated soon. Please use grid_priors
warnings.warn('grid_anchors would be deprecated soon. '
/usr/local/lib/python3.7/dist-packages/mmdet/core/anchor/anchor_generator.py:361: UserWarning: single_level_grid_anchors would be deprecated soon. Please use single_level_grid_priors
'single_level_grid_anchors would be deprecated soon. '
/usr/local/lib/python3.7/dist-packages/mmdet/models/dense_heads/rpn_head.py:287: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
cfg.nms_pre, device=cls_scores[0].device, dtype=torch.long)
/usr/local/lib/python3.7/dist-packages/mmdet/models/dense_heads/rpn_head.py:291: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert rpn_cls_score.size()[-2:] == rpn_bbox_pred.size()[-2:]
/usr/local/lib/python3.7/dist-packages/mmdet/core/export/onnx_helper.py:63: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if k <= 0 or size <= 0:
/usr/local/lib/python3.7/dist-packages/mmdet/models/dense_heads/rpn_head.py:310: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if nms_pre > 0:
/usr/local/lib/python3.7/dist-packages/mmdet/models/dense_heads/rpn_head.py:311: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
_, topk_inds = scores.topk(nms_pre)
/usr/local/lib/python3.7/dist-packages/mmdet/core/bbox/coder/delta_xywh_bbox_coder.py:88: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert pred_bboxes.size(0) == bboxes.size(0)
/usr/local/lib/python3.7/dist-packages/mmdet/core/bbox/coder/delta_xywh_bbox_coder.py:90: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert pred_bboxes.size(1) == bboxes.size(1)
/usr/local/lib/python3.7/dist-packages/mmdet/core/export/onnx_helper.py:119: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
iou_threshold = torch.tensor([iou_threshold], dtype=torch.float32)
/usr/local/lib/python3.7/dist-packages/mmdet/core/export/onnx_helper.py:120: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
score_threshold = torch.tensor([score_threshold], dtype=torch.float32)
/usr/local/lib/python3.7/dist-packages/mmdet/core/export/onnx_helper.py:124: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
nms_pre = torch.tensor(pre_top_k, device=scores.device, dtype=torch.long)
/usr/local/lib/python3.7/dist-packages/mmdet/core/export/onnx_helper.py:148: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
batch_inds = torch.randint(batch_size, (num_fake_det, 1))
/usr/local/lib/python3.7/dist-packages/mmdet/core/export/onnx_helper.py:149: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
cls_inds = torch.randint(num_class, (num_fake_det, 1))
/usr/local/lib/python3.7/dist-packages/mmdet/core/export/onnx_helper.py:150: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
box_inds = torch.randint(num_box, (num_fake_det, 1))
/usr/local/lib/python3.7/dist-packages/mmdet/core/export/onnx_helper.py:181: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
after_top_k, device=scores.device, dtype=torch.long)
/usr/local/lib/python3.7/dist-packages/mmdet/core/export/onnx_helper.py:184: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if nms_after > 0:
/usr/local/lib/python3.7/dist-packages/mmdet/core/export/onnx_helper.py:185: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
_, topk_inds = scores.topk(nms_after)
/usr/local/lib/python3.7/dist-packages/mmcv/ops/roi_align.py:80: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert rois.size(1) == 5, 'RoI must be (idx, x1, y1, x2, y2)!'
Traceback (most recent call last):
File "pytorch2onnx.py", line 345, in
skip_postprocess=args.skip_postprocess)
File "pytorch2onnx.py", line 100, in pytorch2onnx
dynamic_axes=dynamic_axes)
File "/usr/local/lib/python3.7/dist-packages/torch/onnx/init.py", line 168, in export
custom_opsets, enable_onnx_checker, use_external_data_format)
File "/usr/local/lib/python3.7/dist-packages/torch/onnx/utils.py", line 69, in export
use_external_data_format=use_external_data_format)
File "/usr/local/lib/python3.7/dist-packages/torch/onnx/utils.py", line 488, in _export
fixed_batch_size=fixed_batch_size)
File "/usr/local/lib/python3.7/dist-packages/torch/onnx/utils.py", line 334, in _model_to_graph
graph, torch_out = _trace_and_get_graph_from_model(model, args, training)
File "/usr/local/lib/python3.7/dist-packages/torch/onnx/utils.py", line 291, in _trace_and_get_graph_from_model
torch.jit._get_trace_graph(model, args, _force_outplace=False, _return_inputs_states=True)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/init.py", line 278, in _get_trace_graph
outs = ONNXTracedModule(f, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/init.py", line 361, in forward
self._force_outplace,
File "/usr/local/lib/python3.7/dist-packages/torch/jit/init.py", line 348, in wrapper
outs.append(self.inner(*trace_inputs))
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 548, in call
result = self._slow_forward(*input, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 534, in _slow_forward
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/mmcv/runner/fp16_utils.py", line 98, in new_func
return old_func(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/mmdet/models/detectors/base.py", line 169, in forward
return self.onnx_export(img[0], img_metas[0])
File "/usr/local/lib/python3.7/dist-packages/mmdet/models/detectors/two_stage.py", line 203, in onnx_export
return self.roi_head.onnx_export(x, proposals, img_metas)
File "/usr/local/lib/python3.7/dist-packages/mmdet/models/roi_heads/standard_roi_head.py", line 298, in onnx_export
x, img_metas, proposals, self.test_cfg, rescale=rescale)
File "/usr/local/lib/python3.7/dist-packages/mmdet/models/roi_heads/standard_roi_head.py", line 394, in bbox_onnx_export
rois, cls_score, bbox_pred, img_shapes, cfg=rcnn_test_cfg)
File "/usr/local/lib/python3.7/dist-packages/mmdet/models/roi_heads/bbox_heads/bbox_head.py", line 585, in onnx_export
labels=labels)
File "/usr/local/lib/python3.7/dist-packages/mmdet/core/export/onnx_helper.py", line 172, in add_dummy_nms_for_onnx
mask[pos_inds, :] += 1
RuntimeError: the derivative for 'indices' is not implemented