我将其放在命令行中
python3 -m tf2onnx.convert \
--graphdef /Users/penghaiming/Desktop/Tensorflowmodel/tensorflow_models/research/slim/frozen.pb \
--output model.onnx \
--inputs input:0[1,3,299,299] \
--outputs InceptionV3/Predictions/Reshape:0
我有这样的错误:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 752, in set_shape
unknown_shape)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 1 in both shapes must be equal, but are 299 and 3. Shapes are [?,299,299,3] and [1,3,299,299].
这:
ValueError: Dimension 1 in both shapes must be equal, but are 299 and 3. Shapes are [?,299,299,3] and [1,3,299,299].
所以我实际上从来不自己写任何文件。我是TensorFlow的新手,我只是尝试从培训到将模型应用于CoreML的整个过程。我使用了他们提供的所有代码,但遇到了许多困难。当我尝试将冻结的图转换为onnx模型时,就会发生这种情况。您能帮我解决这个问题,非常感谢!