  
          image = converter.patch_image(image,
                                        face,
                                        size)
          image = self.images.rotate_image(image, face.r, reverse=True)
          return image
  
  
  class OptionalActions(object):
      """ Process the optional actions for convert """
 
</s> remove class OptionalActions(object):
 </s> add class OptionalActions(): </s> remove     def rotate_image(self, image, rotation, reverse=False):
        """ Rotate the image forwards or backwards """
        if rotation == 0:
            return image
        if not reverse:
            self.rotation_height, self.rotation_width = image.shape[:2]
            image, _ = rotate_image_by_angle(image, rotation)
        else:
            image, _ = rotate_image_by_angle(
                image,
                rotation * -1,
                rotated_width=self.rotation_width,
                rotated_height=self.rotation_height)
        return image
 </s> add         try:
            with open(self.location, self.serializer.roptions) as align:
                data = self.serializer.unmarshal(align.read()) </s> remove     @staticmethod
    def cv2_read_write(action, filename, image=None):
        """ Read or write an image using cv2 """
        if action == 'read':
            image = cv2.imread(filename)
        if action == 'write':
            cv2.imwrite(filename, image)
        return image

 </s> add  </s> remove         face.alignment_to_face(image, alignment)
 </s> add         face.from_alignment(alignment, image=image) </s> remove     def write_alignments(self):
        """ Save the alignments file """
        self.alignments.write_alignments(self.faces.faces_detected)
 </s> add     def reload_images(self, detected_faces):
        """ Reload the images and pair to detected face """
        load_queue = queue_manager.get_queue("detect")
        for filename, image in self.images.load():
            detect_item = detected_faces.pop(filename, None)
            if not detect_item:
                continue
            detect_item["image"] = image
            load_queue.put(detect_item)
        load_queue.put("EOF")
  
          image = converter.patch_image(image,
                                        face,
                                        size)

          return image
  
  
  class OptionalActions(object):
      """ Process the optional actions for convert """
keep keep keep keep 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/convert.py