class_docstr: Class object to setup and carry the training.
  
  Takes as input a generator that produces SR images.
  Conditionally, also a discriminator network and a feature extractor
      to build the components of the perceptual loss.
  Compiles the model(s) and trains in a GANS fashion if a discriminator is provided, otherwise
  carries a regular ISR training.
  
  Args:
      generator: Keras model, the super-scaling, or generator, network.
      discriminator: Keras model, the discriminator network for the adversarial
          component of the perceptual loss.
      feature_extractor: Keras model, feature extractor network for the deep features
          component of perceptual loss function.
      lr_train_dir: path to the directory containing the Low-Res images for training.
      hr_train_dir: path to the directory containing the High-Res images for training.
      lr_valid_dir: path to the directory containing the Low-Res images for validation.
      hr_valid_dir: path to the directory containing the High-Res images for validation.
      learning_rate: float.
      loss_weights: dictionary, use to weigh the components of the loss function.
          Contains 'generator' for the generator loss component, and can contain 'discriminator' and 'feature_extractor'
          for the discriminator and deep features components respectively.
      logs_dir: path to the directory where the tensorboard logs are saved.
      weights_dir: path to the directory where the weights are saved.
      dataname: string, used to identify what dataset is used for the training session.
      weights_generator: path to the pre-trained generator's weights, for transfer learning.
      weights_discriminator: path to the pre-trained discriminator's weights, for transfer learning.
      n_validation:integer, number of validation samples used at training from the validation set.
      flatness: dictionary. Determines determines the 'flatness' threshold level for the training patches.
          See the TrainerHelper class for more details.
      lr_decay_frequency: integer, every how many epochs the learning rate is reduced.
      lr_decay_factor: 0 < float <1, learning rate reduction multiplicative factor.
  
  Methods:
      train: combines the networks and triggers training with the specified settings.
docstr: Creates a dictionary for tensorboard tracking. 
docstr_tok: ["Creates","a","dictionary","for","tensorboard","tracking","."]
code: def _format_losses(self, prefix, losses, model_metrics):
      """Creates a dictionary for tensorboard tracking."""
  
      return dict(zip([prefix + m for m in model_metrics], losses))
  
imports: from time import time
  import numpy
  from tqdm import tqdm
  from tensorflow.keras.models import Model
  from tensorflow.keras.layers import Input
  from tensorflow.keras.optimizers import Adam
  from tensorflow.keras.callbacks import TensorBoard
  from tensorflow.keras import backend
  from ISR.utils.datahandler import DataHandler
  from ISR.utils.train_helper import TrainerHelper
  from ISR.utils.metrics import PSNR
  from ISR.utils.metrics import PSNR_Y
  from ISR.utils.logger import get_logger
  from ISR.utils.utils import check_parameter_keys
label_desc: Use image node_id 7 for calling the Trainer obj's underlying member method code with example usage: obj._format_losses(prefix, losses, model_metrics) and returns: dict