Ejemplo n.º 1
0
        private static void graphConvNetExample()
        {
            var mlconfigPath = $"model_mlconfigs\\convNet.mlconfig";

            //generate graph and shows it
            var dotString = MLFactory.GenerateNetworkGraph(mlconfigPath);
            // Save it to a temp folder
            string tempDotPath   = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".dot";
            string tempImagePath = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".png";

            File.WriteAllText(tempDotPath, dotString);
            //execute the process
            using (Process graphVizprocess = new Process())
            {
                graphVizprocess.StartInfo.FileName  = "dot.exe";
                graphVizprocess.StartInfo.Arguments = "-Tpng " + tempDotPath + " -o " + tempImagePath;
                graphVizprocess.Start();
                graphVizprocess.WaitForExit();
            }
            //call defaul image viewwer and shows the image
            using (Process imgView = new Process())
            {
                imgView.StartInfo.UseShellExecute = true;
                imgView.StartInfo.FileName        = tempImagePath;
                imgView.Start();
            }
        }
Ejemplo n.º 2
0
 public static string GenerateNetworkGraph(string configPath)
 {
     try
     {
         return(MLFactory.GenerateNetworkGraph(configPath));
     }
     catch (Exception)
     {
         throw;
     }
 }