在用onnx进行推理模型时出现以下的警告:
[W:onnxruntime:, graph.cc:1074 Graph] Initializer res_5_block1_conv_dw_relu_gamma appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations, like const folding. Move it out of graph inputs if there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
解决办法:
方法一:
升级最新版的onnx,然后重新把pytorch模型转换为onnx模型。
方法二:
(1)下载 remove_initializer_from_input.py文件
(2)执行命令:
python remove_initializer_from_input.py --input mobilenet.onnx --output mobilenet_output.onnx