          if image is None:
              return
          filename = os.path.join(self.output_file, str(int(time.time())) + ".jpg")
  
          cv2.imwrite(filename, image)  # pylint: disable=no-member
          logger.debug("Created timelapse: '%s'", filename)
  
  
  class PingPong():
      """ Side switcher for pingpong training """
      def __init__(self, model, sides):
 
</s> remove         filename = os.path.join(self.output_file, str(int(time.time())) + ".jpg")
 </s> add         filename = os.path.join(self._output_file, str(int(time.time())) + ".jpg") </s> remove         """ Set the timelapse dictionary """
        logger.debug("Ouputting timelapse")
        image = self.samples.show_sample()
 </s> add         """ Write the created time-lapse to the specified output folder. """
        logger.debug("Ouputting time-lapse")
        image = self._samples.show_sample() </s> remove     """ Side switcher for pingpong training """
 </s> add     """ Side switcher for ping-pong training (memory saving feature)

    Parameters
    ----------
    model: plugin from :mod:`plugins.train.model`
        The selected model that will be running this trainer
    sides: list
        The sorted sides that are to be trained. Generally ["a", "b"]

    Attributes
    ----------
    side: str
        The side that is currently being trained
    loss: dict
        The loss for each side for ping pong training for the current ping pong session
    """ </s> remove         self.active = model.training_opts.get("pingpong", False)
        self.model = model
        self.sides = sides
 </s> add         self._model = model
        self._sides = sides </s> remove             if self.args.redirect_gui:
 </s> add             if self._args.redirect_gui:
        cv2.imwrite(filename, image)
        logger.debug("Created time-lapse: '%s'", filename)
          if image is None:
              return
          filename = os.path.join(self.output_file, str(int(time.time())) + ".jpg")
  
        cv2.imwrite(filename, image)
        logger.debug("Created time-lapse: '%s'", filename)
        cv2.imwrite(filename, image)
        logger.debug("Created time-lapse: '%s'", filename)
  
  
  class PingPong():
      """ Side switcher for pingpong training """
      def __init__(self, model, sides):
keep keep keep keep replace replace keep keep keep keep keep
 Smart Masks - Training Implementation (#914)

* Smart Masks - Training

- Reinstate smart mask training code
- Reinstate mask_type back to model.config
- change 'replicate_input_mask to 'learn_mask'
- Add learn mask option
- Add mask loading from alignments to plugins.train.trainer
- Add mask_blur and mask threshold options
- _base.py - Pass mask options through training_opts dict
- plugins.train.model - check for mask_type not None for learn_mask and penalized_mask_loss
- Limit alignments loading to just those faces that appear in the training folder
- Raise error if not all training images have an alignment, and alignment file is required
- lib.training_data - Mask generation code
- lib.faces_detect - cv2 dimension stripping bugfix
- Remove cv2 linting code

* Update mask helptext in cli.py

* Fix Warp to Landmarks
Remove SHA1 hashing from training data

* Update mask training config

* Capture missing masks at training init

* lib.image.read_image_batch - Return filenames with batch for ordering

* scripts.train - Documentation

* plugins.train.trainer - documentation

* Ensure backward compatibility.
Fix convert for new predicted masks

* Update removed masks to components for legacy models. 
plugins/train/trainer/_base.py