ValueError:您传入了一个可迭代的属性,但我无法确定其适用的类型 [英] ValueError: You passed in an iterable attribute but I cannot figure out its applicable type

查看:347
本文介绍了ValueError:您传入了一个可迭代的属性,但我无法确定其适用的类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

这给我这个错误

ValueError:ValueError:您传入了可迭代的属性,但我无法弄清其适用类型.

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

完整错误日志

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工具.

All I have is .pb file and tf2onnx tool.

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

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

推荐答案

我没有删除phase_train输入分支,这是此错误的根源, 我创建了仅推理图(引用链接),然后没有给我任何错误.

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.

这篇关于ValueError:您传入了一个可迭代的属性,但我无法确定其适用的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆