TensorFlow.NET
TensorFlow.NET copied to clipboard
How can I implement gfile?
In python; (url: https://gist.github.com/madhawav/1546a4b99c8313f06c0b2d7d7b4a09e2)
self.detection_graph = tf.Graph()
.
.
.
with self.detection_graph.as_default():
od_graph_def = tf.GraphDef()
with tf.gfile.GFile(self.path_to_ckpt, 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
tf.import_graph_def(od_graph_def, name='')
But I cannot find these methods like GraphDef() and .gfile.GFile(self.path_to_ckpt, 'rb') in TensorFlow.Net on csharp?
How can I find out it?
Your usage of GFile essentially does the following:
using System.IO;
var serialized_graph = File.ReadAllText(self.path_to_ckpt);
Has this resolved your issue?
@Nucs thanks but it gives error being "There is no ParseFromString() method of od_graph_def" for the line od_graph_def.ParseFromString(serialized_graph)
Do we have any updates on this issue because I am also struggling to solve this.
I am facing the same so. Anyone would give a hand?
Ok, for ParseFromString, you may try this:
var serialized_graph = File.ReadAllText(self.path_to_ckpt);
byte[] bytearray = new byte[](serialized_graph);
od_graph_def= GraphDef.Parser.ParseFrom( bytearray );