# Path: awesome_gans/datasets.py
# class Div2KDataSet:
#     def __init__(
#         self,
#         hr_height=384,
#         hr_width=384,
#         lr_height=96,
#         lr_width=96,
#         channel=3,
#         use_split=False,
#         split_rate=0.1,
#         random_state=42,
#         n_threads=8,
#         ds_path=None,
#         ds_name=None,
#         use_img_scale=True,
#         ds_hr_path=None,
#         ds_lr_path=None,
#         use_save=False,
#         save_type='to_h5',
#         save_file_name=None,
#     ):
# 
#         """
#         # General Settings
#         :param hr_height: input HR image height, default 384
#         :param hr_width: input HR image width, default 384
#         :param lr_height: input LR image height, default 96
#         :param lr_width: input LR image width, default 96
#         :param channel: input image channel, default 3 (RGB)
#         - in case of Div2K - ds x4, image size is 384 x 384 x 3 (HWC).
# 
#         # Pre-Processing Option
#         :param split_rate: image split rate (into train & test), default 0.1
#         :param random_state: random seed for shuffling, default 42
#         :param n_threads: the number of threads for multi-threading, default 8
# 
#         # DataSet Option
#         :param ds_path: DataSet's Path, default None
#         :param ds_name: DataSet's Name, default None
#         :param use_img_scale: using img scaling?
#         :param ds_hr_path: DataSet High Resolution path
#         :param ds_lr_path: DataSet Low Resolution path
#         :param use_save: saving into another file format
#         :param save_type: file format to save
#         :param save_file_name: file name to save
#         """
# 
#         self.hr_height = hr_height
#         self.hr_width = hr_width
#         self.lr_height = lr_height
#         self.lr_width = lr_width
#         self.channel = channel
#         self.hr_shape = (self.hr_height, self.hr_width, self.channel)
#         self.lr_shape = (self.lr_height, self.lr_width, self.channel)
# 
#         self.use_split = use_split
#         self.split_rate = split_rate
#         self.random_state = random_state
#         self.num_threads = n_threads  # change this value to the fitted value for ur system
# 
#         """
#         Expected ds_path : div2k/...
#         Expected ds_name : X4
#         """
#         self.ds_path = ds_path
#         self.ds_name = ds_name
#         self.ds_hr_path = ds_hr_path
#         self.ds_lr_path = ds_lr_path
# 
#         try:
#             assert self.ds_path
#         except AssertionError:
#             try:
#                 assert self.ds_hr_path and self.ds_lr_path
#             except AssertionError:
#                 raise AssertionError("[-] DataSet's path is required!")
# 
#         self.use_save = use_save
#         self.save_type = save_type
#         self.save_file_name = save_file_name
# 
#         try:
#             if self.use_save:
#                 assert self.save_file_name
#             else:
#                 self.save_file_name = ""
#         except AssertionError:
#             raise AssertionError("[-] save-file/folder-name is required!")
# 
#         self.n_images = 800
#         self.n_images_val = 100
# 
#         self.use_img_scaling = use_img_scale
# 
#         if self.ds_path:  # like .h5 or .tfr
#             self.ds_hr_path = self.ds_path + "/DIV2K_train_HR/"
#             self.ds_lr_path = self.ds_hr_path  # self.ds_path + "/DIV2K_train_LR_bicubic/" + self.ds_name + "/"
# 
#         self.hr_images = DataSetLoader(
#             path=self.ds_hr_path,
#             size=self.hr_shape,
#             use_save=self.use_save,
#             name=self.save_type,
#             save_file_name=self.save_file_name + "-hr.h5",
#             use_image_scaling=self.use_img_scaling,
#             image_scale='-1,1',
#             img_save_method=cv2.INTER_LINEAR,
#         ).raw_data  # numpy arrays
# 
#         self.lr_images = DataSetLoader(
#             path=self.ds_lr_path,
#             size=self.lr_shape,
#             use_save=self.use_save,
#             name=self.save_type,
#             save_file_name=self.save_file_name + "-lr.h5",
#             use_image_scaling=self.use_img_scaling,
#             image_scale='-1,1',
#             img_save_method=cv2.INTER_CUBIC,
#         ).raw_data  # numpy arrays


import time
import numpy as np
import tensorflow as tf
import awesome_gans.image_utils as iu
import awesome_gans.srgan.srgan_model as srgan
from awesome_gans.datasets import Div2KDataSet as DataSet



np.random.seed(1337)

results = {'output': './gen_img/', 'model': './model/SRGAN-model.ckpt'}

train_step = {
    'batch_size': 16,
    'init_epochs': 100,

# Path: awesome_gans/datasets.py
# class Div2KDataSet:
#     def __init__(
#         self,
#         hr_height=384,
#         hr_width=384,
#         lr_height=96,
#         lr_width=96,
#         channel=3,
#         use_split=False,
#         split_rate=0.1,
#         random_state=42,
#         n_threads=8,
#         ds_path=None,
#         ds_name=None,
#         use_img_scale=True,
#         ds_hr_path=None,
#         ds_lr_path=None,
#         use_save=False,
#         save_type='to_h5',
#         save_file_name=None,
#     ):
# 
#         """
#         # General Settings
#         :param hr_height: input HR image height, default 384
#         :param hr_width: input HR image width, default 384
#         :param lr_height: input LR image height, default 96
#         :param lr_width: input LR image width, default 96
#         :param channel: input image channel, default 3 (RGB)
#         - in case of Div2K - ds x4, image size is 384 x 384 x 3 (HWC).
# 
#         # Pre-Processing Option
#         :param split_rate: image split rate (into train & test), default 0.1
#         :param random_state: random seed for shuffling, default 42
#         :param n_threads: the number of threads for multi-threading, default 8
# 
#         # DataSet Option
#         :param ds_path: DataSet's Path, default None
#         :param ds_name: DataSet's Name, default None
#         :param use_img_scale: using img scaling?
#         :param ds_hr_path: DataSet High Resolution path
#         :param ds_lr_path: DataSet Low Resolution path
#         :param use_save: saving into another file format
#         :param save_type: file format to save
#         :param save_file_name: file name to save
#         """
# 
#         self.hr_height = hr_height
#         self.hr_width = hr_width
#         self.lr_height = lr_height
#         self.lr_width = lr_width
#         self.channel = channel
#         self.hr_shape = (self.hr_height, self.hr_width, self.channel)
#         self.lr_shape = (self.lr_height, self.lr_width, self.channel)
# 
#         self.use_split = use_split
#         self.split_rate = split_rate
#         self.random_state = random_state
#         self.num_threads = n_threads  # change this value to the fitted value for ur system
# 
#         """
#         Expected ds_path : div2k/...
#         Expected ds_name : X4
#         """
#         self.ds_path = ds_path
#         self.ds_name = ds_name
#         self.ds_hr_path = ds_hr_path
#         self.ds_lr_path = ds_lr_path
# 
#         try:
#             assert self.ds_path
#         except AssertionError:
#             try:
#                 assert self.ds_hr_path and self.ds_lr_path
#             except AssertionError:
#                 raise AssertionError("[-] DataSet's path is required!")
# 
#         self.use_save = use_save
#         self.save_type = save_type
#         self.save_file_name = save_file_name
# 
#         try:
#             if self.use_save:
#                 assert self.save_file_name
#             else:
#                 self.save_file_name = ""
#         except AssertionError:
#             raise AssertionError("[-] save-file/folder-name is required!")
# 
#         self.n_images = 800
#         self.n_images_val = 100
# 
#         self.use_img_scaling = use_img_scale
# 
#         if self.ds_path:  # like .h5 or .tfr
#             self.ds_hr_path = self.ds_path + "/DIV2K_train_HR/"
#             self.ds_lr_path = self.ds_hr_path  # self.ds_path + "/DIV2K_train_LR_bicubic/" + self.ds_name + "/"
# 
#         self.hr_images = DataSetLoader(
#             path=self.ds_hr_path,
#             size=self.hr_shape,
#             use_save=self.use_save,
#             name=self.save_type,
#             save_file_name=self.save_file_name + "-hr.h5",
#             use_image_scaling=self.use_img_scaling,
#             image_scale='-1,1',
#             img_save_method=cv2.INTER_LINEAR,
#         ).raw_data  # numpy arrays
# 
#         self.lr_images = DataSetLoader(
#             path=self.ds_lr_path,
#             size=self.lr_shape,
#             use_save=self.use_save,
#             name=self.save_type,
#             save_file_name=self.save_file_name + "-lr.h5",
#             use_image_scaling=self.use_img_scaling,
#             image_scale='-1,1',
#             img_save_method=cv2.INTER_CUBIC,
#         ).raw_data  # numpy arrays


# Path: awesome_gans/srgan/srgan_train.py
import time
import numpy as np
import tensorflow as tf
import awesome_gans.image_utils as iu
import awesome_gans.srgan.srgan_model as srgan
from awesome_gans.datasets import Div2KDataSet as DataSet




np.random.seed(1337)

results = {'output': './gen_img/', 'model': './model/SRGAN-model.ckpt'}

train_step = {
    'batch_size': 16,
    'init_epochs': 100,

    'train_epochs': 1501,