          provided cli options or from the model ``config.ini``. At a minimum this ``dict`` should
          contain the following keys:
  
          * **coverage_ratio** (`float`) - The ratio of the training image to be trained on. \
          Dictates how much of the image will be cropped out. Eg: a coverage ratio of 0.625 \
          will result in cropping a 160px box from a 256px image (256 * 0.625 = 160).
  
          * **augment_color** (`bool`) - ``True`` if color is to be augmented, otherwise ``False`` \
  
          * **no_flip** (`bool`) - ``True`` if the image shouldn't be randomly flipped as part of \
 
</s> remove         cropped out. Eg: a coverage ratio of 0.625 will result in cropping a 160px box from a 256px
        image (256 * 0.625 = 160).
 </s> add         cropped out. E.G: a coverage ratio of 0.625 will result in cropping a 160px box from a "
        "256px image (256 * 0.625 = 160). </s> remove         * **mask_type** (`str`) - The mask type to be used (as defined in \
        :mod:`lib.model.masks`). If not ``None`` then the additional key ``landmarks`` must be \
        provided.

 </s> add  </s> remove         * **landmarks** (`numpy.ndarray`, `optional`). Required if using a :attr:`mask_type` is \
        not ``None`` or :attr:`warp_to_landmarks` is ``True``. The 68 point face landmarks from \
        an alignments file.
 </s> add         * **landmarks** (`dict`, `optional`). Required if :attr:`warp_to_landmarks` is \
        ``True``. Returning dictionary has a key of **side** (`str`) the value of which is a \
        `dict` of {**filename** (`str`): **68 point landmarks** (`numpy.ndarray`)}.

        * **masks** (`dict`, `optional`). Required if :attr:`penalized_mask_loss` or \
        :attr:`learn_mask` is ``True``. Returning dictionary has a key of **side** (`str`) the \
        value of which is a `dict` of {**filename** (`str`): :class:`lib.faces_detect.Mask`}. </s> remove """ Base Trainer Class for Faceswap

    Trainers should be inherited from this class.

    A training_opts dictionary can be set in the corresponding model.
    Accepted values:
        alignments:         dict containing paths to alignments files for keys 'a' and 'b'
        preview_scaling:    How much to scale the preview out by
        training_size:      Size of the training images
        coverage_ratio:     Ratio of face to be cropped out for training
        mask_type:          Type of mask to use. See lib.model.masks for valid mask names.
                            Set to None for not used
        no_logs:            Disable tensorboard logging
        snapshot_interval:  Interval for saving model snapshots
        warp_to_landmarks:  Use random_warp_landmarks instead of random_warp
        augment_color:      Perform random shifting of L*a*b* colors
        no_flip:            Don't perform a random flip on the image
        pingpong:           Train each side seperately per save iteration rather than together
 </s> add This class heavily references the :attr:`plugins.train.model._base.ModelBase.training_opts`
``dict``. The following keys are expected from this ``dict``:

    * **alignments** (`dict`, `optional`) - If training with a mask or the warp to landmarks \
    command line option is selected then this is required, otherwise it can be ``None``. The \
    dictionary should contain 2 keys ("a" and "b") with the values being the path to the \
    alignments file for the corresponding side.

    * **preview_scaling** (`int`) - How much to scale displayed preview image by.

    * **training_size** ('int') - Size of the training images in pixels.

    * **coverage_ratio** ('float') - Ratio of face to be cropped out of the training image.

    * **mask_type** ('str') - The type of mask to select from the alignments file.

    * **mask_blur_kernel** ('int') - The size of the kernel to use for gaussian blurring the mask.

    * **mask_threshold** ('int') - The threshold for min/maxing mask to 0/100.

    * **learn_mask** ('bool') - Whether the mask should be trained in the model.

    * **penalized_mask_loss** ('bool') - Whether the mask should be penalized from loss.

    * **no_logs** ('bool') - Whether Tensorboard logging should be disabled.

    * **snapshot_interval** ('int') - How many iterations between model snapshot saves.

    * **warp_to_landmarks** ('bool') - Whether to use random_warp_landmarks instead of random_warp.

    * **augment_color** ('bool') - Whether to use color augmentation.

    * **no_flip** ('bool') - Whether to turn off random horizontal flipping.

    * **pingpong** ('bool') - Train each side separately per save iteration rather than together. </s> remove             the format (`batchsize`, `height`, `width`, `1`). **NB:** This item will only exist \
            in the ``dict`` if the :attr:`mask_type` is not ``None``

            * **samples** (`numpy.ndarray`) - A 4-dimensional array containg the samples for \
            feeding to the model's predict function for generating preview and timelapse samples. \
            The array will be in the format (`batchsize`, `height`, `width`, `channels`). **NB:** \
            This item will only exist in the ``dict`` if :attr:`is_preview` or \
            :attr:`is_timelapse` is ``True``
 </s> add             the format (`batchsize`, `height`, `width`, `1`).

            * **samples** (`numpy.ndarray`) - A 4-dimensional array containing the samples for \
            feeding to the model's predict function for generating preview and time-lapse \
            samples. The array will be in the format (`batchsize`, `height`, `width`, \
            `channels`). **NB:** This item will only exist in the ``dict`` if :attr:`is_preview` \
            or :attr:`is_timelapse` is ``True``
        Dictates how much of the image will be cropped out. E.G: a coverage ratio of 0.625 \
          provided cli options or from the model ``config.ini``. At a minimum this ``dict`` should
          contain the following keys:
  
          * **coverage_ratio** (`float`) - The ratio of the training image to be trained on. \
        Dictates how much of the image will be cropped out. E.G: a coverage ratio of 0.625 \
          will result in cropping a 160px box from a 256px image (256 * 0.625 = 160).
  
          * **augment_color** (`bool`) - ``True`` if color is to be augmented, otherwise ``False`` \
  
          * **no_flip** (`bool`) - ``True`` if the image shouldn't be randomly flipped as part of \
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. 
lib/training_data.py