-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
51 lines (40 loc) · 1.38 KB
/
main.py
File metadata and controls
51 lines (40 loc) · 1.38 KB
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
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 20 16:38:59 2019
@author: Shiru, Yifan
"""
import os
import numpy as np
from options.train_options import TrainOptions
from data_loader import load_data
from define_model import train_model, test_model
from visualize import save_visualization
from util.util import *
import sys
import csv
import time
def main():
opt = TrainOptions().parse()
if opt.isTrain:
''' Load_data
Function: only select feature images,
Default: load DEM, do all the calculation (gradient/aspect/hillshade) on the fly
Normalize: min, max among the single image
'''
print('Start loading data ...')
prev_t = time.time()
print("time started", prev_t)
Data_dict = load_data(opt)
after_t = time.time()
print("time needed for laoding data", after_t - prev_t)
# the actual model
mkdir(opt.model_path)
img, real, pred = train_model(Data_dict, opt)
else: # test/ prediction
print('===========test==========')
img, real, pred = test_model(opt)
# visualize result
if(opt.visualize):
print('=============Save Visualization 100 Images ===================')
save_visualization(opt.result_path, opt.n_epoch, opt.threshold)
main()