def TestItemCB(recv, send, sig, data): win = gi.Window(handle=recv) gi.StringPromptDialog( win.WinViewport2D(), "", "Test Item", gi.DlgOpts( Title="Test Item", Prompt= "Enter the Name of a given input pattern to test (case insensitive, contains given string." ), win, TestItemCB2)
def TestAll(ss): """ TestAll runs through the full set of testing items """ err = ss.TestEnv.SetParas(go.Slice_string([ss.Words1, ss.Words2])) if err != 0: gi.PromptDialog(go.nil, gi.DlgOpts(Title= "Words errors", Prompt= err.Error()), gi.AddOk, gi.NoCancel, go.nil, go.nil) return ss.TestEnv.Init(ss.TrainEnv.Run.Cur) while True: ss.TestTrial(True) chg = ss.TestEnv.CounterChg(env.Epoch) if chg or ss.StopNow: break
def TestItemCB2(recv, send, sig, data): win = gi.Window(handle=recv) vp = win.WinViewport2D() dlg = gi.Dialog(handle=send) if sig != gi.DialogAccepted: return val = gi.StringPromptDialogValue(dlg) idxs = TheSim.TestEnv.Table.RowsByString("Name", val, True, True) # contains, ignoreCase if len(idxs) == 0: gi.PromptDialog(vp, gi.DlgOpts(Title="Name Not Found", Prompt="No patterns found containing: " + val), True, False, go.nil, go.nil) else: if not TheSim.IsRunning: TheSim.IsRunning = True print("testing index: %s" % idxs[0]) TheSim.TestItem(idxs[0]) TheSim.IsRunning = False vp.SetNeedsFullRender()
def SetPatsCB(recv, send, sig, data): win = gi.Window(handle=recv) gi.ChoiceDialog(win.WinViewport2D(), gi.DlgOpts(Title="Set Pats", Prompt="Set which set of patterns to present -- full or partial faces"), go.Slice_string(["Full Faces", "Partial Faces"]), win, SetPatsCB2)
def SetInputCB(recv, send, sig, data): win = gi.Window(handle=recv) gi.ChoiceDialog(win.WinViewport2D(), gi.DlgOpts(Title="Set Input", Prompt="Set whether the input to the network comes in bottom-up (Input layer) or top-down (Higher-level category layers)"), go.Slice_string(["Bottom-up", "Top-down"]), win, SetInputCB2)