【发布时间】:2019-05-10 23:28:24
【问题描述】:
Microsoft 已经放弃了用于 ML.NET(糟糕的产品)和 ONNX(尚未研究)的 CNTK。
CNTK,微软开源的最佳产品,但有很多错误和零支持,很遗憾!
我不情愿地向 Stackoverflow 社区寻求潜在的解决方案。
string filepath = @"<My big long Path>\";
string filename = Path.Combine(filepath, @"Data\SLUHandsOn.cntk");
if (!File.Exists(filename))
ProcessOutputData("File does not exist!");
Process process = new Process();
process.StartInfo.FileName = "CMD";
process.StartInfo.WorkingDirectory = filepath;
process.StartInfo.Arguments = "/c cntk configFile=" + "\"" + filename + "\"";
process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.Start();
process.OutputDataReceived += new DataReceivedEventHandler((x, y) =>
{
ProcessOutputData(y.Data);
});
process.BeginOutputReadLine();
方法ProcessOutputData也很简单:
private void ProcessOutputData(string text)
{
if (InvokeRequired)
{
Invoke(new MethodInvoker(() => { ProcessOutputData(text); }));
}
else
{
// Output Data:
richTextBox1.AppendText(text + Environment.NewLine);
}
}
不用说,CNTK 似乎没有输出数据。我尝试使用 CMD.exe 运行 CNTK,并使用 Visual Studio Tools for AI Redistributable 中的 CNTK.exe。
同样,我面临的问题是没有RedirectStandardOutput 数据。
谢谢。
回答感谢:MarcelGrommer - 谢谢!
process.ErrorDataReceived += new DataReceivedEventHandler((sender, e) =>
{
ProcessOutputData(e.Data);
});
// Asynchronously read the standard Error of the spawned process.
process.BeginErrorReadLine();
【问题讨论】: