Microsoft have dropped CNTK for ML.NET ( Horrible product ) and ONNX ( Not yet looked at it ).
CNTK, best product Microsoft have Open Sourced, but lots of Bugs and Zero Support, sadly!
I reluctantly look toward the Stackoverflow community for a potential resolution.
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();
The Method ProcessOutputData
is pretty simple also:
private void ProcessOutputData(string text)
{
if (InvokeRequired)
{
Invoke(new MethodInvoker(() => { ProcessOutputData(text); }));
}
else
{
// Output Data:
richTextBox1.AppendText(text + Environment.NewLine);
}
}
Needless to say, CNTK appears to Output no Data. I have tried running CNTK with both CMD.exe and using the CNTK.exe from Visual Studio Tools for AI Redistributable.
Again, the problem I am facing is there is no RedirectStandardOutput
data.
Thank You.
ANSWER Credit to: MarcelGrommer - Thank You!
process.ErrorDataReceived += new DataReceivedEventHandler((sender, e) =>
{
ProcessOutputData(e.Data);
});
// Asynchronously read the standard Error of the spawned process.
process.BeginErrorReadLine();
You have to take the RedirectStandardError channel. CNTK calculates the network error, so the data comes on the StandardError channel. It works.
processCNTK.ErrorDataReceived += new DataReceivedEventHandler((sender, e) =>
{
string outFromCNTK = e.Data;
}