                               "(iteration: %s)", save_iteration, self._save_now, iteration)
                  model.save(is_exit=False)
                  self._save_now = False
          logger.debug("Training cycle complete")
          model.save(is_exit=True)
          trainer.clear_tensorboard()
          self._stop = True
 
</s> remove             if self._refresh_preview and viewer is not None:
                if self._args.redirect_gui:  # Remove any gui trigger files following an update
                    print("\n")
                    logger.info("[Preview Updated]")
                self._refresh_preview = False

            if save_iteration:
                logger.debug("Save Iteration: (iteration: %s", iteration)
                model.save(is_exit=False)
            elif self._save_now:
                logger.debug("Save Requested: (iteration: %s", iteration)
 </s> add             if save_iteration or self._save_now:
                logger.debug("Saving (save_iterations: %s, save_now: %s) Iteration: "
                             "(iteration: %s)", save_iteration, self._save_now, iteration) </s> remove             if self._toggle_preview_mask:
 </s> add             if self._preview.should_toggle_mask(): </s> remove             if save_iteration or self._save_now or self._refresh_preview:
 </s> add             if self._preview.should_refresh(): </s> remove                 self._toggle_preview_mask = False
                self._refresh_preview = True
 </s> add                 self._preview.request_refresh() </s> remove                     self._do_preview(window_created)
                    cv_key = cv2.waitKey(1000)  # pylint: disable=no-member
                else:
                    cv_key = None
 </s> add                     self._preview.display_preview()
                self._preview.request_refresh()

                               "(iteration: %s)", save_iteration, self._save_now, iteration)
                  model.save(is_exit=False)
                  self._save_now = False
                self._preview.request_refresh()

          logger.debug("Training cycle complete")
          model.save(is_exit=True)
          trainer.clear_tensorboard()
          self._stop = True
keep keep add keep keep keep keep
 Live Preview - Replace cv2 with matplotlib viewer 
scripts/train.py