Javacpp-presets: ONNX: can't get text format of ModelProto

Created on 9 Jul 2019  路  5Comments  路  Source: bytedeco/javacpp-presets

ONNX's ModelProto (org.bytedeco.connx.ModelProto) appears to have no way to serialize to a text (human-readable) format.

I tried using TextFormat from Java protobufs but it doesn't work with a ModelProto.

Is there any other way to get a text format of a ModelProto?

enhancement help wanted question

All 5 comments

@EmergentOrder Any ideas?

You can serialize it to a string with model.SerializeAsString(), although it's not exactly readable.

Once you have the bytes, as per the example, try this:
com.google.protobuf.Any.parseFrom(bytes).toString()
Field names are lost, but should still be good enough to get an idea of the model structure.

BTW, we should probably bundle the Java interface generated by Protocol Buffers as well.

Thanks @EmergentOrder, that's clever and an improvement on SerializeAsString().

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thunterdb picture thunterdb  路  37Comments

blueberry picture blueberry  路  32Comments

kwatters picture kwatters  路  24Comments

archenroot picture archenroot  路  29Comments

oneengineer picture oneengineer  路  34Comments