1

我正在尝试使用tf2onnx工具将 facenet 模型(20170512-110547.pb)转换为 onnx 格式。但是当我尝试使用此命令进行转换时

python3 -m tf2onnx.convert\
    --input 20170512-110547.pb\
    --inputs input:0,phase_train:0\
    --outputs embeddings:0\
    --output model.onnx\
    --verbose

它给了我这个错误

ValueError:ValueError:您传入了一个可迭代的属性,但我无法确定它的适用类型。

完整的错误日志

2019-10-20 12:12:56,655 - WARNING - tf2onnx.shape_inference: Cannot infer shape for image_batch: image_batch:0
2019-10-20 12:12:56,655 - WARNING - tf2onnx.shape_inference: Cannot infer shape for batch_join: batch_join:0,batch_join:1
2019-10-20 12:12:56,655 - WARNING - tf2onnx.shape_inference: Cannot infer shape for input: input:0
2019-10-20 12:12:56,844 - ERROR - tf2onnx.tfonnx: pass1 convert failed for name: "batch_join/fifo_queue"
op: "FIFOQueueV2"
attr {
  key: "capacity"
  value {
    i: 1440
  }
}
attr {
  key: "component_types"
  value {
    list {
      type: DT_FLOAT
      type: DT_INT64
    }
  }
}
attr {
  key: "container"
  value {
    s: ""
  }
}
attr {
  key: "shapes"
  value {
    list {
      shape {
        dim {
          size: 160
        }
        dim {
          size: 160
        }
        dim {
          size: 3
        }
      }
      shape {
      }
    }
  }
}
attr {
  key: "shared_name"
  value {
    s: ""
  }
}
, ex=You passed in an iterable attribute but I cannot figure out its applicable type.
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/sneha/Downloads/tensorflow-onnx-master/tf2onnx/convert.py", line 161, in <module>
    main()
  File "/home/sneha/Downloads/tensorflow-onnx-master/tf2onnx/convert.py", line 145, in main
    inputs_as_nchw=args.inputs_as_nchw)
  File "/home/sneha/Downloads/tensorflow-onnx-master/tf2onnx/tfonnx.py", line 493, in process_tf_graph
    onnx_nodes, op_cnt, attr_cnt, output_shapes, dtypes = tensorflow_to_onnx(tf_graph, shape_override)
  File "/home/sneha/Downloads/tensorflow-onnx-master/tf2onnx/tfonnx.py", line 122, in tensorflow_to_onnx
    return tflist_to_onnx(graph.get_operations(), shape_override)
  File "/home/sneha/Downloads/tensorflow-onnx-master/tf2onnx/tfonnx.py", line 109, in tflist_to_onnx
    onnx_node = helper.make_node(node.type, input_names, output_names, name=node.name, **attr)
  File "/home/sneha/.local/lib/python3.5/site-packages/onnx/helper.py", line 56, in make_node
    for key, value in sorted(kwargs.items()))
  File "/home/sneha/.local/lib/python3.5/site-packages/onnx/helper.py", line 56, in <genexpr>
    for key, value in sorted(kwargs.items()))
  File "/home/sneha/.local/lib/python3.5/site-packages/onnx/helper.py", line 269, in make_attribute
    "You passed in an iterable attribute but I cannot figure out "
ValueError: You passed in an iterable attribute but I cannot figure out its applicable type.

我只有.pb文件和tf2onnx工具。

如果有人能花时间回答这个问题,我将不胜感激!谢谢你。

4

1 回答 1

0

我没有删除 phase_train 输入分支,这就是这个错误的根源,我创建了仅推理图(referred-link),然后它没有给我任何错误。

于 2019-10-20T13:19:13.220 回答