You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried GraphDef.Parser.ParseFrom(File.ReadAllBytes(model_path)) and tf.import_graph_def(). It works fine to import .pb file but, at some reason, I want to use graph.Import() method.
When I use import method shown as below, there is no imported graph.
It's not imported to default graph either. I checked the frozen graph model that has operations also.
I ran into the same issue. I eventually worked around it by loading my graph this way:
var model_path = Path.Combine(model_folder, "frozen_graph_logistic.pb");
var graph_def = GraphDef.Parser.ParseFrom(File.ReadAllBytes(model_path));
var graph = new Graph().as_default();
tf.import_graph_def(graph_def);
graph.get_operations() return nothing when using graph.Import to load pb model, but it work well for inference, tf.import_graph_def() throw an exception "Attempt to read or write to protected memory.This usually indicates that other memory is corrupted."
at last, I solved the problem like this:
using System.Linq;
var model_path = Path.Combine(model_folder, *.pb");
var graph = new Graph();
graph.Import(model_path);
Operation[] ops = graph.ToArray();
Activity
HanClinto commentedon Jan 23, 2020
I ran into the same issue. I eventually worked around it by loading my graph this way:
Graph.ImportGraphDef #483
arthurvb commentedon May 7, 2020
@HanClinto Solved my issue as well.
Tried to run the example on https://github.com/SciSharp/SciSharp-Stack-Examples/blob/tf.net-1.15/src/TensorFlowNET.Examples/ImageProcessing/InceptionArchGoogLeNet.cs but got a KeyError when doing
get_operation_by_name("import/input");caj-github commentedon Nov 11, 2020
graph.get_operations() return nothing when using graph.Import to load pb model, but it work well for inference, tf.import_graph_def() throw an exception "Attempt to read or write to protected memory.This usually indicates that other memory is corrupted."
at last, I solved the problem like this:
using System.Linq;
var model_path = Path.Combine(model_folder, *.pb");
var graph = new Graph();
graph.Import(model_path);
Operation[] ops = graph.ToArray();