class_docstr: The predictor class handles prediction, given an input model.
  
  Loads the images in the input directory, executes training given a model
  and saves the results in the output directory.
  Can receive a path for the weights or can let the user browse through the
  weights directory for the desired weights.
  
  Args:
      input_dir: string, path to the input directory.
      output_dir: string, path to the output directory.
      verbose: bool.
  
  Attributes:
      extensions: list of accepted image extensions.
      img_ls: list of image files in input_dir.
  
  Methods:
      get_predictions: given a model and a string containing the weights' path,
          runs the predictions on the images contained in the input directory and
          stores the results in the output directory.
class_docstr_tok: ["The","predictor","class","handles","prediction",",","given","an","input","model",".","Loads","the","images","in","the","input","directory",",","executes","training","given","a","model","and","saves","the","results","in","the","output","directory",".","Can","receive","a","path","for","the","weights","or","can","let","the","user","browse","through","the","weights","directory","for","the","desired","weights",".","Args",":","input_dir",":","string",",","path","to","the","input","directory",".","output_dir",":","string",",","path","to","the","output","directory",".","verbose",":","bool",".","Attributes",":","extensions",":","list","of","accepted","image","extensions",".","img_ls",":","list","of","image","files","in","input_dir",".","Methods",":","get_predictions",":","given","a","model","and","a","string","containing","the","weights","'","path",",","runs","the","predictions","on","the","images","contained","in","the","input","directory","and","stores","the","results","in","the","output","directory","."]
code: def __init__(
      self, input_dir, output_dir="./data/output", verbose=True
  ):
      self.input_dir = Path(input_dir)
      self.data_name = self.input_dir.name
      self.output_dir = Path(output_dir) / self.data_name
      self.logger = get_logger(__name__)
      if not verbose:
          self.logger.setLevel(40)
      self.extensions = (
          ".jpeg",
          ".jpg",
          ".png",
      )  # file extensions that are admitted
      self.img_ls = [
          f
          for f in self.input_dir.iterdir()
          if f.suffix in self.extensions
      ]
      if len(self.img_ls) < 1:
          self.logger.error(
              "No valid image files found (check config file)."
          )
          raise ValueError(
              "No valid image files found (check config file)."
          )
      # Create results folder
      if not self.output_dir.exists():
          self.logger.info(
              "Creating output directory:\n{}".format(self.output_dir)
          )
          self.output_dir.mkdir(parents=True)
  
file_path: image-super-resolution/ISR/predict/predictor.py
imports: from time import time
  import imageio
  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 1 to create a new Predictor object  with example: obj = Predictor(input_dir, output_dir, verbose)