-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
45 lines (35 loc) · 1.17 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import tensorflow as tf
import numpy as np
import glob
import sys
import os
from models import *
import yaml
######### Loading Data ###########
blur_images = np.load("./Flower_Images.npy")
blur_images = blur_images[:57]
norm_images = np.load("./Norm_Flower_Images.npy")
print "Data Loaded"
blur_images = 1/127.0*(blur_images-127.0)
norm_images = 1/127.0*(norm_images-127.0)
######## Making Directory #########
log_dir = "./logs/"
model_path = log_dir+sys.argv[1]
if not os.path.exists(model_path):
os.makedirs(model_path)
os.makedirs(model_path+"/results")
os.makedirs(model_path+"/tf_graph")
os.makedirs(model_path+"/saved_model")
####### Reading Hyperparameters #####$
with open("config.yaml") as file:
data = yaml.load(file)
training_params = data['training_params']
learning_rate = float(training_params['learning_rate'])
batch_size = int(training_params['batch_size'])
epoch_size = int(training_params['epochs'])
os.system('cp config.yaml '+model_path+'/config.yaml')
Unet = UNET(model_path)
Unet.build_model()
Unet.train_model(inputs = [norm_images, blur_images],learning_rate, batch_size, epoch_size)