Beispiel #1
0
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'  # less logs
# local libs
from utils.plot_utils import save_val_samples
from utils.data_utils import dataLoaderUSR, deprocess
from utils.loss_utils import perceptual_distance, total_gen_loss
#############################################################################
## dataset and image information
dataset_name = "USR_2x"  # SCALE = 2
channels = 3
lr_width, lr_height = 320, 240  # low res
hr_width, hr_height = 640, 480  # high res (2x)
# input and output data
lr_shape = (lr_height, lr_width, channels)
hr_shape = (hr_height, hr_width, channels)
data_loader = dataLoaderUSR(SCALE=2)

# training parameters
num_epochs = 40
batch_size = 2
sample_interval = 500  # per step
ckpt_interval = 4  # per epoch
steps_per_epoch = (data_loader.num_train // batch_size)
num_step = num_epochs * steps_per_epoch

###################################################################################
model_name = "srdrm"  # ["res_sr", "image_sr", "sr_cnn", "denoise_sr", "srdrm"]
if (model_name.lower() == "res_sr"):
    from nets.gen_models import ResNetSR
    model_loader = ResNetSR(lr_shape, hr_shape, SCALE=2)
elif (model_name.lower() == "image_sr"):
Beispiel #2
0
from keras.models import Model
import keras.backend as K
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'  # less logs
# local libs
from utils.plot_utils import save_val_samples
from utils.data_utils import dataLoaderUSR, deprocess
#####################################################################
## dataset and image information
dataset_name = "USR_4x"  # SCALE = 4
channels = 3
lr_width, lr_height = 160, 120  # low res
hr_width, hr_height = 640, 480  # high res (4x)
# input and output data
lr_shape = (lr_height, lr_width, channels)
hr_shape = (hr_height, hr_width, channels)
data_loader = dataLoaderUSR(DATA_PATH="./USR-248/", SCALE=4)

# training parameters
num_epochs = 100
batch_size = 8
sample_interval = 500  # per step
ckpt_interval = 4  # per epoch
steps_per_epoch = (data_loader.num_train // batch_size)
num_step = num_epochs * steps_per_epoch
#####################################################################

# choose which model to run
model_name = "srdrm-gan"  # options: ["srdrm-gan", "srgan", "esrgan", "edsrgan"]
if model_name.lower() == "srgan":
    from nets.SRGAN import SRGAN_model
    gan_model = SRGAN_model(lr_shape, hr_shape, SCALE=4)
import keras.backend as K
os.environ['TF_CPP_MIN_LOG_LEVEL']='2' # less logs
# local libs
from utils.plot_utils import save_val_samples
from utils.data_utils import dataLoaderUSR, deprocess
from utils.loss_utils import perceptual_distance, total_gen_loss
#############################################################################
## dataset and image information
dataset_name = "USR_2x" # SCALE = 2
channels = 3
lr_width, lr_height = 320, 240   # low res
hr_width, hr_height = 640, 480 # high res (2x)
# input and output data
lr_shape = (lr_height, lr_width, channels)
hr_shape = (hr_height, hr_width, channels)
data_loader = dataLoaderUSR(DATA_PATH="/mnt/data1/ImageSR/USR-248/", SCALE=2)

# training parameters
num_epochs = 40
batch_size = 2
sample_interval = 500 # per step
ckpt_interval = 4 # per epoch
steps_per_epoch = (data_loader.num_train//batch_size)
num_step = num_epochs*steps_per_epoch

###################################################################################
model_name = "srdrm" # ["res_sr", "image_sr", "sr_cnn", "denoise_sr", "srdrm"]
if (model_name.lower()=="res_sr"):
    from nets.gen_models import ResNetSR
    model_loader = ResNetSR(lr_shape, hr_shape, SCALE=2)
elif (model_name.lower()=="image_sr"):