예제 #1
0
        //进行手动初始化
        public void Init(String[] modelFiles = null, String inputName = null, String outputName = null)
        {
            _inputName  = inputName;
            _outputName = outputName;
            String[] fileNames = modelFiles;

            _modelFile = modelFiles[0];
            _labelFile = modelFiles[1];

            if (_graph != null)
            {
                _graph.Dispose();
            }
            _graph = new Graph();
            String localFileName = modelFiles[0];

            byte[] model       = File.ReadAllBytes(localFileName);
            Buffer modelBuffer = Buffer.FromString(model);

            using (ImportGraphDefOptions options = new ImportGraphDefOptions())
                _graph.ImportGraphDef(modelBuffer, options, _status);
        }
예제 #2
0
파일: Graph.cs 프로젝트: radtek/emgutf
 /// <summary>
 /// Import the graph serialized in <paramref name="graphDef"/> into the current graph.
 /// Convenience function for when no return outputs have been added.
 /// </summary>
 /// <param name="graphDef">The GraphDef to be imported</param>
 /// <param name="options">The import options</param>
 /// <param name="status">The status</param>
 public void ImportGraphDef(Buffer graphDef, ImportGraphDefOptions options, Status status = null)
 {
     using (StatusChecker checker = new StatusChecker(status))
         TfInvoke.tfeGraphImportGraphDef(_ptr, graphDef, options, checker.Status);
 }
예제 #3
0
파일: Graph.cs 프로젝트: radtek/emgutf
 /// <summary>
 /// Write out a serialized representation of `graph` (as a GraphDef protocol
 /// message).
 /// </summary>
 /// <param name="outputGraphDef">The buffer to store the GraphDef</param>
 /// <param name="status">The status</param>
 public void ToGraphDef(Buffer outputGraphDef, Status status = null)
 {
     using (StatusChecker checker = new StatusChecker(status))
         TfInvoke.tfeGraphToGraphDef(_ptr, outputGraphDef, checker.Status);
 }