                      print('Skipping not recognized face!')
                  continue
              yield faces_count, face
  
              self.num_faces_detected += 1
              faces_count += 1
  
          if faces_count > 1 and self.arguments.verbose:
              self.verify_output = True
  
      def load_filter(self):
 
</s> remove             yield faces_count, face
            self.num_faces_detected += 1
            faces_count += 1
        if faces_count > 1 and self.arguments.verbose:
            print('Note: Found more than one face in an image! File: %s' % filename)
            self.verify_output = True
 </s> add  </s> remove     def get_faces(self, image, rotation=0):
        import_faces_detect()
        faces_count = 0
        faces = detect_faces(image, self.arguments.detector, self.arguments.verbose, rotation)
        
        for face in faces:
            if self.filter is not None and not self.filter.check(face):
                if self.arguments.verbose:
                    print('Skipping not recognized face!')
                continue
            yield faces_count, face
 </s> add class ExtractConvertArgs(FaceSwapArgs):
    """ This class is used as a parent class to capture arguments that
        will be used in both the extract and convert process. </s> remove     def get_faces_alignments(self, filename, image):
        import_faces_detect()
        faces_count = 0
        faces = self.faces_detected[os.path.basename(filename)]
        for rawface in faces:
            face = DetectedFace(**rawface)
            # Rotate the image if necessary
            if face.r != 0: image = rotate_image(image, face.r)
            face.image = image[face.y : face.y + face.h, face.x : face.x + face.w]
            if self.filter is not None and not self.filter.check(face):
                if self.arguments.verbose:
                    print('Skipping not recognized face!')
                continue
 </s> add     def add_arguments(self):
        """ Parse the arguments passed in from argparse """
        for option in self.argument_list + self.optional_arguments:
            args = option["opts"]
            kwargs = {key: option[key] for key in option.keys() if key != "opts"}
            self.parser.add_argument(*args, **kwargs) </s> remove     def load_filter(self):
        nfilter_files = self.arguments.nfilter
        if not isinstance(self.arguments.nfilter, list):
            nfilter_files = [self.arguments.nfilter]
        nfilter_files = list(filter(lambda fn: Path(fn).exists(), nfilter_files))
 </s> add class ExtractArgs(ExtractConvertArgs):
    """ Class to parse the command line arguments for extraction.
        Inherits base options from ExtractConvertArgs where arguments
        that are used for both extract and convert should be placed """ </s> remove         if faces_count > 1 and self.arguments.verbose:
            self.verify_output = True
 </s> add     @staticmethod
    def get_argument_list():
        """ Put the arguments in a list so that they are accessible from both argparse and gui """
        argument_list = []
        argument_list.append({"opts": ("-i", "--input-dir"),
                              "action": FullPaths,
                              "dest": "input_dir",
                              "default": "input",
                              "help": "Input directory. A directory containing the files "
                                      "you wish to process. Defaults to 'input'"})
        argument_list.append({"opts": ("-o", "--output-dir"),
                              "action": FullPaths,
                              "dest": "output_dir",
                              "default": "output",
                              "help": "Output directory. This is where the converted files will "
                                      "be stored. Defaults to 'output'"})
        argument_list.append({"opts": ("--alignments", ),
                              "type": str,
                              "dest": "alignments_path",
                              "help": "optional path to alignments file"})
        argument_list.append({"opts": ("--serializer", ),
                              "type": str.lower,
                              "dest": "serializer",
                              "choices": ("yaml", "json", "pickle"),
                              "help": "serializer for alignments file"})
        argument_list.append({"opts": ("-D", "--detector"),
                              "type": str,
                              # case sensitive because this is used to load a plugin.
                              "choices": ("hog", "cnn"),
                              "default": "hog",
                              "help": "Detector to use. 'cnn' detects many more angles but "
                                      "will be much more resource intensive and may fail "
                                      "on large files"})
        argument_list.append({"opts": ("-l", "--ref_threshold"),
                              "type": float,
                              "dest": "ref_threshold",
                              "default": 0.6,
                              "help": "Threshold for positive face recognition"})
        argument_list.append({"opts": ("-n", "--nfilter"),
                              "type": str,
                              "dest": "nfilter",
                              "nargs": "+",
                              "default": None,
                              "help": "Reference image for the persons you do not want to "
                                      "process. Should be a front portrait. Multiple images"
                                      "can be added space separated"})
        argument_list.append({"opts": ("-f", "--filter"),
                              "type": str,
                              "dest": "filter",
                              "nargs": "+",
                              "default": None,
                              "help": "Reference images for the person you want to process. "
                                      "Should be a front portrait. Multiple images"
                                      "can be added space separated"})
        argument_list.append({"opts": ("-v", "--verbose"),
                              "action": "store_true",
                              "dest": "verbose",
                              "default": False,
                              "help": "Show verbose output"})
        return argument_list
        Arguments that can be used in both of these processes should be
        placed here, but no further processing should be done. This class
        just captures arguments """
                      print('Skipping not recognized face!')
                  continue
              yield faces_count, face
  
        Arguments that can be used in both of these processes should be
        placed here, but no further processing should be done. This class
        just captures arguments """
        Arguments that can be used in both of these processes should be
        placed here, but no further processing should be done. This class
        just captures arguments """
  
          if faces_count > 1 and self.arguments.verbose:
              self.verify_output = True
  
      def load_filter(self):
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 
lib/cli.py