assert model_type in ["sr", "esr", "dsr", "ddsr", "rnsr"], 'Model type must be either "sr", "esr", "dsr", ' \ '"ddsr" or "rnsr"' mode = str(args.mode).lower() assert mode in ['fast', 'patch'], 'Mode of operation must be either "fast" or "patch"' scale_factor = int(args.scale) save = strToBool(args.save) patch_size = int(args.patch_size) assert patch_size > 0, "Patch size must be a positive integer" if model_type == "sr": model = models.ImageSuperResolutionModel(scale_factor) elif model_type == "esr": model = models.ExpantionSuperResolution(scale_factor) elif model_type == "dsr": model = models.DenoisingAutoEncoderSR(scale_factor) elif model_type == "ddsr": model = models.DeepDenoiseSR(scale_factor) elif model_type == "rnsr": model = models.ResNetSR(scale_factor) else: model = models.DeepDenoiseSR(scale_factor) model.upscale(path, save_intermediate=save, mode=mode, patch_size=patch_size, suffix=suffix)
args = parser.parse_args() path = args.imgpath suffix = args.suffix model_type = str(args.model).lower() assert model_type in ["sr", "esr", "dsr", "ddsr", "rnsr"], 'Model type must be either "sr", "esr", "dsr", ' \ '"ddsr" or "rnsr"' mode = str(args.mode).lower() assert mode in ['fast', 'patch'], 'Mode of operation must be either "fast" or "patch"' scale_factor = int(args.scale) save = strToBool(args.save) patch_size = int(args.patch_size) assert patch_size > 0, "Patch size must be a positive integer" if model_type == "sr": model = models.ImageSuperResolutionModel() elif model_type == "esr": model = models.ExpantionSuperResolution() elif model_type == "dsr": model = models.DenoisingAutoEncoderSR() elif model_type == "ddsr": model = models.DeepDenoiseSR() elif model_type == "rnsr": model = models.ResNetSR() model.upscale(path, scale_factor=scale_factor, save_intermediate=save, evaluate=False, mode=mode, patch_size=patch_size, suffix=suffix)