Evaluation

evaluate_on_validationdata(config, model_name='', pipeline=None, model=None, save_grid=False, combine_halfs=False, save_single=False, save_prefix='', calc_stats=False)[source]

Evaluates supplied model on evaluation set of supplied data-pipeline and plots resulting distributions in regards to PSNR and SSIM.

Parameters
  • config

    Initialized object of type ConfigUtil.
    Will be used for save path of resulting plots and to load model/pipeline in case they are not supplied.

  • model_name – Name of model, will be used as label for plots.

  • pipeline

    Initialized object of type simple_sr.DataPipeline.
    Will be initialized from config if None.

  • model – Object of type Keras.model, will be loaded from model path in config if None.

  • save_grid – Whether so save an image grid. (useful if image grid contains patches)

  • combine_halfs – Whether to save an image that’s upscaled with supplied models on one half and bicubic on the other half.

  • save_single – Whether to save single images.

  • save_prefix – Prefix for filenames.

  • calc_stats – Whether to calculate psnr and ssim.

evaluate_on_testdata(config, save_single=True, grid=False, interpolate=False, with_original=False, combine_halfs=False, pipeline=None, models=None, save_prefix='', segmentation_min_width=1000, segmentation_min_height=1000)[source]

Evaluates model(s) supplied via config on test data set of supplied data-pipeline. Images will be plotted for each supplied model according to supplied paramaters. save_single, grid and combine_halfs can be combined and images will be produced and stored for each option. interpolate and with_original are options to define the appearance of grid.

Parameters
  • config

    Initialized object of type ConfigUtil from simple_sr.utils.config module.
    Models will be loaded from model_paths in config object.

  • save_single – Whether to save upscaled images as single images.

  • grid – Whether so save an image grid. Supplied models will be plotted along rows, images across rows.

  • interpolate – Whether to add a row with interpolated images in grid for comparision.

  • with_original – Whether to plot original image next to image grid (useful if image grid contains patches)

  • combine_halfs – Whether to save an image that’s upscaled with supplied models on one half and bicubic on the other half.

  • pipeline

    Initialized object of DataPipeline from simple_sr.data_pipeline package.
    Will be initialized from config if None.

  • models – Dict of name: model where model is of type Keras.model. | If no dict is supplied, models will be load from path in config.model_path.

  • save_prefix – Prefix for filenames.

  • segmentation_min_width – Minimal width of images to be segmentated for memory efficient inference.

  • segmentation_min_height – Minimal height of images to be segmented for memory efficient inference.