【问题标题】:ValueError: Input and filter shapes must be int or symbolic in Conv2D nodeValueError:输入和过滤器形状在 Conv2D 节点中必须是 int 或 symbolic
【发布时间】:2020-08-26 02:29:40
【问题描述】:

我正在尝试使用tfcoreml(使用下面的脚本)将我的 .pb 文件转换为 CoreML 模型,但出现此错误:ValueError: Input and filter shapes must be int or symbolic in Conv2D node detector/darknet-53/Conv/Conv2D。我将如何解决此错误并将我的模型成功转换为 CoreML?

我用 Netron 打开了我的 .pb 模型,发现了有问题的层:

这是我正在使用的转换脚本:

import tfcoreml

tfcoreml.convert(tf_model_path='model.pb',
                 mlmodel_path='model.mlmodel',
                 output_feature_names=['output_boxes'],  # name of the output op
                 input_name_shape_dict={'inputs': [None, 416, 416, 3]},  # map from the placeholder op in the graph to shape (can have -1s)
                 minimum_ios_deployment_target='13')

据我所知,在我看来,我需要更改所有 Conv2D 节点的输入类型才能使其正常工作。但我无论如何都不是专家,所以我可能是错的。有没有办法可以修复这个模型,通过使用 Python 脚本成功转换,如果可以,它会是什么样子?

编辑: 更改input_name_shape_dict 中的None 后,我得到了一个不同的错误。这个说:ValueError: Incompatible dimension 3 in Sub operation detector/darknet-53/Conv/BatchNorm/FusedBatchNorm/Sub。所以我再次打开Netron我看了看。这是我得到的,知道如何解决它吗?

似乎脚本通过了上一个错误只是为了卡在下一层。我的 .pb 是完全没用还是只需要在某些地方修复?

【问题讨论】:

    标签: python tensorflow machine-learning coreml


    【解决方案1】:

    input_name_shape_dict 中尝试用 1 代替 None

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-25
      • 2021-08-14
      • 1970-01-01
      • 2018-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-05
      相关资源
      最近更新 更多