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

时间:2019-10-20 05:16:23

标签: tensorflow onnx

我正在尝试使用 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工具。

如果有人可以抽出时间回答这个问题,我将不胜感激!谢谢。

1 个答案:

答案 0 :(得分:0)

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