实时更新
1、第836行### 编译float32 onnx模型
文件:(A)K510 nncase 开发指南 .md
第836行### 编译float32 onnx模型
在导入 nncase
时出现了问题。由于 nncase
库依赖于 onnx
库,而 onnx
又依赖于 numpy
,所以在导入 nncase
时,会遇到 numpy
版本升级导致的问题。
为了解决这个问题,需要在导入 nncase
之前,先处理 numpy
版本不兼容的问题。在代码开头添加以下几行代码:
import numpy as np
np.object = object # 解决 numpy 版本不兼容的问题
但是会报警告
WARNING: The argument `input_shapes` is deprecated. Please use `overwrite_input_shapes` and/or `test_input_shapes` instead. An error will be raised in the future.
警告指出 input_shapes
参数已被弃用,建议使用 overwrite_input_shapes
和/或 test_input_shapes
替代。这是脚本中的一个警告,表明在将来的版本中可能会移除 input_shapes
参数。
警告中提到无法找到某些部分的反编译器。这可能与脚本中某些操作相关,但通常不会影响主要功能。
解决方法:
更新参数:警告中提到 input_shapes
参数已被弃用,建议使用 overwrite_input_shapes
和/或 test_input_shapes
替代。因此,你可以修改 onnxsim.simplify()
函数的调用,使用新的参数名称。例如,你可以使用 overwrite_input_shapes
参数来指定输入张量的形状。
将文档中876行代码改为下方,消除警告。
onnx_model, check = onnxsim.simplify(onnx_model, overwrite_input_shapes=input_shapes)