          """ Monitor the console for any input followed by enter or ctrl+c """
          # TODO: how to catch a specific key instead of Enter?
          # there isn't a good multiplatform solution:
          # https://stackoverflow.com/questions/3523174
          # TODO: Find a way to interrupt input() if the target iterations are reached.
          # At the moment, setting a target iteration and using the -p flag is
          # the only guaranteed way to exit the training loop on hitting target
          # iterations.
          print("Starting. Press 'ENTER' to stop training and save model")
          try:
              input()
          except KeyboardInterrupt:
              pass
 
</s> remove         if (hasattr(self.args, 'multiprocess')
                and self.args.multiprocess
                and GPUStats().device_count == 0):
            # TODO Checking that there is no available GPU is not
            # necessarily an indicator of whether the user is actually
            # using the CPU. Maybe look to implement further checks on
            # dlib/tensorflow compilations
            self.extract_multi_process()
        else:
            self.extract_single_process()
 </s> add     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 </s> remove         # Rotating an image is legacy code. Landmarks are now
        # rotated at extract stage. For newer extracts face.r
        # will always be zero.
        image = self.images.rotate_image(image, face.r)
 </s> add  </s> remove class BackgroundGenerator(threading.Thread):
    """ Run a queue in the background. From:
        https://stackoverflow.com/questions/7323664/ """
    # See below why prefetch count is flawed
    def __init__(self, generator, prefetch=1):
        threading.Thread.__init__(self)
        self.queue = Queue.Queue(prefetch)
        self.generator = generator
        self.daemon = True
        self.start()

    def run(self):
        """ Put until queue size is reached.
            Note: put blocks only if put is called while queue has already
            reached max size => this makes 2 prefetched items! One in the
            queue, one waiting for insertion! """
        for item in self.generator:
            self.queue.put(item)
        self.queue.put(None)

    def iterator(self):
        """ Iterate items out of the queue """
        while True:
            next_item = self.queue.get()
            if next_item is None:
                break
            yield next_item
 </s> add def camel_case_split(identifier):
    """ Split a camel case name
        from: https://stackoverflow.com/questions/29916065 """
    matches = finditer(
        ".+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)",
        identifier)
    return [m.group(0) for m in matches]
 </s> remove         Continue()
        Check_Missing_Dep()
        Check_dlib()
        Install_Missing_Dep()
        INFO("All python3 dependencies are met.\r\nYou are good to go.")
 </s> add         ask_continue()
        check_missing_dep()
        check_dlib()
        install_missing_dep()
        out_info("All python3 dependencies are met.\r\nYou are good to go.")
        # TODO: Find a way to interrupt input() if the target iterations are
        # reached. At the moment, setting a target iteration and using the -p
        # flag is the only guaranteed way to exit the training loop on
        # hitting target iterations.
          """ Monitor the console for any input followed by enter or ctrl+c """
          # TODO: how to catch a specific key instead of Enter?
          # there isn't a good multiplatform solution:
          # https://stackoverflow.com/questions/3523174
        # TODO: Find a way to interrupt input() if the target iterations are
        # reached. At the moment, setting a target iteration and using the -p
        # flag is the only guaranteed way to exit the training loop on
        # hitting target iterations.
        # TODO: Find a way to interrupt input() if the target iterations are
        # reached. At the moment, setting a target iteration and using the -p
        # flag is the only guaranteed way to exit the training loop on
        # hitting target iterations.
        # TODO: Find a way to interrupt input() if the target iterations are
        # reached. At the moment, setting a target iteration and using the -p
        # flag is the only guaranteed way to exit the training loop on
        # hitting target iterations.
        # TODO: Find a way to interrupt input() if the target iterations are
        # reached. At the moment, setting a target iteration and using the -p
        # flag is the only guaranteed way to exit the training loop on
        # hitting target iterations.
          print("Starting. Press 'ENTER' to stop training and save model")
          try:
              input()
          except KeyboardInterrupt:
              pass
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Extraction - Speed improvements (#522) (#523)

* Extraction - Speed improvements (#522)

* Initial Plugin restructure

* Detectors to plugins. Detector speed improvements

* Re-implement dlib aligner, remove models, FAN to TF. Parallel processing

* Update manual, update convert, implement parallel/serial switching

* linting + fix cuda check (setup.py). requirements update keras 2.2.4

* Add extract size option. Fix dlib hog init

* GUI: Increase tooltip width

* Update alignment tool to support new DetectedFace

* Add skip existing faces option

* Fix sort tool to new plugin structure

* remove old align plugin

* fix convert -skip faces bug

* Fix convert skipping no faces frames

* Convert - draw onto transparent layer

* Fix blur threshold bug

* fix skip_faces convert bug

* Fix training 
scripts/train.py