          for idx, side in enumerate(("a", "b")):
              samples = self.images[side]
              faces = samples[1]
              input_shape = self._model.model.input_shape[idx][1:]
              if input_shape[0] / faces.shape[1] != 1.0:
                  feeds[side] = self._resize_sample(side, faces, input_shape[0])
                  feeds[side] = feeds[side].reshape((-1, ) + input_shape)
              else:
                  feeds[side] = faces
  
          preds = self._get_predictions(feeds["a"], feeds["b"])
 
</s> remove         feeds = {}
        figures = {}
        headers = {}
        for idx, side in enumerate(("a", "b")):
            samples = self.images[side]
            faces = samples[1]
 </s> add         feeds: Dict[Literal["a", "b"], np.ndarray] = {}
        for idx, side in enumerate(get_args(Literal["a", "b"])): </s> remove                 feeds[side] = faces
 </s> add                 feeds[side] = self.images[side][0] </s> remove 
        for side, samples in self.images.items():
            other_side = "a" if side == "b" else "b"
            predictions = [preds[f"{side}_{side}"],
                           preds[f"{other_side}_{side}"]]
            display = self._to_full_frame(side, samples, predictions)
            headers[side] = self._get_headers(side, display[0].shape[1])
            figures[side] = np.stack([display[0], display[1], display[2], ], axis=1)
            if self.images[side][0].shape[0] % 2 == 1:
                figures[side] = np.concatenate([figures[side],
                                                np.expand_dims(figures[side][0], 0)])

        width = 4
        side_cols = width // 2
        if side_cols != 1:
            headers = self._duplicate_headers(headers, side_cols)

        header = np.concatenate([headers["a"], headers["b"]], axis=1)
        figure = np.concatenate([figures["a"], figures["b"]], axis=0)
        height = int(figure.shape[0] / width)
        figure = figure.reshape((width, height) + figure.shape[1:])
        figure = _stack_images(figure)
        figure = np.concatenate((header, figure), axis=0)

        logger.debug("Compiled sample")
        return np.clip(figure * 255, 0, 255).astype('uint8')
 </s> add         return self._compile_preview(preds) </s> remove             preview_images = self._config.get("preview_images", 14)
 </s> add             preview_images = int(self._config.get("preview_images", 14)) </s> remove         retval = {}
        for idx, side in enumerate(("a", "b")):
 </s> add         retval: Dict[Literal["a", "b"], Generator[BatchType, None, None]] = {}
        for side in get_args(Literal["a", "b"]):
            if input_shape[0] / self.images[side][0].shape[1] != 1.0:
                feeds[side] = self._resize_sample(side, self.images[side][1], input_shape[0])
          for idx, side in enumerate(("a", "b")):
              samples = self.images[side]
              faces = samples[1]
              input_shape = self._model.model.input_shape[idx][1:]
            if input_shape[0] / self.images[side][0].shape[1] != 1.0:
                feeds[side] = self._resize_sample(side, self.images[side][1], input_shape[0])
            if input_shape[0] / self.images[side][0].shape[1] != 1.0:
                feeds[side] = self._resize_sample(side, self.images[side][1], input_shape[0])
                  feeds[side] = feeds[side].reshape((-1, ) + input_shape)
              else:
                  feeds[side] = faces
  
          preds = self._get_predictions(feeds["a"], feeds["b"])
keep keep keep keep replace replace keep keep keep keep keep
 Data Augmentation update (#1263)

- lib.detected_face
    - Subclass Masks for Landmark based masks
    - Add training mask propery + methods to DetectedFace
  - lib.training_training
    - subclass TrainingDataGenerator for training and preview data
    - Split cache into own module
    - Reduce thread count to 1 to prevent image corruption + data re-use
    - Process on largest model input/output size rather than stored image size
    - Size and crop masks during caching stage
    - Implement ring buffer for data flow
    - Fix preview reload bug
  - augmentation
    - typing
    - switch color aug order
    - better initialization
    - Fix warp + landmark warp to correctly apply at different image scales
    - Slightly improved warp caching
    - Don't store whether image is_preview. Handle all data as training images implicitly
  - plugins.trainer: Typing and fixes to work with trainingdata refactor 
plugins/train/trainer/_base.py