ValueError: You passed in an iterable attribute but I cannot figure out its applicable type

烂漫一生 提交于 2019-12-24 16:25:40

问题


I am trying to convert facenet model(20170512-110547.pb) to onnx format using tf2onnx tool. But When I am trying to convert it using this command

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

It is giving me this error

ValueError: ValueError: You passed in an iterable attribute but I cannot figure out its applicable type.

Full Error log

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.

All I have is .pb file and tf2onnx tool.

I would be really grateful if someone could give time to answer this ! Thank you.


回答1:


I didn't remove phase_train input branch, and that was the root of this error, I created inference-only graph (referred-link), then it didn't give me any error.



来源:https://stackoverflow.com/questions/58470251/valueerror-you-passed-in-an-iterable-attribute-but-i-cannot-figure-out-its-appl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!