我的目标是为tensorflow创建一个小gui。我在DOS中的命令是
"C:\pythonpath\python.exe" "E:\retrainpath\retrain.py" --image_dir "D:\picturepath"
它应该起作用
^{pr2}$然而,尝试截取c#中的输出不会使用
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);
}
以及
void build_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
string zeile = e.Data;
Console.WriteLine(zeile);
}
单击button1
时所发生的一切是:button1
被禁用然后被启用,调试窗口中的输出是两个空行。在
我在python的minidump中发现它崩溃是因为0xc000409,一个STATUS\u STACK\u BUFFER_溢出。在
运行替代文件
import sys
s = 'Hello, world.'
print(s)
印刷品你好,世界。在c#中,所以张量流重新训练是一个问题,但仅当从c#调用时。在
目前没有回答
相关问题 更多 >
编程相关推荐