          )
  
          batch = BackgroundGenerator(self.prepare_images(), 1)
  
          # frame ranges stuff...
          self.frame_ranges = None
  
          # split out the frame ranges and parse out "min" and "max" values
          minmax = {
              "min": 0, # never any frames less than 0
              "max": float("inf")
 
</s> remove         # split out the frame ranges and parse out "min" and "max" values
        minmax = {
            "min": 0, # never any frames less than 0
            "max": float("inf")
        }
 </s> add         self.faces.faces_detected = self.alignments.read_alignments() </s> remove         batch = BackgroundGenerator(self.prepare_images(), 1)
 </s> add     def process(self):
        """ Original & LowMem models go with Adjust or Masked converter
            Note: GAN prediction outputs a mask + an image, while other predicts only an image """
        Utils.set_verbosity(self.args.verbose) </s> remove         if self.arguments.frame_ranges:
            self.frame_ranges = [tuple(map(lambda q: minmax[q] if q in minmax.keys() else int(q), v.split("-"))) for v in self.arguments.frame_ranges]
 </s> add         model = self.load_model()
        converter = self.load_converter(model) </s> remove         input_aligned_dir = Path(self.arguments.input_dir)/Path('aligned')
        if self.arguments.input_aligned_dir is not None:
            input_aligned_dir = self.arguments.input_aligned_dir
        try:
            self.input_aligned_dir = [Path(path) for path in get_image_paths(input_aligned_dir)]
            if len(self.input_aligned_dir) == 0:
                print('Aligned directory is empty, no faces will be converted!')
            elif len(self.input_aligned_dir) <= len(self.input_dir)/3:
                print('Aligned directory contains an amount of images much less than the input, are you sure this is the right directory?')
        except:
            print('Aligned directory not found. All faces listed in the alignments file will be converted.')

        converter = PluginLoader.get_converter(conv_name)(model.converter(False),
            trainer=self.arguments.trainer,
            blur_size=self.arguments.blur_size,
            seamless_clone=self.arguments.seamless_clone,
            sharpen_image=self.arguments.sharpen_image,
            mask_type=self.arguments.mask_type,
            erosion_kernel_size=self.arguments.erosion_kernel_size,
            match_histogram=self.arguments.match_histogram,
            smooth_mask=self.arguments.smooth_mask,
            avg_color_adjust=self.arguments.avg_color_adjust
        )
 </s> add         self.opts = OptionalActions(self.args, self.images.input_images) </s> remove         # last number regex. I know regex is hacky, but its reliablyhacky(tm).
        self.imageidxre = re.compile(r'(\d+)(?!.*\d)')
 </s> add         batch = BackgroundGenerator(self.prepare_images(), 1)
        if not self.alignments.have_alignments():
            self.generate_alignments()
          )
  
          batch = BackgroundGenerator(self.prepare_images(), 1)
  
        if not self.alignments.have_alignments():
            self.generate_alignments()
        if not self.alignments.have_alignments():
            self.generate_alignments()
  
          # split out the frame ranges and parse out "min" and "max" values
          minmax = {
              "min": 0, # never any frames less than 0
              "max": float("inf")
keep keep keep keep replace replace keep keep keep keep keep
 cli/scripts Refactor (#367)

* Refactor for PEP 8 and split process function

* Remove backwards compatibility for skip frames

* Split optional functions into own class. Make functions more modular

* Conform scripts folder to PEP 8

* train.py - Fix write image bug. Make more modular

* extract.py - Make more modular, Put optional actions into own class

* cli.py - start PEP 8

* cli,py - Pep 8. Refactor and make modular. Bugfixes

* 1st round refactor. Completely untested and probably broken.

* convert.py: Extract alignments from frames if they don't exist

* BugFix: SkipExisting broken since face name refactor

* Extract.py tested

* Minor formatting

* convert.py + train.py amended not tested

* train.py - Semi-fix for hang on reaching target iteration. Now quits on preview mode
Make tensorflow / system warning less verbose

* 2nd pass refactor. Semi tested

bugfixes

* Remove obsolete code. imread/write to Utils

* rename inout.py to fsmedia.py

* Final bugfixes 
scripts/convert.py