Giter VIP home page Giter VIP logo

arcface_retinaface_mxnet2onnx's People

Contributors

zheshipinyinmc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

arcface_retinaface_mxnet2onnx's Issues

运行mxnet2onnx_demo报错

@zheshipinyinMc 你好,我测试mxnet2onnx_demo,运行直接报错

==> Context: Bad node spec: input: "conv_1_conv2d" input: "conv_1_batchnorm_gamma" input: "conv_1_batchnorm_beta" input: "conv_1_batchnorm_moving_mean" input: "conv_1_batchnorm_moving_var" output: "conv_1_batchnorm" name: "conv_1_batchnorm" op_type: "BatchNormalization" attribute { name: "epsilon" f: 0.001 type: FLOAT } attribute { name: "momentum" f: 0.9 type: FLOAT } attribute { name: "spatial" i: 0 type: INT }

这个是因为版本问题吗?
我的环境:
mxnet-cu101 1.6.0
onnx 1.7.0
onnxruntime 1.3.0

Arcface Onnx转换问题修改了fc1的数据类型最后显示 dimension mismatch?

自己尝试用mobilefacenet-res2-6-10-2-dim512进行转换,得到下面的错误,求解答,代码跟作者的一样(解注释了后面几行检查和修改的语句):
2023-05-24 17:48:29.121959761 [W:onnxruntime:, graph.cc:84 MergeShapeInfo] Error merging shape info for output. 'fc1' source:{1,512,1,512} target:{1,512}. Falling back to lenient merge
2023-05-24 17:48:29.168708774 [E:onnxruntime:, sequential_executor.cc:339 Execute] Non-zero status code returned while running Gemm node. Name:'' Status Message: GEMM: Dimension mismatch, W: {512,512} K: 1 N:512
Traceback (most recent call last):
File "mxnet_to_onnx.py", line 155, in
onnx_inferred_demo()
File "mxnet_to_onnx.py", line 52, in onnx_inferred_demo
out = ort_session.run([outputs], input_feed={input_name: input_blob})
File "/usr/local/python3/lib/python3.8/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 188, in run
return self._sess.run(output_names, input_feed, run_options)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Non-zero status code returned while running Gemm node. Name:'' Status Message: GEMM: Dimension mismatch, W: {512,512} K: 1 N:512

onnx.onnx_cpp2py_export.checker.ValidationError

how to solve this problem when I run mxnet2onnx_demo.py in Arcface demo to mxnet2onnx.
Mxnet 1.6.0
onnx 1.7.0

File "D:/Project/Github/Face/Recognition/arcface_retinaface_mxnet2onnx-master/Arcface/mxnet2onnx_demo.py", line 153, in
mxnet2onnx_test() #==mxnet2onnx
File "D:/Project/Github/Face/Recognition/arcface_retinaface_mxnet2onnx-master/Arcface/mxnet2onnx_demo.py", line 25, in mxnet2onnx_test
converted_model_path = onnx_mxnet.export_model(sym, params, input_shape, np.float, onnx_file)
File "C:\Users\CC.conda\envs\face\lib\site-packages\mxnet\contrib\onnx\mx2onnx\export_model.py", line 83, in export_model
verbose=verbose)
File "C:\Users\CC.conda\envs\face\lib\site-packages\mxnet\contrib\onnx\mx2onnx\export_onnx.py", line 312, in create_onnx_graph_proto
checker.check_graph(graph)
File "C:\Users\CC.conda\envs\face\lib\site-packages\onnx\checker.py", line 54, in checker
proto.SerializeToString(), ctx)
onnx.onnx_cpp2py_export.checker.ValidationError

The onnx input shape is fixed regardless of scales like mxnet?

当使用onnx进行推断时,固定输入模型为(1、3、640、640),但是当使用mxnet进行推断时,输入是任意的,但不是固定的。 我想问的是,在使用onnx模型时,每个输入的大小应调整为(640,640)结果是否与mxnet不同,因为mxnet的输入形状取决于scale参数并且输入形状发生变化每个不同尺寸的输入图像?
感谢您的分享,太好了!

input_map

你好, 我使用我的pytorch转的onnx模型,获取input_map时只获取了数据输入的节点input
{'input0': name: "input0"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 3
}
dim {
dim_value: 112
}
dim {
dim_value: 112
}
}
}
}
}
后面所有节点的input都没有,请问你知道是怎么回事吗

MXNetError: Error in operator pre_fc1: Shape inconsistent

Got an error when I try mxnet2onnx

Traceback (most recent call last):
File "mxnet2onnx_demo.py", line 73, in
mxnet2onnx_test() #==mxnet2onnx
File "mxnet2onnx_demo.py", line 25, in mxnet2onnx_test
converted_model_path = onnx_mxnet.export_model(sym, params, input_shape, np.float32, onnx_file)
File "/hhdxx2/wzq/venv/lib/python3.6/site-packages/mxnet/contrib/onnx/init.py", line 53, in export_model
return export_model_(*args, **kwargs)
File "/hhdxx2/wzq/venv/lib/python3.6/site-packages/mxnet/onnx/mx2onnx/_export_model.py", line 125, in export_model
dynamic=dynamic, dynamic_input_shapes=dynamic_input_shapes)
File "/hhdxx2/wzq/venv/lib/python3.6/site-packages/mxnet/onnx/mx2onnx/_export_onnx.py", line 298, in create_onnx_graph_proto
in_types, dynamic, dynamic_input_shapes)
File "/hhdxx2/wzq/venv/lib/python3.6/site-packages/mxnet/onnx/mx2onnx/_export_onnx.py", line 190, in get_outputs
_, out_shapes, _ = sym.infer_shape(**inputs)
File "/hhdxx2/wzq/venv/lib/python3.6/site-packages/mxnet/symbol/symbol.py", line 1101, in infer_shape
res = self._infer_shape_impl(False, *args, **kwargs)
File "/hhdxx2/wzq/venv/lib/python3.6/site-packages/mxnet/symbol/symbol.py", line 1265, in _infer_shape_impl
ctypes.byref(complete)))
File "/hhdxx2/wzq/venv/lib/python3.6/site-packages/mxnet/base.py", line 246, in check_call
raise get_last_ffi_error()
mxnet.base.MXNetError: MXNetError: Error in operator pre_fc1: Shape inconsistent, Provided = [512,25088], inferred shape=(512,819200)

Code:

def mxnet2onnx_test():
sym = './model/model-symbol.json'
params = './model/model-0000.params'
input_shape = [(1,3,640,640)]
onnx_file = './model/model-0000.onnx'
converted_model_path = onnx_mxnet.export_model(sym, params, input_shape, np.float32, onnx_file)
#Check the model
onnx.checker.check_model(onnx_file)
print('The model is checked!')
if name == 'main':
mxnet2onnx_test() #==mxnet2onnx

Can anyone help me with this issue?

Have you tried to convert alignment algorithm?

I tried to convert the coordinateReg of insightface as below:
https://github.com/deepinsight/insightface/tree/master/alignment/coordinateReg

I modified all the things you mentioned about retinaface and arcface.
After conversion, the generated model seems to be same as original model, but its result is not similar to original one, and the result never changes when the input image changed.

Do you have any idea for this?
i think the problems are caused by prelu,flatten, or batchnorm.

Official Retinaface mnet25 models conversion

Hi! Great work converting RetinaFace mnet25 model!
I am trying to convert models from official InsightFace python package model zoo (retinaface_mnet025_v1, retinaface_mnet025_v2) using your code. Conversion works fine, but inference output is totally different from MXNet model, making it incompatible with following post processing.
Converted original @yangfly model works as intended.

model-r34-amf inferrence failed

Non-zero status code returned while running PRelu node. Name:'relu0' Status Message: relu0: right operand cannot broadcast on dim 0 LeftShape: {1,64,112,112}, RightShape: {64}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.