deepinsight / deepinsight/insightface

Error while converting SCRFD to onnx using scrfd2onnx.py

Open
#2,054 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
29.7k
Forks
6.1k
PR merge metrics
No merged PRs in 30d

Description

Hello,

I'm getting the following error while trying to convert any of the SCRFD .pth models to onnx using scrfd2onnx.py

Here's the used command:
`python3 tools/scrfd2onnx.py configs/scrfd/scrfd_2.5g.py tools/models/SCRFD_2.5G.pth `

Here's what I'm getting:

> set to dynamic input with dummy shape: (1, 3, 640, 640)
load checkpoint from local path: tools/models/SCRFD_2.5G.pth
/home/yousef/Desktop/IN3/insightface/detection/scrfd/mmcv/mmcv/onnx/symbolic.py:481: UserWarning: DeprecationWarning: This function will be deprecated in future. Welcome to use the unified model deployment toolbox MMDeploy: https://github.com/open-mmlab/mmdeploy
warnings.warn(msg)
Traceback (most recent call last):
File "tools/scrfd2onnx.py", line 198, in
pytorch2onnx(
File "tools/scrfd2onnx.py", line 84, in pytorch2onnx
torch.onnx.export(
File "/home/yousef/Desktop/IN3/insightface/detection/scrfd/venv/lib/python3.8/site-packages/torch/onnx/__init__.py", line 350, in export
return utils.export(
File "/home/yousef/Desktop/IN3/insightface/detection/scrfd/venv/lib/python3.8/site-packages/torch/onnx/utils.py", line 163, in export
_export(
File "/home/yousef/Desktop/IN3/insightface/detection/scrfd/venv/lib/python3.8/site-packages/torch/onnx/utils.py", line 1074, in _export
graph, params_dict, torch_out = _model_to_graph(
File "/home/yousef/Desktop/IN3/insightface/detection/scrfd/venv/lib/python3.8/site-packages/torch/onnx/utils.py", line 727, in _model_to_graph
graph, params, torch_out, module = _create_jit_graph(model, args)
File "/home/yousef/Desktop/IN3/insightface/detection/scrfd/venv/lib/python3.8/site-packages/torch/onnx/utils.py", line 602, in _create_jit_graph
graph, torch_out = _trace_and_get_graph_from_model(model, args)
File "/home/yousef/Desktop/IN3/insightface/detection/scrfd/venv/lib/python3.8/site-packages/torch/onnx/utils.py", line 517, in _trace_and_get_graph_from_model
trace_graph, torch_out, inputs_states = torch.jit._get_trace_graph(
File "/home/yousef/Desktop/IN3/insightface/detection/scrfd/venv/lib/python3.8/site-packages/torch/jit/_trace.py", line 1175, in _get_trace_graph
outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
File "/home/yousef/Desktop/IN3/insightface/detection/scrfd/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/yousef/Desktop/IN3/insightface/detection/scrfd/venv/lib/python3.8/site-packages/torch/jit/_trace.py", line 95, in forward
in_vars, in_desc = _flatten(args)
RuntimeError: Only tuples, lists and Variables are supported as JIT inputs/outputs. Dictionaries and strings are also accepted, but their usage is not recommended. Here, received an input of unsupported type: numpy.ndarray

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.