-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfl_split_test.py
More file actions
50 lines (42 loc) · 1.4 KB
/
fl_split_test.py
File metadata and controls
50 lines (42 loc) · 1.4 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
# coding=utf8
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from models.split_model import SCNN
from data.mtfl_data import read_data_sets, BatchRenderer
import sys
attribute = 'gender'
logdir = 'trained_models/fl_' + attribute + '_split_model'
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_float('lr', 1e-2, 'learning rate')
tf.app.flags.DEFINE_float('valid', 0.2, 'fraction of validation set')
tf.app.flags.DEFINE_integer('n_epoch', 1000, 'number of epochs')
tf.app.flags.DEFINE_integer('batch_size', 128, 'batch size')
#tf.app.flags.DEFINE_string('train_dir', logdir, 'dir to store models')
# Global settings
szImg = 39
n_y_landmark = 10
n_y_attribute = 2
def main(args=None):
nn = SCNN(
input_shape=[FLAGS.batch_size, szImg, szImg, 1],
n_filter=[20, 40, 60, 80],
n_hidden=[120],
n_y_landmark=n_y_landmark,
n_y_attribute=n_y_attribute,
receptive_field=[[4, 4], [3, 3], [3, 3], [2, 2]],
pool_size=[[2, 2], [2, 2], [2, 2], [1, 1]],
attribute=attribute,
logdir=logdir)
nn.test()
if __name__ == '__main__':
if len(sys.argv) > 1:
attribute = sys.argv[1]
logdir = 'trained_models/fl_' + attribute + '_split_model'
if attribute == 'all':
n_y_attribute = 8
else:
n_y_attribute = 2
tf.app.run()
else:
print("Please pass in argument")