My goal is to create a small gui for tensorflow. My command in DOS is
"C:\pythonpath\python.exe" "E:\retrainpath\retrain.py" --image_dir "D:\picturepath"
which works as it should
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cublas64_80.dll locally
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cudnn64_5.dll locally
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cufft64_80.dll locally
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library nvcuda.dll locally
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library curand64_80.dll locally
>> Downloading inception...
Yet trying to intercept the output in c# does not, using
private void button1_Click(object sender, EventArgs e)
{
ParameterizedThreadStart pts = new ParameterizedThreadStart(trainieren);
Thread thread = new Thread(pts);
thread.Start(@"D:\picturepath");
}
string python = @"C:\pythonpath\python.exe";
string retrain = @"E:\retrainpath\retrain.py";
void trainieren(Object bildv)
{
this.Invoke((MethodInvoker)delegate
{
button1.Enabled = false;
});
string bildverzeichnis = (string)bildv;
string ApplicationPath = python;
string ApplicationArguments = "\""+retrain + "\" --image_dir \"" + bildverzeichnis+"\"";
Console.WriteLine(ApplicationPath + " " + ApplicationArguments);
Process ProcessObj = new Process();
ProcessObj.StartInfo.FileName = ApplicationPath;
ProcessObj.StartInfo.Arguments = ApplicationArguments;
ProcessObj.StartInfo.UseShellExecute = false;
ProcessObj.StartInfo.RedirectStandardOutput = true;
ProcessObj.StartInfo.RedirectStandardError = true;
ProcessObj.StartInfo.RedirectStandardInput = true;
ProcessObj.StartInfo.CreateNoWindow = true;
ProcessObj.ErrorDataReceived += build_ErrorDataReceived;
ProcessObj.OutputDataReceived += build_ErrorDataReceived;
ProcessObj.EnableRaisingEvents = true;
ProcessObj.Start();
ProcessObj.BeginOutputReadLine();
ProcessObj.BeginErrorReadLine();
ProcessObj.WaitForExit();
this.Invoke((MethodInvoker)delegate
{
button1.Enabled = true;
this.Text = "Fertig";
});
statusInnen("Beendet");
pb(0, 100, 0);
}
and
void build_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
string zeile = e.Data;
Console.WriteLine(zeile);
}
All that happens when clicking button1
is: button1
becomes disabled and then enabled, the output in the debug window is two empty lines.
I found in the minidump of python that it crashed because of 0xC0000409, a STATUS_STACK_BUFFER_OVERRUN.
Running an alternative file
import sys
s = 'Hello, world.'
print(s)
prints Hello, world. in c#, so it is a problem with tensorflows retrain, but only when called from c#.
User contributions licensed under CC BY-SA 3.0