mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-08-22 06:23:20 -07:00
Signal to start GUI thread after inital load
This commit is contained in:
parent
c758ac75dd
commit
f21877901f
1 changed files with 6 additions and 6 deletions
|
@ -12,7 +12,7 @@ import cv2
|
||||||
import models
|
import models
|
||||||
from interact import interact as io
|
from interact import interact as io
|
||||||
|
|
||||||
def trainerThread (s2c, c2s, args, device_args):
|
def trainerThread (s2c, c2s, e, args, device_args):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
@ -63,6 +63,7 @@ def trainerThread (s2c, c2s, args, device_args):
|
||||||
if not debug:
|
if not debug:
|
||||||
previews = model.get_previews()
|
previews = model.get_previews()
|
||||||
c2s.put ( {'op':'show', 'previews': previews, 'iter':model.get_iter(), 'loss_history': model.get_loss_history().copy() } )
|
c2s.put ( {'op':'show', 'previews': previews, 'iter':model.get_iter(), 'loss_history': model.get_loss_history().copy() } )
|
||||||
|
e.set() #Set the GUI Thread as Ready
|
||||||
else:
|
else:
|
||||||
previews = [( 'debug, press update for new', model.debug_one_iter())]
|
previews = [( 'debug, press update for new', model.debug_one_iter())]
|
||||||
c2s.put ( {'op':'show', 'previews': previews} )
|
c2s.put ( {'op':'show', 'previews': previews} )
|
||||||
|
@ -189,9 +190,12 @@ def main(args, device_args):
|
||||||
s2c = queue.Queue()
|
s2c = queue.Queue()
|
||||||
c2s = queue.Queue()
|
c2s = queue.Queue()
|
||||||
|
|
||||||
thread = threading.Thread(target=trainerThread, args=(s2c, c2s, args, device_args) )
|
e = threading.Event()
|
||||||
|
thread = threading.Thread(target=trainerThread, args=(s2c, c2s, e, args, device_args) )
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
|
e.wait() #Wait for inital load to occur.
|
||||||
|
|
||||||
if no_preview:
|
if no_preview:
|
||||||
while True:
|
while True:
|
||||||
if not c2s.empty():
|
if not c2s.empty():
|
||||||
|
@ -291,10 +295,6 @@ def main(args, device_args):
|
||||||
|
|
||||||
key_events = io.get_key_events(wnd_name)
|
key_events = io.get_key_events(wnd_name)
|
||||||
key, chr_key, ctrl_pressed, alt_pressed, shift_pressed = key_events[-1] if len(key_events) > 0 else (0,0,False,False,False)
|
key, chr_key, ctrl_pressed, alt_pressed, shift_pressed = key_events[-1] if len(key_events) > 0 else (0,0,False,False,False)
|
||||||
|
|
||||||
#Scheduling bug possibly? Only needed on linux.....
|
|
||||||
if not is_showing:
|
|
||||||
time.sleep(0.1)
|
|
||||||
|
|
||||||
if key == ord('\n') or key == ord('\r'):
|
if key == ord('\n') or key == ord('\r'):
|
||||||
s2c.put ( {'op': 'close'} )
|
s2c.put ( {'op': 'close'} )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue