  
      @property
      def has_predicted_mask(self):
          """ Return whether this model has a predicted mask """
          return bool(self.model.state.mask_shapes)
  
      @staticmethod
      def get_batchsize(queue_size):
          """ Get the batchsize """
          logger.debug("Getting batchsize")
 
</s> remove         return self.config.get("mask_type", None) is not None
 </s> add         return self.config.get("learn_mask", False) </s> remove     def use_mask(self):
        """ Return True if a mask is requested """
        retval = bool(self.model.training_opts.get("mask_type", None))
 </s> add     def _use_mask(self):
        """ bool: ``True`` if a mask is required otherwise ``False`` """
        retval = (self._model.training_opts["learn_mask"] or
                  self._model.training_opts["penalized_mask_loss"]) </s> remove     @property
    def image_size(self):
        """ Get the training set image size for storing in model data """
        image = read_image(self.images["a"][0], raise_error=True)
        size = image.shape[0]
        logger.debug("Training image size: %s", size)
        return size
 </s> add     def _load_trainer(self, model):
        """ Load the trainer requested for training. </s> remove     def timestamp(self):
        """ Standardised timestamp for loss reporting """
 </s> add     def pingpong(self):
        """ :class:`pingpong`: Ping-pong object for ping-pong memory saving training. """
        return self._pingpong

    @property
    def _timestamp(self):
        """ str: Current time formatted as HOURS:MINUTES:SECONDS """ </s> remove         mask_idx = [idx for idx, name in enumerate(output_network.output_names)
                    if name.startswith("mask")]
        if mask_idx:
            # Add the final mask shape as input
            mask_shape = output_network.output_shapes[mask_idx[0]]
            inputs.append(Input(shape=mask_shape[1:], name="mask_in"))
 </s> add         if self.feed_mask:
            # TODO penalized mask doesn't have a mask output, so we can't use output shapes
            # mask should always be last output..this needs to be a rule
            mask_shape = output_network.output_shapes[-1]
            inputs.append(Input(shape=(mask_shape[1:-1] + (1,)), name="mask_in"))
        return bool(self.model.state.config.get("learn_mask", False))
  
      @property
      def has_predicted_mask(self):
          """ Return whether this model has a predicted mask """
        return bool(self.model.state.config.get("learn_mask", False))
  
      @staticmethod
      def get_batchsize(queue_size):
          """ Get the batchsize """
          logger.debug("Getting batchsize")
keep keep keep keep 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. 
scripts/convert.py