mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-05 20:42:11 -07:00
extractor: increased speed of 1st pass by DLIB for >= 4GB vram cards,
added 'h' key for hide the help in manual extractor
This commit is contained in:
parent
bced4d3259
commit
168d48b119
2 changed files with 19 additions and 6 deletions
|
@ -48,7 +48,7 @@ class Subprocessor(object):
|
|||
return "undefined"
|
||||
|
||||
def log_info(self, msg): self.c2s.put ( {'op': 'log_info', 'msg':msg } )
|
||||
def log_err(self, msg): self.c2s.put ( {'op': 'log_err' , 'msg':msg } )
|
||||
def log_err(self, msg): self.c2s.put ( {'op': 'log_err' , 'msg':msg } )
|
||||
def progress_bar_inc(self, c): self.c2s.put ( {'op': 'progress_bar_inc' , 'c':c } )
|
||||
|
||||
def _subprocess_run(self, client_dict):
|
||||
|
@ -163,6 +163,10 @@ class Subprocessor(object):
|
|||
op = obj.get('op','')
|
||||
if op == 'init_ok':
|
||||
cli.state = 0
|
||||
elif op == 'log_info':
|
||||
io.log_info(obj['msg'])
|
||||
elif op == 'log_err':
|
||||
io.log_err(obj['msg'])
|
||||
elif op == 'error':
|
||||
cli.kill()
|
||||
self.clis.remove(cli)
|
||||
|
@ -184,7 +188,6 @@ class Subprocessor(object):
|
|||
while not cli.c2s.empty():
|
||||
obj = cli.c2s.get()
|
||||
op = obj.get('op','')
|
||||
|
||||
if op == 'success':
|
||||
#success processed data, return data and result to on_result
|
||||
self.on_result (cli.host_dict, obj['data'], obj['result'])
|
||||
|
|
|
@ -25,6 +25,7 @@ class ExtractSubprocessor(Subprocessor):
|
|||
#override
|
||||
def on_initialize(self, client_dict):
|
||||
self.log_info ('Running on %s.' % (client_dict['device_name']) )
|
||||
|
||||
self.type = client_dict['type']
|
||||
self.image_size = client_dict['image_size']
|
||||
self.face_type = client_dict['face_type']
|
||||
|
@ -175,6 +176,7 @@ class ExtractSubprocessor(Subprocessor):
|
|||
self.cache_original_image = (None, None)
|
||||
self.cache_image = (None, None)
|
||||
self.cache_text_lines_img = (None, None)
|
||||
self.hide_help = False
|
||||
|
||||
self.landmarks = None
|
||||
self.x = 0
|
||||
|
@ -211,7 +213,7 @@ class ExtractSubprocessor(Subprocessor):
|
|||
dev_name = nnlib.device.getDeviceName(idx)
|
||||
dev_vram = nnlib.device.getDeviceVRAMTotalGb(idx)
|
||||
|
||||
if not self.manual and self.type == 'rects' and self.detector == 'mt':
|
||||
if not self.manual and ( (self.type == 'rects') ):
|
||||
for i in range ( int (max (1, dev_vram / 2) ) ):
|
||||
yield (idx, 'GPU', '%s #%d' % (dev_name,i) , dev_vram)
|
||||
else:
|
||||
|
@ -299,8 +301,8 @@ class ExtractSubprocessor(Subprocessor):
|
|||
'[Enter] - confirm face landmarks and continue',
|
||||
'[Space] - confirm as unmarked frame and continue',
|
||||
'[Mouse wheel] - change rect',
|
||||
'[,] [.]- prev frame, next frame',
|
||||
'[Q] - skip remaining frames'
|
||||
'[,] [.]- prev frame, next frame. [Q] - skip remaining frames',
|
||||
'[h] - hide this help'
|
||||
], (1, 1, 1) )*255).astype(np.uint8)
|
||||
|
||||
self.cache_text_lines_img = (sh, self.text_lines_img)
|
||||
|
@ -350,6 +352,9 @@ class ExtractSubprocessor(Subprocessor):
|
|||
elif key == ord('q'):
|
||||
skip_remaining = True
|
||||
break
|
||||
elif key == ord('h'):
|
||||
self.hide_help = not self.hide_help
|
||||
break
|
||||
|
||||
if self.x != new_x or \
|
||||
self.y != new_y or \
|
||||
|
@ -402,7 +407,12 @@ class ExtractSubprocessor(Subprocessor):
|
|||
self.landmarks = result[1][0][1]
|
||||
|
||||
(h,w,c) = self.image.shape
|
||||
image = cv2.addWeighted (self.image,1.0,self.text_lines_img,1.0,0)
|
||||
|
||||
if not self.hide_help:
|
||||
image = cv2.addWeighted (self.image,1.0,self.text_lines_img,1.0,0)
|
||||
else:
|
||||
image = self.image.copy()
|
||||
|
||||
view_rect = (np.array(self.rect) * self.view_scale).astype(np.int).tolist()
|
||||
view_landmarks = (np.array(self.landmarks) * self.view_scale).astype(np.int).tolist()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue