Example #1
0
    # model = models.ResNetSR(scale).create_model()
    # plot_model(model, to_file="architectures/ResNet.png", show_layer_names=True, show_shapes=True)

    # model = models.GANImageSuperResolutionModel(scale).create_model(mode='train')
    # plot_model(model, to_file='architectures/GAN Image SR.png', show_shapes=True, show_layer_names=True)

    # model = models.DistilledResNetSR(scale).create_model()
    # plot_model(model, to_file='architectures/distilled_resnet_sr.png', show_layer_names=True, show_shapes=True)

    # model = models.NonLocalResNetSR(scale).create_model()
    # plot_model(model, to_file='architectures/non_local_resnet_sr.png', show_layer_names=True, show_shapes=True)
    """
    Train Super Resolution
    """

    sr = models.ImageSuperResolutionModel(scale)
    sr.create_model()
    sr.fit(nb_epochs=10, save_history=False)  #kpl from 250
    """
    Train ExpantionSuperResolution
    """

    # esr = models.ExpantionSuperResolution(scale)
    # esr.create_model()
    # esr.fit(nb_epochs=250)
    """
    Train DenoisingAutoEncoderSR
    """

    # dsr = models.DenoisingAutoEncoderSR(scale)
    # dsr.create_model()
Example #2
0
from __future__ import print_function, division

from keras.utils.vis_utils import plot_model
import models
import img_utils

if __name__ == "__main__":
    path = r"headline_carspeed.jpg"
    val_path = "val_images/"

    scale = 4
    """
    Plot the models
    """

    model = models.ImageSuperResolutionModel(scale).create_model()
    plot_model(model,
               to_file="architectures/SRCNN.png",
               show_shapes=True,
               show_layer_names=True)

    # model = models.ExpantionSuperResolution(scale).create_model()
    # plot_model(model, to_file="architectures/ESRCNN.png", show_layer_names=True, show_shapes=True)

    # model = models.DenoisingAutoEncoderSR(scale).create_model()
    # plot_model(model, to_file="architectures/Denoise.png", show_layer_names=True, show_shapes=True)

    # model = models.DeepDenoiseSR(scale).create_model()
    # plot_model(model, to_file="architectures/Deep Denoise.png", show_layer_names=True, show_shapes=True)

    # model = models.ResNetSR(scale).create_model()
Example #3
0
                                                           '"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"

customWeightsPath = args.weightsPath

if model_type == "sr":
    model = models.ImageSuperResolutionModel(scale_factor, customWeightsPath)
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,
Example #4
0
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(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,
Example #5
0
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)