

























参考讨论:https://github.com/microsoft/onnxruntime/issues/2447
解决方案在:https://github.com/onnx/models/issues/156#issuecomment-540870145
建立一个 python 脚本(如 patch.py)在模型目录下
import onnx
path = r"arcfaceresnet100-8.onnx"
print(f"patch {path} ...")
model = onnx.load(path)
count = 0
for node in model.graph.node:
if node.op_type == "BatchNormalization":
for attr in node.attribute:
if attr.name == "spatial" and attr.i == 0:
attr.i = 1
count += 1
onnx.checker.check_model(model)
onnx.save(model, path)
print(f"patched {count} BatchNormalization nodes")
执行脚本( python patch.py )即可修复(输出应该【patched xxx】有不少)。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。