class_docstr: Collection of useful functions to manage training sessions.
  
  Args:
      generator: Keras model, the super-scaling, or generator, network.
      logs_dir: path to the directory where the tensorboard logs are saved.
      weights_dir: path to the directory where the weights are saved.
      lr_train_dir: path to the directory containing the Low-Res images.
      feature_extractor: Keras model, feature extractor network for the deep features
          component of perceptual loss function.
      discriminator: Keras model, the discriminator network for the adversarial
          component of the perceptual loss.
      dataname: string, used to identify what dataset is used for the training session.
      weights_dictionarycontains the paths, if any to the
          pre-trained generator's and to the pre-trained discriminator's weights,
          for transfer learning.
      fallback_save_every_n_epochs: integer, determines after how many epochs that did not trigger
          weights saving the weights are despite no metric improvement.
      max_n_best_weights: maximum amount of weights that are best on some metric that are kept.
      max_n_other_weights: maximum amount of non-best weights that are kept.
  
  
  Methods:
      print_training_setting: see docstring.
      on_epoch_end: see docstring.
      epoch_n_from_weights_name: see docstring.
      initialize_training: see docstring.
class_docstr_tok: ["Collection","of","useful","functions","to","manage","training","sessions",".","Args",":","generator",":","Keras","model",",","the","super-scaling",",","or","generator",",","network",".","logs_dir",":","path","to","the","directory","where","the","tensorboard","logs","are","saved",".","weights_dir",":","path","to","the","directory","where","the","weights","are","saved",".","lr_train_dir",":","path","to","the","directory","containing","the","Low-Res","images",".","feature_extractor",":","Keras","model",",","feature","extractor","network","for","the","deep","features","component","of","perceptual","loss","function",".","discriminator",":","Keras","model",",","the","discriminator","network","for","the","adversarial","component","of","the","perceptual","loss",".","dataname",":","string",",","used","to","identify","what","dataset","is","used","for","the","training","session",".","weights_dictionarycontains","the","paths",",","if","any","to","the","pre-trained","generator","'s","and","to","the","pre-trained","discriminator","'s","weights",",","for","transfer","learning",".","fallback_save_every_n_epochs",":","integer",",","determines","after","how","many","epochs","that","did","not","trigger","weights","saving","the","weights","are","despite","no","metric","improvement",".","max_n_best_weights",":","maximum","amount","of","weights","that","are","best","on","some","metric","that","are","kept",".","max_n_other_weights",":","maximum","amount","of","non-best","weights","that","are","kept",".","Methods",":","print_training_setting",":","see","docstring",".","on_epoch_end",":","see","docstring",".","epoch_n_from_weights_name",":","see","docstring",".","initialize_training",":","see","docstring","."]
docstr: Extracts the last epoch number from the standardized weights name.
  Only works if the weights contain 'epoch' followed by 3 integers, for example:
      some-architectureepoch023suffix.hdf5
docstr_tok: ["Extracts","the","last","epoch","number","from","the","standardized","weights","name",".","Only","works","if","the","weights","contain","'epoch","'","followed","by","3","integers",",","for","example",":","some-architectureepoch023suffix.hdf5"]
code: def epoch_n_from_weights_name(self, w_name):
      """
      Extracts the last epoch number from the standardized weights name.
      Only works if the weights contain 'epoch' followed by 3 integers, for example:
          some-architectureepoch023suffix.hdf5
      """
      try:
          starting_epoch = int(w_name.split("epoch")[1][0:3])
      except Exception as e:
          self.logger.warning(
              "Could not retrieve starting epoch from the weights name: \n{}".format(
                  w_name
              )
          )
          self.logger.error(e)
          starting_epoch = 0
      return starting_epoch
  
file_path: image-super-resolution/ISR/utils/train_helper.py
imports: import yaml
  import numpy
  from pathlib import Path
  from ISR.utils.logger import get_logger
  from ISR.utils.utils import get_timestamp
label_desc: Use image node_id 12 for calling the TrainerHelper obj's underlying member method code with example usage: obj.epoch_n_from_weights_name(w_name) and returns: starting_epoch