-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathtest.py
41 lines (30 loc) · 1.38 KB
/
test.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
from __future__ import absolute_import
import tensorflow as tf
import os
import yaml
import h5py
from Model.Decoder_Handler import Decoder_Handler
config_filename = './Model/Config.yaml'
scenario = 'NBA'
def main():
folder_id, config_id = 'NBA-Decoder-TNN', 'config-nba.yaml'
with open(config_filename) as handle:
model_config = yaml.load(handle)
log_dir = os.path.join(os.path.abspath('.'), model_config['result_dir'], model_config['result_model'], folder_id)
with open(os.path.join(log_dir, config_id)) as handle:
model_config = yaml.load(handle)
data_name = os.path.join(os.path.abspath('.'), 'Data', model_config['category'], model_config['data_name'])
if model_config['mask_name'] == 'Original':
mask_name = None
else:
mask_name = os.path.join(os.path.abspath('.'),'Data',model_config['category'],model_config['mask_name'])
dataset_name = (data_name,mask_name)
tf_config = tf.ConfigProto()
os.environ["CUDA_VISIBLE_DEVICES"] = "2" # Please change the id of GPU in your local server accordingly
tf_config = tf.ConfigProto()
tf_config.gpu_options.allow_growth = True
with tf.Session(config=tf_config) as sess:
Cube_Decoder = Decoder_Handler(dataset_name=dataset_name, model_config=model_config, sess = sess, is_training=False)
Cube_Decoder.test()
if __name__ == '__main__':
main()