示例#1
0
 def detect_faces(self, *args, **kwargs):
     """ Detect faces in Multiple Threads """
     super().detect_faces(*args, **kwargs)
     workers = MultiThread(thread_count=self.batch_size)
     workers.in_thread(target=self.detect_thread)
     workers.join_threads()
     self.queues["out"].put("EOF")
示例#2
0
 def threaded_io(self, task, io_args=None):
     """ Load images in a background thread """
     io_args = tuple() if io_args is None else (io_args, )
     if task == "load":
         func = self.load_images
     elif task == "save":
         func = self.save_faces
     elif task == "reload":
         func = self.reload_images
     io_thread = MultiThread(thread_count=1)
     io_thread.in_thread(func, *io_args)
     return io_thread