forked from byungsook/deep-fluids
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
35 lines (28 loc) · 892 Bytes
/
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
import numpy as np
import tensorflow as tf
from config import get_config
from util import prepare_dirs_and_logger, save_config
from trainer import Trainer
from trainer3 import Trainer3
def main(config):
prepare_dirs_and_logger(config)
tf.set_random_seed(config.random_seed)
if 'nn' in config.arch:
from data_nn import BatchManager
else:
from data import BatchManager
batch_manager = BatchManager(config)
if config.is_3d:
trainer = Trainer3(config, batch_manager)
else:
trainer = Trainer(config, batch_manager)
if config.is_train:
save_config(config)
trainer.train()
else:
if not config.load_path:
raise Exception("[!] You should specify `load_path` to load a pretrained model")
trainer.test()
if __name__ == "__main__":
config, unparsed = get_config()
main(config)