-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_shapenet.py
73 lines (67 loc) · 1.96 KB
/
test_shapenet.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import matplotlib
matplotlib.use('Agg')
import tensorflow as tf
import argparse
from libs.train_vae import train_vae
def test_shapenet():
parser = argparse.ArgumentParser(description='Parser added')
parser.add_argument(
'-c',
action="store_true",
dest="convolutional",
help='Whether use convolution or not')
parser.add_argument(
'-f',
action="store_true",
dest="fire",
help='Whether use fire module or not')
parser.add_argument(
'-v',
action="store_true",
dest="variational",
help='Wether use latent variance or not')
parser.add_argument(
'-m',
action="store_true",
dest="metric",
help='Whether use metric loss or not')
parser.add_argument(
'-r',
action="store",
type=int,
dest="rank",
help='Rank of metric learning')
parser.add_argument(
'-o',
action="store",
dest="output_path",
default="result_shapenet",
help='Destination for storing results')
parser.print_help()
results = parser.parse_args()
# Train an autoencoder on Synthetic data rendered from ShapeNet.
train_vae(
files_train="./list_annotated_shapenet.csv",
files_valid="./list_annotated_imagenet.csv",
input_shape=[116, 116, 3],
output_shape=[116, 116, 3],
batch_size=32,
n_epochs=5000,
crop_shape=[112, 112],
crop_factor=1.0,
convolutional=results.convolutional,
fire=results.fire,
variational=results.variational,
metric=results.metric,
order=results.rank,
n_filters=[128, 128, 128, 128, 128],
n_hidden=128,
n_code=64,
n_clusters=13,
dropout=True,
filter_sizes=[3, 3, 3, 3, 3],
activation=tf.nn.sigmoid,
ckpt_name='./shapenet.ckpt',
output_path=results.output_path)
if __name__ == '__main__':
test_shapenet()