-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
34 lines (26 loc) · 841 Bytes
/
run.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
import os
import sys
import tensorflow as tf
import json
from easydict import EasyDict
from logger import Logger
from loader import StackedHourglassLoader1
from model import StackedHourglassModel
from trainer import StackedHourglassTrainer
from utils.dirs import clear_dirs
os.environ['CUDA_VISIBLE_DEVICES'] = '2'
config_fname = str(sys.argv[1])
print(config_fname)
with open(config_fname, 'r') as f:
config = json.load(f)
config = EasyDict(config)
if config.restart:
clear_dirs((config.loader_dir, config.log_dir, config.cp_dir), name=config.name)
loader = StackedHourglassLoader1(config)
model = StackedHourglassModel(config)
logger = Logger(config)
sess = tf.Session()
trainer = StackedHourglassTrainer(config, sess, model, logger, loader)
trainer.train()
logger.stop()
# nohup python - u run.py config.json > run1.out &