                  loss[side] = batcher.train_one_batch()
                  if not do_preview and not do_timelapse:
                      continue
                  if do_preview:
                      self.samples.images[side] = batcher.compile_sample(None)
                  if do_timelapse:
                      self.timelapse.get_sample(side, timelapse_kwargs)
  
              self.model.state.increment_iterations()
 
</s> remove                 loss[side] = batcher.train_one_batch(do_preview)
 </s> add                 loss[side] = batcher.train_one_batch() </s> remove         if not self.is_legacy:
 </s> add         if not self.is_legacy or not self.predict: </s> remove         if self.use_mask:
            batch = [[batch["feed"], batch["masks"]], batch["targets"] + [batch["masks"]]]
        else:
            batch = [batch["feed"], batch["targets"]]
        self.generate_preview(do_preview)
        return batch
 </s> add         targets_use_mask = self.model.training_opts["replicate_input_mask"]
        model_inputs = batch["feed"] + batch["masks"] if self.use_mask else batch["feed"]
        model_targets = batch["targets"] + batch["masks"] if targets_use_mask else batch["targets"]
        return model_inputs, model_targets </s> remove         retval = [samples[0:num_images]] if samples is not None else [self.samples[0:num_images]]
        if self.use_mask:
            retval.extend(tgt[0:num_images] for tgt in images)
        else:
            retval.extend(images[0:num_images])
 </s> add         masks = masks if masks is not None else self.masks
        samples = samples if samples is not None else self.samples
        retval = [samples[0:num_images], images[0:num_images], masks[0:num_images]]
                    batcher.generate_preview(do_preview)
                  loss[side] = batcher.train_one_batch()
                  if not do_preview and not do_timelapse:
                      continue
                  if do_preview:
                    batcher.generate_preview(do_preview)
                      self.samples.images[side] = batcher.compile_sample(None)
                  if do_timelapse:
                      self.timelapse.get_sample(side, timelapse_kwargs)
  
              self.model.state.increment_iterations()
keep keep keep add keep keep keep keep keep
 Smart Mask Exposure for Extraction & Training (#831)

Smart Masks - Initial Commit 
plugins/train/trainer/_base.py