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)
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)
# esr = models.ExpantionSuperResolution(scale) # esr.create_model() # esr.fit(nb_epochs=250) """ Train DenoisingAutoEncoderSR """ # dsr = models.DenoisingAutoEncoderSR(scale) # dsr.create_model() # dsr.fit(nb_epochs=250) """ Train Deep Denoise SR """ ddsr = models.DeepDenoiseSR(scale) ddsr.create_model() ddsr.fit(nb_epochs=180) """ Train Res Net SR """ # rnsr = models.ResNetSR(scale) # rnsr.create_model(load_weights=True) # rnsr.fit(nb_epochs=50) """ Train ESPCNN SR """ # espcnn = models.EfficientSubPixelConvolutionalSR(scale) # espcnn.create_model()